Skip to content

Commit

Permalink
IOS-3059 Rename wordscount
Browse files Browse the repository at this point in the history
  • Loading branch information
tureck1y committed Mar 13, 2023
1 parent 69984c5 commit 64fa93f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions TangemSdk/TangemSdk/Crypto/BIP39/BIP39.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct BIP39 {
let bitIndexes = concatenatedBits.chunked(into: 11)
let indexes = bitIndexes.compactMap { Int($0.joined(), radix: 2) }

guard indexes.count == entropyLength.wordsCount else {
guard indexes.count == entropyLength.wordCount else {
throw MnemonicError.mnenmonicCreationFailed
}

Expand All @@ -86,7 +86,7 @@ struct BIP39 {
throw MnemonicError.wrongWordCount
}

guard let entropyLength = EntropyLength.allCases.first(where: { $0.wordsCount == mnemonicComponents.count }) else {
guard let entropyLength = EntropyLength.allCases.first(where: { $0.wordCount == mnemonicComponents.count }) else {
throw MnemonicError.wrongWordCount
}

Expand Down
2 changes: 1 addition & 1 deletion TangemSdk/TangemSdk/Crypto/BIP39/EntropyLength.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public enum EntropyLength: Int, CaseIterable {
case bits224 = 224
case bits256 = 256

var wordsCount: Int {
var wordCount: Int {
switch self {
case .bits128: return 12
case .bits160: return 15
Expand Down
2 changes: 1 addition & 1 deletion TangemSdk/TangemSdkTests/BIP39Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class BIP39Tests: XCTestCase {
for entropyLength in entropyLengthArray {
for wordlist in wordLists {
let mnemonic = try bip39.generateMnemonic(entropyLength: entropyLength, wordlist: wordlist)
XCTAssertEqual(mnemonic.count, entropyLength.wordsCount)
XCTAssertEqual(mnemonic.count, entropyLength.wordCount)
}
}
}
Expand Down

0 comments on commit 64fa93f

Please sign in to comment.