W3C Verifiable Credential operations via the Layr8 cloud-node REST API.
All functions accept a Layr8.REST client and keyword options.
Example
rest = Layr8.REST.new("https://node.example.com", "my-api-key")
{:ok, jwt} = Layr8.Credentials.sign_credential(rest, credential, issuer_did: "did:example:alice")
Summary
Functions
Retrieves a stored credential by ID.
Lists stored credentials for a holder.
Signs a W3C Verifiable Credential using the issuer's assertion key.
Stores a signed credential JWT for a holder in the cloud-node credential store.
Verifies a signed credential using the verifier DID's assertion key.
Types
Functions
@spec get_credential(Layr8.REST.t(), String.t()) :: {:ok, stored_credential()} | {:error, term()}
Retrieves a stored credential by ID.
Returns {:ok, stored_credential()} or {:error, reason}.
@spec list_credentials( Layr8.REST.t(), keyword() ) :: {:ok, [stored_credential()]} | {:error, term()}
Lists stored credentials for a holder.
Options
:holder_did— holder DID (default: agent DID)
Returns {:ok, [stored_credential()]} or {:error, reason}.
@spec sign_credential(Layr8.REST.t(), credential(), keyword()) :: {:ok, String.t()} | {:error, term()}
Signs a W3C Verifiable Credential using the issuer's assertion key.
Options
:issuer_did— issuer DID (default: agent DID):format— output format:"compact_jwt"(default),"json","jwt","enveloped"
Returns {:ok, signed_jwt} or {:error, reason}.
@spec store_credential(Layr8.REST.t(), String.t(), keyword()) :: {:ok, stored_credential()} | {:error, term()}
Stores a signed credential JWT for a holder in the cloud-node credential store.
Options
:holder_did— holder DID (default: agent DID):issuer_did— issuer DID metadata (optional):valid_until— ISO 8601 expiration string (optional)
Returns {:ok, stored_credential} or {:error, reason}.
@spec verify_credential(Layr8.REST.t(), String.t(), keyword()) :: {:ok, map()} | {:error, term()}
Verifies a signed credential using the verifier DID's assertion key.
Options
:verifier_did— verifier DID (default: agent DID)
Returns {:ok, verified} or {:error, reason}.