How to use the libp2p-crypto.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 libp2p / js-iprs-record / test / validator.spec.js View on Github external
      (cb) => crypto.generateKeyPair('rsa', 1024, cb),
      (pair, cb) => {
github libp2p / js-iprs-record / test / record.spec.js View on Github external
        (cb) => crypto.generateKeyPair('rsa', 1024, cb),
        (cb) => crypto.generateKeyPair('rsa', 1024, cb)
github validitylabs / hopr / src / getPeerInfo.js View on Github external
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)
                }
            })