mirror of
https://github.com/fluencelabs/js-peer-id
synced 2025-04-25 12:32:27 +00:00
exposes opts + bits
This commit is contained in:
parent
bd185f8081
commit
727355c4f5
10
src/index.js
10
src/index.js
@ -97,9 +97,15 @@ function formatKey (key, type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// generation
|
// generation
|
||||||
exports.create = function () {
|
exports.create = function (opts) {
|
||||||
|
opts = opts || {}
|
||||||
|
opts.bits = opts.bits || 2048
|
||||||
|
|
||||||
// generate keys
|
// generate keys
|
||||||
const pair = forge.rsa.generateKeyPair({ bits: 2048, e: 0x10001 })
|
const pair = forge.rsa.generateKeyPair({
|
||||||
|
bits: opts.bits,
|
||||||
|
e: 0x10001
|
||||||
|
})
|
||||||
|
|
||||||
// return the RSA public/private key to asn1 object
|
// return the RSA public/private key to asn1 object
|
||||||
const asnPub = forge.pki.publicKeyToAsn1(pair.publicKey)
|
const asnPub = forge.pki.publicKeyToAsn1(pair.publicKey)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user