How to use the supercop.js.createKeyPair function in supercop

To help you get started, we’ve selected a few supercop examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nomic-io / shea / bin / cmd.js View on Github external
async function ensureKey(req, res, next) {
    let gci = req.params.gci || parseGCIFromHeaders(req.headers)
    let userId = req.cookies.userId
    let index = [userId, gci].join(':')
    let seed
    try {
      seed = Buffer.from(await keyStore.get(index), 'base64')
    } catch (e) {
      seed = ed.createSeed()
      await keyStore.put(index, seed.toString('base64'))
    }

    req.keypair = ed.createKeyPair(seed)
    next()
  }
github hyperledger / iroha-javascript / src / irohajs.ts View on Github external
export function createKeyPair (): IKeyPair {
  const seed = supercop.createSeed();
  const keys = supercop.createKeyPair(seed);

  return {
    publicKey: keys.publicKey.toString("base64"),
    privateKey: keys.secretKey.toString("base64")
  };
}
github hyperledger / iroha-javascript / src / irohajs.ts View on Github external
constructor (keyPair?: IWallet) {
    const seed = supercop.createSeed();
    const keys = keyPair || supercop.createKeyPair(seed);

    this.publicKey = keys.publicKey;
    this.privateKey = (keyPair) ? keyPair.privateKey : keys.secretKey;
  }

supercop

cross-compiled javascript implementation of ed25519 based on supercop-ref10

MIT
Latest version published 6 months ago

Package Health Score

56 / 100
Full package analysis