Skip to main content

ApprovalUse

Struct ApprovalUse 

Source
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, minus record_digest itself.
  • previous_record_digest: the previous record’s record_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: String

Stable 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: String

The grant being consumed (artifact id of the ApprovalStatement).

§grant_digest: String

sha256 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: String

sha256 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: String

Subject 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: u32

Which 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: String

Genesis record carries the empty string. All others carry the previous record’s record_digest. Pinning the chain.

§record_digest: String

sha256 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

Source§

fn clone(&self) -> ApprovalUse

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ApprovalUse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ApprovalUse

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ApprovalUse

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,