Split witness call (fixes #62)
This commit is contained in:
parent
5a2d3ecc2e
commit
85eb4983bc
|
@ -24,6 +24,9 @@ class Notifier {
|
||||||
|
|
||||||
extension Notifier: SigningWitness {
|
extension Notifier: SigningWitness {
|
||||||
|
|
||||||
|
func speakNowOrForeverHoldYourPeace(forAccessTo secret: AnySecret, by provenance: SigningRequestProvenance) throws {
|
||||||
|
}
|
||||||
|
|
||||||
func witness(accessTo secret: AnySecret, by provenance: SigningRequestProvenance) throws {
|
func witness(accessTo secret: AnySecret, by provenance: SigningRequestProvenance) throws {
|
||||||
notify(accessTo: secret, by: provenance)
|
notify(accessTo: secret, by: provenance)
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ extension Agent {
|
||||||
|
|
||||||
let provenance = requestTracer.provenance(from: pid)
|
let provenance = requestTracer.provenance(from: pid)
|
||||||
if let witness = witness {
|
if let witness = witness {
|
||||||
try witness.witness(accessTo: secret, by: provenance)
|
try witness.speakNowOrForeverHoldYourPeace(forAccessTo: secret, by: provenance)
|
||||||
}
|
}
|
||||||
|
|
||||||
let dataToSign = try reader.readNextChunk()
|
let dataToSign = try reader.readNextChunk()
|
||||||
|
@ -122,6 +122,10 @@ extension Agent {
|
||||||
sub.append(writer.lengthAndData(of: signatureChunk))
|
sub.append(writer.lengthAndData(of: signatureChunk))
|
||||||
signedData.append(writer.lengthAndData(of: sub))
|
signedData.append(writer.lengthAndData(of: sub))
|
||||||
|
|
||||||
|
if let witness = witness {
|
||||||
|
try witness.witness(accessTo: secret, by: provenance)
|
||||||
|
}
|
||||||
|
|
||||||
os_log(.debug, "Agent signed request")
|
os_log(.debug, "Agent signed request")
|
||||||
|
|
||||||
return signedData
|
return signedData
|
||||||
|
|
|
@ -3,6 +3,7 @@ import SecretKit
|
||||||
|
|
||||||
public protocol SigningWitness {
|
public protocol SigningWitness {
|
||||||
|
|
||||||
|
func speakNowOrForeverHoldYourPeace(forAccessTo secret: AnySecret, by provenance: SigningRequestProvenance) throws
|
||||||
func witness(accessTo secret: AnySecret, by provenance: SigningRequestProvenance) throws
|
func witness(accessTo secret: AnySecret, by provenance: SigningRequestProvenance) throws
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue