This commit is contained in:
Max Goedjen 2020-03-07 15:06:10 -08:00
parent e87c181e86
commit dc5cce0b39
No known key found for this signature in database
GPG Key ID: E58C21DD77B9B8E8
1 changed files with 2 additions and 0 deletions

View File

@ -19,12 +19,14 @@ extension NSNotification.Name {
public class AnySecretStore: SecretStore { public class AnySecretStore: SecretStore {
fileprivate let base: Any
fileprivate let _name: () -> String fileprivate let _name: () -> String
fileprivate let _secrets: () -> [AnySecret] fileprivate let _secrets: () -> [AnySecret]
fileprivate let _sign: (Data, AnySecret) throws -> Data fileprivate let _sign: (Data, AnySecret) throws -> Data
fileprivate let _delete: (AnySecret) throws -> Void fileprivate let _delete: (AnySecret) throws -> Void
public init<T>(_ secretStore: T) where T: SecretStore { public init<T>(_ secretStore: T) where T: SecretStore {
base = secretStore
_name = { secretStore.name } _name = { secretStore.name }
_secrets = { secretStore.secrets.map { AnySecret($0) } } _secrets = { secretStore.secrets.map { AnySecret($0) } }
_sign = { try secretStore.sign(data: $0, with: $1 as! T.SecretType) } _sign = { try secretStore.sign(data: $0, with: $1 as! T.SecretType) }