Redeem claim-check refs against a deployment's claim-check gateway (the
:claim_check role, claim_check.port, default 4001).
The gateway does no authentication or authorization (see
docs/claim-check.md),
and it does not verify integrity itself: redeem/3 fetches the bytes and
checks them against the message's sha256 before returning them, so
tampering in transit — or a claim object that has since been overwritten —
surfaces as Ankusa.SDK.ClaimIntegrityError rather than as someone else's
data.
Every failure carries retryable, so a consumer needs exactly one bit to
decide dead-letter (false) or retry (true):
| Error | retryable | Cause |
|---|---|---|
Ankusa.SDK.InvalidClaimRefError | false | bad ref, or sha256 not 64-char lowercase hex |
Ankusa.SDK.ClaimNotFoundError | false | gateway 404: expired by retention, or never written |
Ankusa.SDK.ClaimRejectedError | false | gateway 4xx other than 404, 408, 429 |
Ankusa.SDK.ClaimIntegrityError | false | sha256 of the returned bytes doesn't match |
Ankusa.SDK.ClaimCheckUnavailableError | true | gateway unreachable, 408, 429, or anything else |
client = Ankusa.SDK.ClaimCheck.new("http://localhost:4001")
{:ok, bytes} = Ankusa.SDK.ClaimCheck.redeem(client, message.claim, message.sha256)
Summary
Functions
Liveness probe: GET /health.
Build a client for base_url.
Fetch the bytes a claim ref names, verifying them against sha256.
Types
@type t() :: %Ankusa.SDK.ClaimCheck{http: term()}
Functions
@spec health(t()) :: {:ok, term()} | {:error, Ankusa.SDK.ClaimCheckUnavailableError.t()}
Liveness probe: GET /health.
A 200 with a JSON body succeeds; anything else — a non-200 status, a
transport error, or a non-JSON body — is a
Ankusa.SDK.ClaimCheckUnavailableError.
Build a client for base_url.
Options are :headers (a map or {name, value} list sent on every request),
:timeout_ms (default 10_000, applied to connect and receive — to receive
only with a :finch pool, which owns its connect options), and
:req_options (transport tuning: :finch, :connect_options,
:pool_timeout, :plug; :finch and :connect_options are exclusive).
@spec redeem(t(), term(), term()) :: {:ok, binary()} | {:error, Exception.t()}
Fetch the bytes a claim ref names, verifying them against sha256.
Returns {:ok, bytes} or {:error, error}. Nothing is requested when ref
or sha256 is malformed.