mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Add fromMnemonic using same decode method as wallet_propose (rfc1751) (#1992)
* Add rfc1751 mnemonic decoding
This commit is contained in:
@@ -117,6 +117,32 @@ describe('Wallet', function () {
|
||||
assert.equal(wallet.privateKey, privateKey)
|
||||
})
|
||||
|
||||
it('derives a wallet using rfc1751 mnemonic with secp256k1 key', function () {
|
||||
const algorithm = ECDSA.secp256k1
|
||||
const mnemonic =
|
||||
'CAB BETH HANK BIRD MEND SIGN GILD ANY KERN HYDE CHAT STUB'
|
||||
const expectedSeed = 'snVB4iTWYqsWZaj1hkvAy1QzqNbAg'
|
||||
const wallet = Wallet.fromMnemonic(mnemonic, {
|
||||
mnemonicEncoding: 'rfc1751',
|
||||
algorithm,
|
||||
})
|
||||
|
||||
assert.equal(wallet.seed, expectedSeed)
|
||||
})
|
||||
|
||||
it('derives a wallet using rfc1751 mnemonic with ed25519 key', function () {
|
||||
const algorithm = ECDSA.ed25519
|
||||
const mnemonic =
|
||||
'CAB BETH HANK BIRD MEND SIGN GILD ANY KERN HYDE CHAT STUB'
|
||||
const expectedSeed = 'sEdVaw4m9W3H3ou3VnyvDwvPAP5BEz1'
|
||||
const wallet = Wallet.fromMnemonic(mnemonic, {
|
||||
mnemonicEncoding: 'rfc1751',
|
||||
algorithm,
|
||||
})
|
||||
|
||||
assert.equal(wallet.seed, expectedSeed)
|
||||
})
|
||||
|
||||
it('derives a wallet using a Regular Key Pair', function () {
|
||||
const masterAddress = 'rUAi7pipxGpYfPNg3LtPcf2ApiS8aw9A93'
|
||||
const regularKeyPair = {
|
||||
|
||||
Reference in New Issue
Block a user