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

Add GenerateSecret functor

parent 4838dfdd
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!18Update Bindings
import Bindings
import XCTestDynamicOverlay
public struct PasswordGenerator {
public struct GenerateSecret {
public var run: (Int) -> Data
public func callAsFunction(numBytes: Int = 32) -> Data {
......@@ -8,8 +9,8 @@ public struct PasswordGenerator {
}
}
extension PasswordGenerator {
public static let live = PasswordGenerator { numBytes in
extension GenerateSecret {
public static let live = GenerateSecret { numBytes in
guard let secret = BindingsGenerateSecret(numBytes) else {
fatalError("BindingsGenerateSecret returned `nil`")
}
......@@ -17,10 +18,8 @@ extension PasswordGenerator {
}
}
#if DEBUG
extension PasswordGenerator {
public static let failing = PasswordGenerator { _ in
fatalError("Not implemented")
}
extension GenerateSecret {
public static let unimplemented = GenerateSecret(
run: XCTUnimplemented("\(Self.self)")
)
}
#endif
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