Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(cb) => crypto.generateKeyPair('rsa', 1024, cb),
(pair, cb) => {
(cb) => crypto.generateKeyPair('rsa', 1024, cb),
(cb) => crypto.generateKeyPair('rsa', 1024, cb)
new Promise(async (resolve, reject) => {
let serializedKeyPair
try {
serializedKeyPair = await db.get('key-pair')
resolve(deserializeKeyPair(serializedKeyPair))
} catch (err) {
if (!err.notFound) return reject(err)
const key = await generateKeyPair('secp256k1', 256)
const peerId = await PeerId.createFromPrivKey(key.bytes)
const serializedKeyPair = await serializeKeyPair(peerId)
console.log(serializedKeyPair)
await db.put('key-pair', serializedKeyPair)
resolve(peerId)
}
})