Skip to main content

lib/layr8.ex

defmodule Layr8 do
  @moduledoc """
  Elixir SDK for the Layr8 decentralized identity-native messaging network.

  Layr8 enables agents to communicate over DIDComm v2 via a Phoenix Channel
  WebSocket connection to a Layr8 cloud-node.

  ## Quick Start

      {:ok, client} = Layr8.Client.start_link(%{
        node_url: "wss://node.example.com/plugin_socket/websocket",
        api_key: System.fetch_env!("LAYR8_API_KEY")
      })

      Layr8.Client.handle(client, "https://example.com/echo/1.0/request", fn msg ->
        {:reply, %Layr8.Message{
          type: "https://example.com/echo/1.0/response",
          body: msg.body
        }}
      end)

      :ok = Layr8.Client.connect(client)

  ## Configuration

  See `Layr8.Config` for configuration options and environment variables.

  ## Modules

  - `Layr8.Client` — main entry point, GenServer lifecycle
  - `Layr8.Config` — configuration resolution and URL normalization
  - `Layr8.Message` — DIDComm message struct, marshal/parse
  - `Layr8.Handler` — handler registry
  - `Layr8.Channel` — Phoenix Channel WebSocket transport
  - `Layr8.REST` — HTTP client for REST API
  - `Layr8.Credentials` — W3C Verifiable Credential operations
  - `Layr8.Presentations` — W3C Verifiable Presentation operations
  - `Layr8.Error` and friends — exception types
  """
end