Xmtp.Identity (xmtp_elixir_sdk v0.1.2)

Copy Markdown

Shared XMTP identity setup for product apps.

This module hides client registration, signature request creation, signer payload construction, and inbox derivation. Host apps still own persistence: store the returned inbox_id on the product account after a successful signature.

Summary

Types

signature_request()

@type signature_request() :: %{
  id: String.t(),
  text: String.t(),
  client_id: String.t(),
  wallet_address: String.t()
}

state()

@type state() :: %{
  status: status(),
  inbox_id: String.t() | nil,
  wallet_address: String.t(),
  signature_request: signature_request() | nil,
  user_copy: String.t()
}

status()

@type status() ::
  :ready
  | :needs_wallet_signature
  | :too_many_devices
  | :unsupported_wallet
  | :syncing

Functions

child_spec(opts)

@spec child_spec(keyword()) :: Supervisor.child_spec()

complete_signature(arg1)

@spec complete_signature(map()) :: {:ok, state()} | {:error, term()}

derived_inbox_id(wallet_address)

@spec derived_inbox_id(String.t()) :: String.t()

ensure_identity(attrs)

@spec ensure_identity(map()) :: {:ok, state()} | {:error, term()}

ready_inbox_id(principal, stored_inbox_id)

@spec ready_inbox_id(Xmtp.Principal.t() | map(), String.t() | nil) ::
  {:ok, String.t()} | {:error, :wallet_required | :xmtp_identity_required}

wallet_identifier(wallet_address)

@spec wallet_identifier(String.t()) :: XmtpElixirSdk.Types.Identifier.t()