secretive/SecretKit/Common/Types/SecretStore.swift

29 lines
722 B
Swift
Raw Normal View History

2020-02-19 04:52:00 +00:00
import Combine
2020-03-09 03:03:40 +00:00
public protocol SecretStore: ObservableObject, Identifiable {
2020-02-19 04:52:00 +00:00
associatedtype SecretType: Secret
2020-03-09 03:03:40 +00:00
2020-03-07 23:42:40 +00:00
var isAvailable: Bool { get }
2020-03-09 03:03:40 +00:00
var id: UUID { get }
2020-03-04 07:14:38 +00:00
var name: String { get }
2020-02-19 04:52:00 +00:00
var secrets: [SecretType] { get }
func sign(data: Data, with secret: SecretType, for provenance: SigningRequestProvenance) throws -> Data
2020-03-09 03:03:40 +00:00
}
public protocol SecretStoreModifiable: SecretStore {
func create(name: String, requiresAuthentication: Bool) throws
2020-03-04 07:14:38 +00:00
func delete(secret: SecretType) throws
func update(secret: SecretType, name: String) throws
2020-03-04 07:14:38 +00:00
}
extension NSNotification.Name {
static let secretStoreUpdated = NSNotification.Name("com.maxgoedjen.Secretive.secretStore.updated")
2020-02-19 04:52:00 +00:00
}