Trim white-spaces from recovery code words
This commit is contained in:
parent
f2aec3f932
commit
542a79e2e1
1 changed files with 3 additions and 1 deletions
|
@ -61,7 +61,9 @@ internal class RecoveryCodeViewModel(
|
||||||
|
|
||||||
@Throws(InvalidWordException::class, ChecksumException::class)
|
@Throws(InvalidWordException::class, ChecksumException::class)
|
||||||
fun validateCode(input: List<CharSequence>): Mnemonics.MnemonicCode {
|
fun validateCode(input: List<CharSequence>): Mnemonics.MnemonicCode {
|
||||||
val code = Mnemonics.MnemonicCode(input.toMnemonicChars())
|
check(input.size == WORD_NUM) { "Got ${input.size} words instead of $WORD_NUM" }
|
||||||
|
val trimmedInput = input.map { it.trim() } // white-spaces have a meaning in next line
|
||||||
|
val code = Mnemonics.MnemonicCode(trimmedInput.toMnemonicChars())
|
||||||
try {
|
try {
|
||||||
code.validate()
|
code.validate()
|
||||||
} catch (e: WordCountException) {
|
} catch (e: WordCountException) {
|
||||||
|
|
Loading…
Reference in a new issue