Skip to content
Snippets Groups Projects
Commit 79e8e4ac authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Add regCode parameter to ClientCreator

parent bf349a01
No related branches found
No related tags found
1 merge request!2Bindings API wrapper
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()
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment