Licence
MIT
Version
1.0.0
Deps
2
Size
5 kB
Vulns
0
Weekly
0
mnemonic-to-key-pair
Obtain a key pair from a BIP 39 mnemonic phrase.
Installation
npm install mnemonic-to-key-pair
Usage
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
API
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. |
keyPair
Properties
| Name | Type | Description |
|---|---|---|
| privateKey | Buffer |
The private key. |
| publicKey | Buffer |
The public key. |
License
MIT