ExGAM.Secret.Broker behaviour (ExGAM v0.1.0)

Copy Markdown View Source

Host boundary that exchanges a committed Attempt for an execution capability.

A broker must never return a reusable credential. The value it releases is scoped to the supplied executor and Act and is kept outside durable records. A failed checkout returns only validated Evidence and an opaque details_ref; raw credential-store errors must never become durable payloads.

use ExGAM.Secret.Broker, ref: "broker:my-app", profile: :mediated declares the behaviour and overridable ref/0 and profile/0. Both choices are required: the macro cannot establish deployment isolation. Implement checkout/4 explicitly; no credential access or successful checkout is supplied by default.

Summary

Callbacks

Exchanges a committed checkout receipt for capability scoped to its Act and Attempt.

Declares the strongest deployment boundary this broker actually provides.

Returns the stable identity bound into checkout receipts.

Types

failure_metadata()

@type failure_metadata() :: %{
  evidence: ExGAM.Evidence.t() | [ExGAM.Evidence.t()],
  details_ref: String.t()
}

profile()

@type profile() :: :development | :mediated | :isolated

Callbacks

checkout(t, t, t, keyword)

@callback checkout(
  ExGAM.Secret.CheckoutReceipt.t(),
  ExGAM.Act.t(),
  ExGAM.Attempt.t(),
  keyword()
) ::
  {:ok, term()} | {:error, :ambiguous, failure_metadata()}

Exchanges a committed checkout receipt for capability scoped to its Act and Attempt.

profile()

@callback profile() :: profile()

Declares the strongest deployment boundary this broker actually provides.

ref()

@callback ref() :: String.t()

Returns the stable identity bound into checkout receipts.