2020-03-24 06:22:22 +00:00
|
|
|
import SecretKit
|
|
|
|
import SecretAgentKit
|
|
|
|
|
|
|
|
struct StubWitness {
|
|
|
|
|
|
|
|
let speakNow: (AnySecret, SigningRequestProvenance) -> Bool
|
|
|
|
let witness: (AnySecret, SigningRequestProvenance) -> ()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
extension StubWitness: SigningWitness {
|
|
|
|
|
2021-11-08 01:41:59 +00:00
|
|
|
func speakNowOrForeverHoldYourPeace(forAccessTo secret: AnySecret, from store: AnySecretStore, by provenance: SigningRequestProvenance) throws {
|
2020-03-24 06:22:22 +00:00
|
|
|
let objection = speakNow(secret, provenance)
|
|
|
|
if objection {
|
|
|
|
throw TheresMyChance()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-08 01:41:59 +00:00
|
|
|
func witness(accessTo secret: AnySecret, from store: AnySecretStore, by provenance: SigningRequestProvenance, requiredAuthentication: Bool) throws {
|
2020-03-24 06:22:22 +00:00
|
|
|
witness(secret, provenance)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
extension StubWitness {
|
|
|
|
|
|
|
|
struct TheresMyChance: Error {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|