Skip to content

Commit

Permalink
fix bug in absolute derivation path assembly for scheme V2 with mnemonic
Browse files Browse the repository at this point in the history
  • Loading branch information
refi93 committed Dec 21, 2018
1 parent 4ad34c0 commit 8029b38
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {decodePaperWalletMnemonic, walletSecretFromMnemonic} = require('cardano-crypto.js')
const {decodePaperWalletMnemonic, mnemonicToRootKeypair} = require('cardano-crypto.js')

const {isMnemonicInPaperWalletFormat} = require('../mnemonic')
const {validateMnemonic} = require('../mnemonic')
Expand All @@ -13,7 +13,7 @@ const mnemonicToWalletSecret = async (mnemonic, derivationScheme) => {
mnemonic = await decodePaperWalletMnemonic(mnemonic)
}

return walletSecretFromMnemonic(mnemonic, derivationScheme.number)
return mnemonicToRootKeypair(mnemonic, derivationScheme.number)
}

const mnemonicOrHdNodeStringToWalletSecret = async (
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dependencies": {
"bip39-light": "^1.0.7",
"borc": "^2.0.4",
"cardano-crypto.js": "^4.2.3",
"cardano-crypto.js": "^5.0.0",
"file-saver": "^1.3.8",
"preact": "^8.2.7",
"trezor-connect": "^6.0.0",
Expand Down
20 changes: 10 additions & 10 deletions app/tests/src/address-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,16 @@ describe('wallet addresses derivation scheme V1', () => {

describe('wallet addresses derivation scheme V2', () => {
const expectedWalletAddresses = [
'Ae2tdPwUPEYzQAvoUDaw3kghu19zJcpZrxY5m2wKz2uQuaCXs8ea9EBAAFQ',
'Ae2tdPwUPEZHWwSaKPwi4JkDeijLQM93wgbfbmsA7ssGZLQ3Uh1unvABAKR',
'Ae2tdPwUPEZLeySAx2yxc1eXpdahTqR1fLp8XcVLAHLfHFpukMw7MDt7UyY',
'Ae2tdPwUPEZDV8rMvDE2hzXT984xEKE332zjiCgFu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ret key', async () => {
Expand Down
8 changes: 4 additions & 4 deletions app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1347,10 +1347,10 @@ camelcase@^4.1.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd"
integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=

cardano-crypto.js@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/cardano-crypto.js/-/cardano-crypto.js-4.2.3.tgz#b0ef4ae4cd0bf84b6a948d82a4fe4c75ee779b9c"
integrity sha512-CQqdpBZnQEdSu8+vvBYOSOTfQ4MerhH7KRl/BqDqEMG3cc3LgCwSMmSnQxSD9VRZKAUnvqEtMll5lvwYeu9bTw==
cardano-crypto.js@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/cardano-crypto.js/-/cardano-crypto.js-5.0.0.tgz#cfeae89a0c0dd1fefb1b854f2d2e268d0837b280"
integrity sha512-OT1RSwgGzedxtm6f6yAQF0NagC6BYwXeNyhfcsZfEQtdxyHS1kduM7U4+x3+WDVFen71/Zi9fFp23sOFkwQUig==
dependencies:
bip39-light "^1.0.7"
borc "^2.0.4"
Expand Down

0 comments on commit 8029b38

Please sign in to comment.