Ignore extra spaces and special characters in Recovery Password entry

This commit is contained in:
Andrew
2024-06-27 21:45:13 +09:30
parent 750dfb455d
commit 1cd7a57515
3 changed files with 22 additions and 1 deletions

View File

@@ -76,6 +76,20 @@ class MnemonicCodecTest {
assertEquals("0f2ccde528622876b8f16e14db97dafc", result)
}
@Test
fun `sanitizeAndDecodeAsByteArray with mnemonic with unnecessary spaces`() {
val result = codec.sanitizeAndDecodeAsByteArray(" fuming nearby kennel husband dejected pepper jaded because dads goggles tufts tomorrow dejected ").let(Hex::toStringCondensed)
assertEquals("0f2ccde528622876b8f16e14db97dafc", result)
}
@Test
fun `sanitizeAndDecodeAsByteArray with mnemonic with special characters`() {
val result = codec.sanitizeAndDecodeAsByteArray("...fuming nearby.kennel.husband . dejected pepper jaded because dads goggles tufts tomorrow dejected@").let(Hex::toStringCondensed)
assertEquals("0f2ccde528622876b8f16e14db97dafc", result)
}
@Test
fun `decodeMnemonicOrHexAsByteArray with hex`() {
val result = codec.decodeMnemonicOrHexAsByteArray("0f2ccde528622876b8f16e14db97dafc").let(Hex::toStringCondensed)