1.0.0 • Published 4 years ago

mnemonic-to-key-pair v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

mnemonic-to-key-pair

Build Status Code Style

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.

ParamTypeDescription
mnemonicstringThe 12-words mnemonic phrase.
derivationPathstringThe derivation path to use. I.e. "m/44'...".
passwordstringThe mnemonic password.

keyPair

Properties

NameTypeDescription
privateKeyBufferThe private key.
publicKeyBufferThe public key.

License

MIT