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

Add numBytes parameter to PasswordGenerator

parent 79e8e4ac
Branches
Tags
1 merge request!2Bindings API wrapper
import Bindings
public struct PasswordGenerator {
public var run: () -> Data
public var run: (Int) -> Data
public func callAsFunction() -> Data {
run()
public func callAsFunction(numBytes: Int = 32) -> Data {
run(numBytes)
}
}
extension PasswordGenerator {
public static let live = PasswordGenerator {
guard let secret = BindingsGenerateSecret(32) else {
public static let live = PasswordGenerator { numBytes in
guard let secret = BindingsGenerateSecret(numBytes) else {
fatalError("BindingsGenerateSecret returned `nil`")
}
return secret
......@@ -19,7 +19,7 @@ extension PasswordGenerator {
#if DEBUG
extension PasswordGenerator {
public static let failing = PasswordGenerator {
public static let failing = PasswordGenerator { _ in
Data()
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment