File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Sources/web3swift/KeystoreManager Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,15 @@ public class BIP39 {
90
90
return wordList. joined ( separator: separator)
91
91
}
92
92
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
+ */
93
102
static public func generateMnemonics( bitsOfEntropy: Int , language: BIP39Language = BIP39Language . english) throws -> String ? {
94
103
guard bitsOfEntropy >= 128 && bitsOfEntropy <= 256 && bitsOfEntropy. isMultiple ( of: 32 ) else { return nil }
95
104
guard let entropy = Data . randomBytes ( length: bitsOfEntropy/ 8 ) else { throw AbstractKeystoreError . noEntropyError}
You can’t perform that action at this time.
0 commit comments