Internal HTTP client for the Layr8 cloud-node REST API.
Uses Req for HTTP requests. Authentication is via x-api-key header.
Not intended for direct use; accessed through Layr8.Credentials,
Layr8.Presentations and Layr8.Mediation.
Summary
Functions
Issues a DELETE request to path. {:ok, body} (body may be empty) or {:error, term()}.
Issues a GET request to path and returns the decoded response.
Creates a new REST client.
Issues a JSON POST request to path with body and returns the decoded response.
Posts a packed DIDComm message (the JWE bytes) to a node's public /didcomm
ingress — the re-injection step of Layr8.Mediation. No API key: the
ingress authenticates the message itself.
Issues a JSON PUT request to path with body. Same contract as post/4.
Types
@type t() :: %Layr8.REST{ api_key: String.t(), base_url: String.t(), timeout_ms: non_neg_integer() }
Functions
Issues a DELETE request to path. {:ok, body} (body may be empty) or {:error, term()}.
Issues a GET request to path and returns the decoded response.
Options
:timeout_ms— deadline on the response.0ornilleaves the call unbounded, which is the pre-existing behaviour.
Returns {:ok, map()} on success or {:error, term()} on failure.
Creates a new REST client.
Parameters
base_url— HTTP base URL of the cloud-node (e.g."https://node.example.com")api_key— API key for authentication
Options
:timeout_ms— default deadline on every call made through this client.0leaves them unbounded. SeeLayr8.Config.default_rest_timeout_ms/0for why the default is a deadline at all:Reqhas none of its own, so a node that accepted the connection and went quiet left every credential and presentation call hanging — neither resolving nor failing, and never letting the caller reach the point of deciding to retry.
Issues a JSON POST request to path with body and returns the decoded response.
Options
:timeout_ms— deadline on the response.0ornilleaves the call unbounded, which is the pre-existing behaviour.
Returns {:ok, map()} on success or {:error, term()} on failure.
Posts a packed DIDComm message (the JWE bytes) to a node's public /didcomm
ingress — the re-injection step of Layr8.Mediation. No API key: the
ingress authenticates the message itself.
Issues a JSON PUT request to path with body. Same contract as post/4.