Skip to content

Commit 0c3ecf6

Browse files
committed
add doc
1 parent 6deb92b commit 0c3ecf6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/web3swift/KeystoreManager/BIP39.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ public class BIP39 {
9090
return wordList.joined(separator: separator)
9191
}
9292

93+
/**
94+
Initializes a new mnemonics set with the provided bitsOfEntropy.
95+
96+
- Parameters:
97+
- bitsOfEntropy: 128 - 12 words, 192 - 18 words , 256 - 24 words in output.
98+
- language: words language, default english
99+
100+
- Returns: random 12-24 words, that represent new Mnemonic phrase.
101+
*/
93102
static public func generateMnemonics(bitsOfEntropy: Int, language: BIP39Language = BIP39Language.english) throws -> String? {
94103
guard bitsOfEntropy >= 128 && bitsOfEntropy <= 256 && bitsOfEntropy.isMultiple(of: 32) else {return nil}
95104
guard let entropy = Data.randomBytes(length: bitsOfEntropy/8) else {throw AbstractKeystoreError.noEntropyError}

0 commit comments

Comments
 (0)