mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-03-05 17:27:24 +01:00
Allow limited key validity window for authenticated keys (#252)
This commit is contained in:
@@ -89,11 +89,12 @@ extension Agent {
|
||||
}
|
||||
|
||||
if let witness = witness {
|
||||
try witness.speakNowOrForeverHoldYourPeace(forAccessTo: secret, by: provenance)
|
||||
try witness.speakNowOrForeverHoldYourPeace(forAccessTo: secret, from: store, by: provenance)
|
||||
}
|
||||
|
||||
let dataToSign = reader.readNextChunk()
|
||||
let derSignature = try store.sign(data: dataToSign, with: secret, for: provenance)
|
||||
let signed = try store.sign(data: dataToSign, with: secret, for: provenance)
|
||||
let derSignature = signed.data
|
||||
|
||||
let curveData = writer.curveType(for: secret.algorithm, length: secret.keySize).data(using: .utf8)!
|
||||
|
||||
@@ -134,7 +135,7 @@ extension Agent {
|
||||
signedData.append(writer.lengthAndData(of: sub))
|
||||
|
||||
if let witness = witness {
|
||||
try witness.witness(accessTo: secret, by: provenance)
|
||||
try witness.witness(accessTo: secret, from: store, by: provenance, requiredAuthentication: signed.requiredAuthentication)
|
||||
}
|
||||
|
||||
Logger().debug("Agent signed request")
|
||||
|
||||
@@ -3,7 +3,7 @@ import SecretKit
|
||||
|
||||
public protocol SigningWitness {
|
||||
|
||||
func speakNowOrForeverHoldYourPeace(forAccessTo secret: AnySecret, by provenance: SigningRequestProvenance) throws
|
||||
func witness(accessTo secret: AnySecret, by provenance: SigningRequestProvenance) throws
|
||||
func speakNowOrForeverHoldYourPeace(forAccessTo secret: AnySecret, from store: AnySecretStore, by provenance: SigningRequestProvenance) throws
|
||||
func witness(accessTo secret: AnySecret, from store: AnySecretStore, by provenance: SigningRequestProvenance, requiredAuthentication: Bool) throws
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user