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

Add PasswordGenerator

parent 245bf8b6
No related branches found
No related tags found
1 merge request!1Client management
public struct BindingsDownloadAndVerifySignedNdfWithUrlUnknownError: Error, Equatable {
public init() {}
}
public struct BindingsGenerateSecretUnknownError: Error, Equatable {
public init() {}
}
import Bindings
public struct PasswordGenerator {
public var run: () throws -> Data
public func callAsFunction() throws -> Data {
try run()
}
}
extension PasswordGenerator {
public static let live = PasswordGenerator {
guard let secret = BindingsGenerateSecret(32) else {
throw BindingsGenerateSecretUnknownError()
}
return secret
}
}
#if DEBUG
extension PasswordGenerator {
public static let failing = PasswordGenerator {
struct NotImplemented: Error {}
throw NotImplemented()
}
}
#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