# `Spectre.GAM.Secret.Broker`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/gam/secret/broker.ex#L1)

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 Spectre.GAM.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.

# `failure_metadata`

```elixir
@type failure_metadata() :: %{
  evidence: Spectre.GAM.Evidence.t() | [Spectre.GAM.Evidence.t()],
  details_ref: String.t()
}
```

# `profile`

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

# `checkout`

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

# `profile`

```elixir
@callback profile() :: profile()
```

Declares the strongest deployment boundary this broker actually provides.

# `ref`

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

Returns the stable identity bound into checkout receipts.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
