Obtain a key pair from a BIP 39 mnemonic phrase.
npm install mnemonic-to-key-pair
const mnemonicToKeyPair = require('mnemonic-to-key-pair')
const { publicKey } = mnemonicToKeyPair(
'maze birth captain runway client pulp vast universe era panda discover access',
"m/44'/0'/0'/0/0",
"1234"
)
console.log(publicKey.toString()) // 0238e831638a96248d1a8ee6b6ee16170667b0e0529cdc838d825b135c927aa95d
mnemonicToKeyPair(mnemonic, derivationPath, [password]) ⇒ keyPair
Obtian a key pair from a BIP39 mnemonic phrase and following the supplied derivation path. Optinally supply a password.
Returns: keyPair
- The key pair.
Param | Type | Description |
---|---|---|
mnemonic | string |
The 12-words mnemonic phrase. |
derivationPath | string |
The derivation path to use. I.e. "m/44'...". |
[password] | string |
The mnemonic password. |
Properties
Name | Type | Description |
---|---|---|
privateKey | Buffer |
The private key. |
publicKey | Buffer |
The public key. |
MIT