Spectre.GAM.Attempt (Spectre v0.4.0)

Copy Markdown View Source

Durable proof that an exact-bound grant was consumed before capability release.

Only a digest of the grant nonce is persisted. The bearer grant, raw nonce, credentials and handles are deliberately absent from this portable record. generation is the host generation which minted and consumed that Grant. It can differ from the admission generation frozen in the Act when an admitted, still-unattempted Act is safely resumed after a host restart.

Summary

Functions

Returns the plain, string-keyed ledger representation.

Returns the stable digest of the complete attempt.

Restores an attempt from its canonical map.

Builds and validates an attempt record.

Types

t()

@type t() :: %Spectre.GAM.Attempt{
  act_ref: String.t(),
  executor_ref: String.t(),
  generation: non_neg_integer(),
  grant_nonce_digest: String.t(),
  material_digest: String.t(),
  ref: String.t(),
  schema_version: 1,
  started_at: integer()
}

Functions

canonical(attempt)

@spec canonical(t()) :: map()

Returns the plain, string-keyed ledger representation.

digest(attempt)

@spec digest(t()) :: String.t()

Returns the stable digest of the complete attempt.

from_canonical(value)

@spec from_canonical(map()) :: {:ok, t()} | {:error, term()}

Restores an attempt from its canonical map.

new(attempt)

@spec new(map() | keyword() | t()) :: {:ok, t()} | {:error, term()}

Builds and validates an attempt record.