How to use the supercop.js.createSeed 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 OwenRay / Remote-MediaServer / backend / modules / sharing / EDHT.js View on Github external
checkForKeys() {
    if (!Settings.getValue('dht25519pub')) {
      const keypair = ed.createKeyPair(ed.createSeed());
      Settings.setValue('dht25519pub', keypair.publicKey.toString('hex'));
      Settings.setValue('dht25519priv', keypair.secretKey.toString('hex'));
      Settings.save();
      this.keypair = keypair;
      return;
    }
    this.keypair = {
      publicKey: Buffer.from(Settings.getValue('dht25519pub'), 'hex'),
      secretKey: Buffer.from(Settings.getValue('dht25519priv'), 'hex'),
    };
  }
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