Skip to content

Commit

Permalink
Export code, keyfile gen functions.
Browse files Browse the repository at this point in the history
Also add a missing docstring and istanbul ignore comment.
  • Loading branch information
jtobin committed Sep 30, 2021
1 parent 5af3438 commit 8c503f6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ const shas = (buf, salt) =>
shax(xor(salt, shax(buf)))

const xor = (a, b) => {
/* istanbul ignore if */
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
console.log('a', a)
console.log('b', b)
Expand All @@ -492,6 +493,12 @@ const shaf = (buf, salt) => {
return xor(front, back)
}

/**
* Generate a +code from a keypair.
*
* @param {Object} pair
* @return {String}
*/
const generateCode = pair => {
const ring = hex2buf(createRing(pair))
const salt = hex2buf('73736170') // salt is the noun %pass
Expand Down Expand Up @@ -732,6 +739,8 @@ module.exports = {
shard,
combine,
addressFromSecp256k1Public,
generateCode,
generateKeyfile,

_isGalaxy: isGalaxy,
_isPlanet: isPlanet,
Expand Down

0 comments on commit 8c503f6

Please sign in to comment.