2022-01-02 00:43:29 +00:00
|
|
|
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 }
|
|
|
|
|
2021-11-08 01:41:59 +00:00
|
|
|
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
|
2021-06-01 06:20:38 +00:00
|
|
|
func update(secret: SecretType, name: String) throws
|
2020-03-04 07:14:38 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
extension NSNotification.Name {
|
|
|
|
|
2022-01-02 00:43:29 +00:00
|
|
|
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
|
|
|
}
|