secretive/Sources/Packages/Sources/SecretKit/Types/SecretStore.swift

32 lines
848 B
Swift
Raw Normal View History

import Foundation
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 -> SignedData
func persistAuthentication(secret: SecretType, forDuration duration: TimeInterval) throws
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 {
public static let secretStoreUpdated = NSNotification.Name("com.maxgoedjen.Secretive.secretStore.updated")
2020-03-04 07:14:38 +00:00
2020-02-19 04:52:00 +00:00
}