File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Sources/KukaiCryptoSwift/Mnemonic Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -165,9 +165,9 @@ public struct Mnemonic: Equatable, Codable {
165
165
}
166
166
167
167
/**
168
- Check a mnemonic is of the correct length, and is made up of valid BIP39 words
168
+ Check a mnemonic contains valid words and a valid length (all other checks are ignored)
169
169
*/
170
- public func isValid ( in vocabulary: WordList = . english) -> Bool {
170
+ public func isValidWords ( in vocabulary: WordList = . english) -> Bool {
171
171
let words = self . words
172
172
173
173
if words. count != 12 && words. count != 15 && words. count != 18 && words. count != 21 && words. count != 24 {
@@ -182,7 +182,14 @@ public struct Mnemonic: Equatable, Codable {
182
182
}
183
183
}
184
184
185
- return Mnemonic . isValidChecksum ( phrase: words, wordlist: vocabulary)
185
+ return true
186
+ }
187
+
188
+ /**
189
+ Check a mnemonic is of the correct length, is made up of valid BIP39 words, and the checksum matches
190
+ */
191
+ public func isValid( in vocabulary: WordList = . english) -> Bool {
192
+ return isValidWords ( ) && Mnemonic . isValidChecksum ( phrase: words, wordlist: vocabulary)
186
193
}
187
194
188
195
/**
You can’t perform that action at this time.
0 commit comments