Remove throwing API
This commit is contained in:
parent
324e3ae337
commit
b4046066da
|
@ -66,19 +66,22 @@ public class Mnemonic: NSObject {
|
||||||
*/
|
*/
|
||||||
public static func deterministicSeedString(from mnemonic: String,
|
public static func deterministicSeedString(from mnemonic: String,
|
||||||
passphrase: String = "",
|
passphrase: String = "",
|
||||||
language: MnemonicLanguageType = .english) throws -> String {
|
language: MnemonicLanguageType = .english) -> String? {
|
||||||
guard let normalizedData = self.normalized(string: mnemonic),
|
guard let normalizedData = self.normalized(string: mnemonic),
|
||||||
let saltData = normalized(string: "mnemonic" + passphrase) else {
|
let saltData = normalized(string: "mnemonic" + passphrase) else {
|
||||||
return ""
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
let passwordBytes = normalizedData.bytes
|
let passwordBytes = normalizedData.bytes
|
||||||
let saltBytes = saltData.bytes
|
let saltBytes = saltData.bytes
|
||||||
do {
|
do {
|
||||||
let bytes = try PKCS5.PBKDF2(password: passwordBytes, salt: saltBytes, iterations: 2048, variant: .sha512).calculate()
|
let bytes = try PKCS5.PBKDF2(password: passwordBytes,
|
||||||
|
salt: saltBytes,
|
||||||
|
iterations: 2048,
|
||||||
|
variant: .sha512).calculate()
|
||||||
return bytes.toHexString()
|
return bytes.toHexString()
|
||||||
} catch {
|
} catch {
|
||||||
throw error
|
throw nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue