Closed mvondracek closed 4 years ago
UTF-8 error could also apply to --password
argument which is then used in PBKDF2.
Should wait until #41 gets merged.
@lsolodkova please write unittests & fix for invalid UTF-8 sequences. (+ def get_invalid_passwords():
)
Regarding non-UTF-8 dictionary: for open() in text mode, if encoding is not specified the encoding used is platform dependent. May I explicitly pass encoding='utf-8' to all open() calls and then catch UnicodeDecodeError?
Dictionary will not use open
at all, see 4878a42442574c206dec6dfd40c107b84df27012.
As for invalid passwords, see https://github.com/mvondracek/PA193_mnemonic_Slytherin/pull/57#discussion_r339494438.
Concerning open
for reading mnemonic phrase from input, you are right and it should specify UTF-8 so we can detect invalid sequences.
For passwords we currently have valid_password function. Should I modify it or it's better to catch UnicodeError somewhere else?
valid_password
is a good place for validation. 126d09f43cf3446ce5afbe03497f8213e8290209
Is currently reported as
UNKNOWN_FAILURE = 1
. Would be better to report it asEX_DATAERR = 65
frommnemoniccli.ExitCode.EX_DATAERR
.Already mentioned in https://github.com/mvondracek/PA193_mnemonic_Slytherin/issues/12#issuecomment-543391802.
Errors with UTF-8 apply to dictionary, too. (https://github.com/mvondracek/PA193_mnemonic_Slytherin/pull/21#discussion_r336257567)