diff --git a/Sources/ElixxirDAppsSDK/ClientCreator.swift b/Sources/ElixxirDAppsSDK/ClientCreator.swift index 9e698645cb98323c6e1e39394ebe325fa20ae3e9..5049fbcec655896226e11f8f2751c94181910d75 100644 --- a/Sources/ElixxirDAppsSDK/ClientCreator.swift +++ b/Sources/ElixxirDAppsSDK/ClientCreator.swift @@ -1,18 +1,23 @@ import Bindings public struct ClientCreator { - public var create: (URL, Data, Data) throws -> Void + public var create: (URL, Data, Data, String?) throws -> Void - public func callAsFunction(directoryURL: URL, ndf: Data, password: Data) throws { - try create(directoryURL, ndf, password) + public func callAsFunction( + directoryURL: URL, + ndf: Data, + password: Data, + regCode: String? = nil + ) throws { + try create(directoryURL, ndf, password, regCode) } } extension ClientCreator { - public static let live = ClientCreator { directoryURL, ndf, password in + public static let live = ClientCreator { directoryURL, ndf, password, regCode in var error: NSError? let network = String(data: ndf, encoding: .utf8)! - let created = BindingsNewClient(network, directoryURL.path, password, nil, &error) + let created = BindingsNewClient(network, directoryURL.path, password, regCode, &error) if let error = error { throw error } @@ -24,7 +29,7 @@ extension ClientCreator { #if DEBUG extension ClientCreator { - public static let failing = ClientCreator { _, _, _ in + public static let failing = ClientCreator { _, _, _, _ in struct NotImplemented: Error {} throw NotImplemented() }