Skip to content

Commit

Permalink
BUGFIX: BIP85 passwords were getting wrong derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
odudex committed Oct 24, 2024
1 parent 7d67e6b commit 290cddc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/krux/pages/home_pages/bip85.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _derive_base64_password(self):
entropy = bip85.derive_entropy(
self.ctx.wallet.key.root,
BIP_PWD_APP_INDEX,
[child_index],
[pwd_len, child_index],
)
password = base_encode(entropy, 64).decode().strip()
password = password[:pwd_len]
Expand Down
12 changes: 6 additions & 6 deletions tests/pages/home_pages/test_bip85.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def test_bip85_base64_password_derivation(mocker, amigo, tdata):
BUTTON_PAGE_PREV, # Move to "< Back"
BUTTON_ENTER, # Leave
],
"O/IkMwPt/B6R5QC/hOILV\n\nIndex: 1\nLength: 21",
"n6JwU7iRyf2vhYeaToS3K\n\nIndex: 1\nLength: 21",
),
# 1 - 24w input, check the password and leave
(
Expand All @@ -223,7 +223,7 @@ def test_bip85_base64_password_derivation(mocker, amigo, tdata):
BUTTON_PAGE_PREV, # Move to "< Back"
BUTTON_ENTER, # Leave
],
"RmM+TPrN8L/7gpvfeqczo\n\nIndex: 1\nLength: 21",
"SC7Ib2KFm8/Fo6T8Okw+m\n\nIndex: 1\nLength: 21",
),
# 2 - invalid password length, retry
(
Expand All @@ -243,7 +243,7 @@ def test_bip85_base64_password_derivation(mocker, amigo, tdata):
BUTTON_PAGE_PREV, # Move to "< Back"
BUTTON_ENTER, # Leave
],
"O/IkMwPt/B6R5QC/hOILV\n\nIndex: 1\nLength: 21",
"n6JwU7iRyf2vhYeaToS3K\n\nIndex: 1\nLength: 21",
),
# 3 - ESC at password length input
(
Expand Down Expand Up @@ -278,8 +278,8 @@ def test_bip85_base64_password_derivation(mocker, amigo, tdata):
BUTTON_PAGE_PREV, # Move to "< Back"
BUTTON_ENTER, # Leave
],
"O/IkMwPt/B6R5QC/hOILV\n\nIndex: 1\nLength: 21",
"O/IkMwPt/B6R5QC/hOILV",
"n6JwU7iRyf2vhYeaToS3K\n\nIndex: 1\nLength: 21",
"n6JwU7iRyf2vhYeaToS3K",
),
# 5 - Test save to SD card
(
Expand All @@ -303,7 +303,7 @@ def test_bip85_base64_password_derivation(mocker, amigo, tdata):
BUTTON_PAGE_PREV, # Move to "< Back"
BUTTON_ENTER, # Leave
],
"O/IkMwPt/B6R5QC/hOILV\n\nIndex: 1\nLength: 21",
"n6JwU7iRyf2vhYeaToS3K\n\nIndex: 1\nLength: 21",
None,
True,
),
Expand Down

0 comments on commit 290cddc

Please sign in to comment.