Skip to content

Commit 4979ac6

Browse files
authored
Fix derivation path validation (#590)
1 parent 51b11bd commit 4979ac6

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/modules/select/wallets/hd-wallet.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ export function isValidPath(path: string) {
5454
return true
5555
}
5656

57-
const accountFieldDigit = Number(parts[3][0])
57+
const accountFieldNumber = Number(parts[3].slice(0, -1))
5858

5959
if (
60-
isNaN(accountFieldDigit) ||
61-
accountFieldDigit < 0 ||
62-
parts[3][1] !== "'"
60+
isNaN(accountFieldNumber) ||
61+
accountFieldNumber < 0 ||
62+
parts[3].slice(-1) !== "'"
6363
) {
6464
return false
6565
}
@@ -68,19 +68,19 @@ export function isValidPath(path: string) {
6868
return true
6969
}
7070

71-
const changeFieldDigit = Number(parts[4][0])
71+
const changeFieldNumber = Number(parts[4])
7272

73-
if (isNaN(changeFieldDigit) || changeFieldDigit < 0) {
73+
if (isNaN(changeFieldNumber) || changeFieldNumber < 0) {
7474
return false
7575
}
7676

7777
if (parts[5] === undefined) {
7878
return true
7979
}
8080

81-
const addressFieldDigit = Number(parts[5][0])
81+
const addressFieldNumber = Number(parts[5])
8282

83-
if (isNaN(addressFieldDigit) || addressFieldDigit < 0) {
83+
if (isNaN(addressFieldNumber) || addressFieldNumber < 0) {
8484
return false
8585
}
8686

src/views/WalletSelect.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
6464
let walletsDisabled: boolean = showTermsOfService
6565
66-
let agreed: boolean
66+
let agreed: boolean = false
6767
6868
$: if (agreed) {
6969
localStorage.setItem(

0 commit comments

Comments
 (0)