pub struct GovernedApprovalToken {
pub id: String,
pub approver: PublicKey,
pub subject: PublicKey,
pub governed_intent_hash: String,
pub request_id: String,
pub threshold_proposal_hash: Option<String>,
pub issued_at: u64,
pub expires_at: u64,
pub decision: GovernedApprovalDecision,
pub algorithm: Option<SigningAlgorithm>,
pub signature: Signature,
}Expand description
Signed approval artifact bound to one governed intent and one request.
Fields§
§id: String§approver: PublicKey§subject: PublicKey§governed_intent_hash: String§request_id: String§threshold_proposal_hash: Option<String>§issued_at: u64§expires_at: u64§decision: GovernedApprovalDecision§algorithm: Option<SigningAlgorithm>Signing algorithm. Absent means Ed25519 (the default).
Informational: verification dispatches off the algorithm encoded in
GovernedApprovalToken::signature and GovernedApprovalToken::approver.
signature: SignatureImplementations§
Source§impl GovernedApprovalToken
impl GovernedApprovalToken
pub fn body(&self) -> GovernedApprovalTokenBody
Sourcepub fn sign(
body: GovernedApprovalTokenBody,
keypair: &Keypair,
) -> Result<GovernedApprovalToken, Error>
pub fn sign( body: GovernedApprovalTokenBody, keypair: &Keypair, ) -> Result<GovernedApprovalToken, Error>
Sign a governed approval token body with the given Ed25519 keypair.
Sourcepub fn sign_with_backend(
body: GovernedApprovalTokenBody,
backend: &dyn SigningBackend,
) -> Result<GovernedApprovalToken, Error>
pub fn sign_with_backend( body: GovernedApprovalTokenBody, backend: &dyn SigningBackend, ) -> Result<GovernedApprovalToken, Error>
Sign a governed approval token body with an arbitrary SigningBackend.
body.approver must equal backend.public_key().
pub fn verify_signature(&self) -> Result<bool, Error>
pub fn artifact_digest(&self) -> Result<String, Error>
Sourcepub fn verify_signature_at(&self, now: u64) -> Result<bool, Error>
pub fn verify_signature_at(&self, now: u64) -> Result<bool, Error>
Verify the signature AND enforce the approval-token validity window in one pass.
Sanctioned entry point when freshness matters (settlement lanes that
must assert approval expiry, per the dependent C2/C3 work): fails closed
on expiry / not-yet-valid approvals, which the bare
GovernedApprovalToken::verify_signature does not check. A clock is
threaded explicitly via now (unix seconds).
Fail-closed ordering: the signature is checked FIRST. An approval with an
invalid signature is rejected before the time window is consulted.
Returns Ok(true) only when the signature verifies and now is within
[issued_at, expires_at).
pub fn is_valid_at(&self, now: u64) -> bool
pub fn validate_time(&self, now: u64) -> Result<(), Error>
Trait Implementations§
Source§impl Clone for GovernedApprovalToken
impl Clone for GovernedApprovalToken
Source§fn clone(&self) -> GovernedApprovalToken
fn clone(&self) -> GovernedApprovalToken
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more