Document API, make language param optional.
This commit is contained in:
parent
1d1a505f0a
commit
f0a419668a
|
@ -47,8 +47,7 @@ class MnemonicTests: XCTestCase {
|
|||
let expectedDeterministicSeedString = testCase[deterministicSeedStringIndex]
|
||||
|
||||
let deterministicSeedString = try! Mnemonic.deterministicSeedString(from: mnemonicString,
|
||||
passphrase: passphrase,
|
||||
language: .english)
|
||||
passphrase: passphrase)
|
||||
XCTAssertEqual(deterministicSeedString, expectedDeterministicSeedString)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,8 +57,16 @@ public class Mnemonic: NSObject {
|
|||
return mnemonic.joined(separator: " ")
|
||||
}
|
||||
|
||||
public static func deterministicSeedString(from mnemonic: String, passphrase: String = "", language: MnemonicLanguageType) throws -> String {
|
||||
|
||||
/**
|
||||
* Generate a deterministic seed string from the given inputs.
|
||||
*
|
||||
* @param mnemonic The mnemonic to use.
|
||||
* @param passphrase An optional passphrase. Default is the empty string.
|
||||
* @param language The language to use. Default is english.
|
||||
*/
|
||||
public static func deterministicSeedString(from mnemonic: String,
|
||||
passphrase: String = "",
|
||||
language: MnemonicLanguageType = .english) throws -> String {
|
||||
func normalized(string: String) -> Data? {
|
||||
guard let data = string.data(using: .utf8, allowLossyConversion: true) else {
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue