secretive/SecretKit/SecretStore.swift

28 lines
623 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 }
2020-03-04 07:14:38 +00:00
func sign(data: Data, with secret: SecretType) 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
}
extension NSNotification.Name {
static let secretStoreUpdated = NSNotification.Name("com.maxgoedjen.Secretive.secretStore.updated")
2020-02-19 04:52:00 +00:00
}