mirror of https://github.com/maxgoedjen/secretive
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
740 B
32 lines
740 B
import SecretKit
|
|
import SecretAgentKit
|
|
|
|
struct StubWitness {
|
|
|
|
let speakNow: (AnySecret, SigningRequestProvenance) -> Bool
|
|
let witness: (AnySecret, SigningRequestProvenance) -> ()
|
|
|
|
}
|
|
|
|
extension StubWitness: SigningWitness {
|
|
|
|
func speakNowOrForeverHoldYourPeace(forAccessTo secret: AnySecret, from store: AnySecretStore, by provenance: SigningRequestProvenance) throws {
|
|
let objection = speakNow(secret, provenance)
|
|
if objection {
|
|
throw TheresMyChance()
|
|
}
|
|
}
|
|
|
|
func witness(accessTo secret: AnySecret, from store: AnySecretStore, by provenance: SigningRequestProvenance) throws {
|
|
witness(secret, provenance)
|
|
}
|
|
|
|
}
|
|
|
|
extension StubWitness {
|
|
|
|
struct TheresMyChance: Error {
|
|
|
|
}
|
|
|
|
}
|
|
|