Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function keypairAndOpts () {
var keyPair = crypto.keyPair()
var opts = {
secretKey: keyPair.secretKey,
storeSecretKey: true
}
var key = keyPair.publicKey.toString('hex')
return [key, opts]
}
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)
})
}