-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add seed phrase validation for keycard and status-go calls #22269
base: develop
Are you sure you want to change the base?
Conversation
Jenkins Builds
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, left a few comments
src/keycard/keycard.cljs
Outdated
(generateAndLoadKey mnemonic pin) | ||
(then on-success) | ||
(catch on-failure))) | ||
(native-module/validate-mnemonic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry i know i suggested that, but it's better to move validation outside, keycard ns shouldn't know about native-module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved validation outside, but out of 4, only 2 functions are being used. So I can only apply validation there. Please let me know, if it looks ok.
3cef433
to
4646ca8
Compare
(fn [{:keys [mnemonic on-failure] :as args}] | ||
(-> mnemonic | ||
(native-module/validate-mnemonic) | ||
(promesa/then #(keycard/generate-and-load-key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to add the mnemonic validation directly in the function generate-and-load-key
? Otherwise, all devs will need to remember to call it before generate-and-load-key
. Or another way to frame the question @Parveshdhull, do you think there's any situation where we shouldn't validate the mnemonic before calling generate-and-load-key
?
Same question for the function create-account-from-mnemonic
, is there any scenario where we don't want to validate the mnemonic? If the answer is no, then it's better to call native-module/validate-mnemonic
inside native-module/create-account-from-mnemonic
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @ilmotta, Thank you very much for reviewing the PR.
Wouldn't it be better to add the mnemonic validation directly in the function generate-and-load-key?
This is how I originally implemented validation, please check out #22269 (comment)
79% of end-end tests have passed
Failed tests (3)Click to expandClass TestCommunityMultipleDeviceMerged:
Class TestWalletCollectibles:
Passed tests (11)Click to expandClass TestWalletOneDevice:
Class TestCommunityOneDeviceMerged:
Class TestWalletMultipleDevice:
Class TestOneToOneChatMultipleSharedDevicesNewUi:
Class TestWalletCollectibles:
|
Summary
Add seed phrase validation for keycard and status-go calls
related issue: #22209 (comment)
PR don't need to be manually test, as its only adding small validation check for mnemonics. I will test it manually before merging
(done, video 1, video 2)
status: ready