Skip to content

crypto.generateKeyPair(t) should have option to pass random seed data #29274

@tarun1475

Description

@tarun1475

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.feature requestIssues that request new features to be added to Node.js.opensslIssues and PRs related to the OpenSSL dependency.wontfixIssues that will not be fixed.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions