From 8afd803c7fa1fe6716b47f66f77b4fa9ceb94aea Mon Sep 17 00:00:00 2001 From: Simon McLoughlin Date: Tue, 30 Apr 2024 11:19:07 +0100 Subject: [PATCH] - remove lowercasing from word retrieval to prevent masking of an issue tied to passing in words in the wrong case - update tests to check for uppercase correctly failing tests --- Sources/KukaiCryptoSwift/Mnemonic/Mnemonic.swift | 2 +- Tests/KukaiCryptoSwiftTests/MnemonicTests.swift | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/KukaiCryptoSwift/Mnemonic/Mnemonic.swift b/Sources/KukaiCryptoSwift/Mnemonic/Mnemonic.swift index 0a1c497..45606d1 100644 --- a/Sources/KukaiCryptoSwift/Mnemonic/Mnemonic.swift +++ b/Sources/KukaiCryptoSwift/Mnemonic/Mnemonic.swift @@ -30,7 +30,7 @@ public struct Mnemonic: Equatable, Codable { /// The list of words. public var words: [String] { - phrase.lowercased().split(separator: " ").map(String.init) + phrase.split(separator: " ").map(String.init) } /** diff --git a/Tests/KukaiCryptoSwiftTests/MnemonicTests.swift b/Tests/KukaiCryptoSwiftTests/MnemonicTests.swift index 0ced4f1..47611a6 100644 --- a/Tests/KukaiCryptoSwiftTests/MnemonicTests.swift +++ b/Tests/KukaiCryptoSwiftTests/MnemonicTests.swift @@ -78,5 +78,8 @@ final class MnemonicTests: XCTestCase { let mnemonic7 = try Mnemonic(seedPhrase: "kit trigger pledge excess payment sentence dutch mandate start sense seed kit") XCTAssert(mnemonic7.isValid() == false) + + let mnemonic8 = try Mnemonic(seedPhrase: "Kit trigger pledge excess payment sentence dutch mandate start sense seed venture") + XCTAssert(mnemonic8.isValid() == false) } }