How to use the hypercore/lib/crypto.js.keyPair function in hypercore

To help you get started, we’ve selected a few hypercore 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 arso-project / archipel / packages / server / workspace.js View on Github external
function keypairAndOpts () {
  var keyPair = crypto.keyPair()
  var opts = {
    secretKey: keyPair.secretKey,
    storeSecretKey: true
  }
  var key = keyPair.publicKey.toString('hex')
  return [key, opts]
}
github Frando / multihyperdb / index.js View on Github external
MultiHyperDB.prototype.createDB = function (opts, meta, cb) {
  if (typeof meta === 'function') return this.createDB(opts, null, meta)
  var self = this
  opts = Object.assign({}, this.dbOpts, opts)

  var keyPair = crypto.keyPair()
  opts.secretKey = keyPair.secretKey
  opts.storeSecretKey = true

  var db = hyperdb(this.storage(false, keyPair.publicKey.toString('hex')), keyPair.publicKey, opts)

  db.on('ready', function () {
    self._putDB(db, opts, meta, cb)
  })
}

hypercore

Hypercore is a secure, distributed append-only log

MIT
Latest version published 3 days ago

Package Health Score

84 / 100
Full package analysis

Similar packages