-
Notifications
You must be signed in to change notification settings - Fork 16
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
Sanitize 12 words input #815
Comments
Seems like we already do some validation: passphraseValidator : Form.Validate.Validator String -> Form.Validate.Validator Passphrase
passphraseValidator =
let
has12Words passphrase =
if List.length (String.words passphrase) >= 12 then
String.words passphrase
|> List.take 12
|> String.join " "
|> Ok
else
Err (\translators_ -> translators_.t "auth.login.wordsMode.input.notPassphraseError")
wordsHave3Letters passphrase =
if
String.words passphrase
|> List.all (\word -> String.length word > 2)
then
Ok passphrase
else
Err (\translators_ -> translators_.t "auth.login.wordsMode.input.atLeastThreeLettersError")
in
Form.Validate.custom has12Words
>> Form.Validate.custom wordsHave3Letters
>> Form.Validate.map Passphrase @lucca65 any ideas of what else we could do? I couldn't seem to replicate the issue |
clean up extra whitespaces? downcase everything, because some phones force capitalization of the first letter There is also something we could do, we actually have access to the word list. To generate the private key we have a finite number of specific words and we can validate them |
That's already done by
👍
Where can I get that list? 👀 |
the standard we use is called bip39, you can follow our node modules, or here: https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt |
What we have
The input we use to login to the app isn't very smart. It just sends data the way it is.
Proposal
We should make our input smarter and sanitize the data before trying to sign in.
Why
To make it easier for users. Sometimes they may paste something with extra spaces, or their input might be not formatted perfectly.
How
Probably something like this is enough:
Additional context
https://cambiatus.slack.com/archives/CA83HJAAD/p1660764647207089
The text was updated successfully, but these errors were encountered: