pub struct ApprovalUse {Show 21 fields
pub type_: String,
pub use_id: String,
pub grant_id: String,
pub grant_digest: String,
pub nonce_digest: String,
pub actor: String,
pub action: String,
pub subject: String,
pub session_id: Option<String>,
pub action_artifact_id: Option<String>,
pub receipt_digest: Option<String>,
pub use_number: u32,
pub max_uses: Option<u32>,
pub idempotency_key: Option<String>,
pub created_at: String,
pub expires_at: Option<String>,
pub previous_record_digest: String,
pub record_digest: String,
pub signature: Option<String>,
pub signature_alg: Option<String>,
pub signing_key_id: Option<String>,
}Expand description
Records that a specific Approval Grant was consumed by a specific
Action. One record per use; an approval with max_actions = 3 produces
up to three of these (subject to the journal’s max_uses enforcement).
Designed for the local Approval Use Journal (PR 2). Two fields anchor the journal’s hash chain:
record_digest: sha256 of this record’s canonical JSON, minusrecord_digestitself.previous_record_digest: the previous record’srecord_digest, giving the journal an append-only hash chain. The genesis record has this empty.
signature is optional in the schema because the journal can be signed
either per-record or via signed checkpoints over a range of records;
PR 2 picks the strategy. Keeping the field optional keeps the schema
stable across that decision.
Fields§
§type_: String§use_id: StringStable per-record identifier. Independent of the action artifact id so the journal can write the use before the action signs (consume-before-action, PR 3).
grant_id: StringThe grant being consumed (artifact id of the ApprovalStatement).
grant_digest: Stringsha256 of the signed grant envelope. Pinning the digest detects drift if the grant is tampered or rotated; verify can reject any use that points at a digest different from the live grant.
nonce_digest: Stringsha256 of the approval’s nonce field. The journal indexes by
this so duplicate consumption attempts collapse on lookup; raw
nonces stay in the signed grant and are never written to disk
outside the package they live in.
actor: String§action: String§subject: StringSubject URI / artifact id the action targets. Mirrors
ApprovalScope.allowed_subjects so journal records carry the
resolved value used at consume time.
session_id: Option<String>Session this use was recorded under. Optional because uses can happen outside any active session (e.g. a CLI one-shot).
action_artifact_id: Option<String>Action artifact this use authorized. Set when the action is signed; left None during the brief “reserved” window between journal write and action sign in the consume-before-action flow.
receipt_digest: Option<String>Receipt this use will appear in. None until the receipt is built.
use_number: u32Which use of this grant this is. 1-indexed. Reads as “use 1/1” or “use 2/3” in verify output.
max_uses: Option<u32>Mirror of the grant’s max_actions at consume time. Stored on
the use record so a later journal verifier doesn’t need to
re-resolve the grant.
idempotency_key: Option<String>Caller-supplied idempotency key. If present, a retry with the
same (grant_id, idempotency_key) collapses to the existing use
rather than allocating a new one. Lets a flaky network produce
at-most-once consumption without burning a use slot per retry.
created_at: String§expires_at: Option<String>Optional expiry on the use itself, distinct from grant expiry.
The grant’s valid_until is the outer bound; this is for “this
reserved use must commit by X or be released” semantics.
previous_record_digest: StringGenesis record carries the empty string. All others carry the
previous record’s record_digest. Pinning the chain.
record_digest: Stringsha256 of this record’s canonical JSON with record_digest
itself omitted. Computed and stamped at write time.
signature: Option<String>Optional per-record signature. The journal can also sign by
checkpoint over many records; PR 2 picks one. signature_alg
names the algorithm so a future migration can introspect.
signature_alg: Option<String>§signing_key_id: Option<String>Trait Implementations§
Source§impl Clone for ApprovalUse
impl Clone for ApprovalUse
Source§fn clone(&self) -> ApprovalUse
fn clone(&self) -> ApprovalUse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more