-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
crypto.generateKeyPair(t) should have option to pass random seed data #29274
Copy link
Copy link
Closed
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.opensslIssues and PRs related to the OpenSSL dependency.Issues and PRs related to the OpenSSL dependency.wontfixIssues that will not be fixed.Issues that will not be fixed.
Metadata
Metadata
Assignees
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.opensslIssues and PRs related to the OpenSSL dependency.Issues and PRs related to the OpenSSL dependency.wontfixIssues that will not be fixed.Issues that will not be fixed.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Feature:-
crypto.generateKeyPair(type, options, callback)
The above method should have an option to pass 128 or 256 bits of random seed so that
everytime we give that seed to this function we will have the same private and public key pairs.
For applications which needs end to end encryption specifically in bitcoin space it is really helpful to create same keys from the bip39 mnemonic and use it for end to end encryption between various devices.
Alternatives :-
For now i am using https://github.com/VirgilSecurity/virgil-crypto this library for doing end to end encryption tasks.
In their public docs we are not able to find the exact method i am asking for but if we see their code base there is a method virgilCrypto.generateKeysFromKeyMaterial("STRING")
So it can be used as
const VirgilCrypto =require('virgil-crypto');
const bip39 = require('bip39');
const mnemonic = bip39.generateMnemonic();
const seed = bip39.mnemonicToSeedHex(mnemonic);
const virgilCrypto = new VirgilCrypto.VirgilCrypto();
const keyPair = virgilCrypto.generateKeysFromKeyMaterial(seed);
const privateKey = virgilCrypto.exportPrivateKey(keyPair.privateKey);
const publicKey = virgilCrypto.exportPublicKey(keyPair.publicKey);
I am looking to have same sort of method for nodejs crypto module.
Thanks