Document API, make language param optional.

This commit is contained in:
keefertaylor 2018-10-28 20:18:34 +00:00
parent 1d1a505f0a
commit f0a419668a
2 changed files with 11 additions and 4 deletions

View File

@ -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)
}
}

View File

@ -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