How to use the libp2p-crypto.keys.generateKeyPair function in libp2p-crypto

To help you get started, we’ve selected a few libp2p-crypto 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 peer-base / peer-pad / src / keys / generate.js View on Github external
return new Promise((resolve, reject) => {
    options = Object.assign({}, defaultOptions, options)
    keys.generateKeyPair(options.algo, options.bits, (err, key) => {
      if (err) { return reject(err) }
      resolve({
        'public': keys.marshalPublicKey(key.public),
        'private': keys.marshalPrivateKey(key)
      })
    })
  })
}
github ipfs-shipyard / peer-pad-core / src / backend / keys / generate.js View on Github external
return new Promise((resolve, reject) => {
    options = Object.assign({}, defaultOptions, options)
    keys.generateKeyPair(options.algo, options.bits, (err, key) => {
      if (err) { return reject(err) }
      resolve({
        read: encode(keys.marshalPublicKey(key.public)),
        write: encode(keys.marshalPrivateKey(key))
      })
    })
  })
}