-
Notifications
You must be signed in to change notification settings - Fork 369
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
Mnemonic validation flexibility within Valora #6372
Conversation
Looks like #5825 already fixed this. |
Not in all cases. This variable definition: |
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.
The bip39
from the saga is the only required thing to change.
The other are suggestions, but I strongly recommend to keep the ability of choosing the dictionary
@@ -54,21 +55,20 @@ export async function generateMnemonic( | |||
return bip39ToUse.generateMnemonic(strength, undefined, getWordList(language)) | |||
} | |||
|
|||
export function validateMnemonic( | |||
mnemonic: string, | |||
defaultLanguage?: MnemonicLanguages, |
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'm not entire sure of removing these. In a way, if you know the language, you will avoid to search in every dictionary.
I'm more into the idea of searching in the dictionary that the user said, or in all of them otherwise (nil/null).
Thinking more of a common utils side, and not our use case in Valora
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 thought about my approach this way:
Good - eliminate the possibility of user error (i.e., if there is a mismatch between defaultLanguage
and mnemonic
language)
Bad - slightly less efficient as it defaults to checking all languages. However, there are not very many languages and bip39.validateMnemonic
appears very optimized and will fail quickly on a language mismatch
What do you think?
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.
Ok, I agree. We could eventually have another function that requires an specific language if we see that we need to optimise that (which are not the actual cases due to we are only using these to create/update accounts, and won't be called too often)
We were not passing a default language anymore with Gonza's fix:
Good that we're making this even more robust 👍 |
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.
LGTM 👍
bd7d664
to
892ef34
Compare
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.
Great! I really like the mnemonic conversion approach.
I'm approving it, but remember to add the lowerCase
Co-authored-by: Gaston Ponti <pontigaston@gmail.com>
Hi @tarikbellamine I have verified this on latest Android Internal Build V1.8.0(1004294330) & Test Flight Build V1.8.0(40) & observed following:
Let me know if i need to test anything else Thanks! |
@Lss-Ankit could you please test one more thing: enter in the Spanish with the accents and without the accents. For example, if the Spanish account key has the a word like |
Hi @tarikbellamine I have verified following scenarioes:
Attachment: WithAccents.mp4
Attachment: WithoutAccents.mp4
Attachment: AccountKeyEnglishEvenLangaugePortueguese.jpg |
@jeanregisser is this expected or was adding the Portuguese support supposed to include the Account Key as well? |
Description
This PR aims to do two things:
Other changes
No
Tested
Yes
Related issues
Backwards compatibility
Yes