stellar-hd-wallet
Key derivation for Stellar (SEP-0005)
Usage
import StellarHDWallet from 'stellar-hd-wallet'
const mnemonic = StellarHDWallet.generateMnemonic()
const wallet = StellarHDWallet.fromMnemonic(mnemonic)
wallet.getPublicKey(0)
wallet.getSecret(0)
wallet.getKeypair(0)
wallet.derive(`m/44'/148'/0'`)
const seedHex =
'794fc27373add3ac7676358e868a787bcbf1edfac83edcecdb34d7f1068c645dbadba563f3f3a4287d273ac4f052d2fc650ba953e7af1a016d7b91f4d273378f'
const seedBuffer = Buffer.from(seedHex)
StellarHDWallet.fromSeed(seedHex)
StellarHDWallet.fromSeed(seedBuffer)
StellarHDWallet.generateMnemonic()
StellarHDWallet.generateMnemonic({entropyBits: 224})
StellarHDWallet.generateMnemonic({entropyBits: 160})
StellarHDWallet.generateMnemonic({entropyBits: 128})
StellarHDWallet.validateMnemonic('too short and non wordlist words')
Mnemonic Language
Mnemonics can be generated in any language supported by the underlying bip39 npm module.
The full list of language keys are under exports 'wordlists' here.
Usage
import StellarHDWallet from 'stellar-hd-wallet'
StellarHDWallet.generateMnemonic({
language: 'chinese_traditional',
})
StellarHDWallet.generateMnemonic({language: 'french', entropyBits: 128})
Randomness
- NodeJs: crypto.randomBytes
- Browser: window.crypto.getRandomValues
(using randombytes npm module)
Tests
All SEP-0005 test cases are exercised here against these.