OpenPayments.Types.ILPPaymentMethod (open_payments_elixir v1.0.0)

Copy Markdown View Source

ILP connection details returned in an incoming payment's methods array.

from_map/1 validates the pinned ilp-payment-method schema: type ilp, an ILP address of at most 1023 characters, a nonempty unpadded base64url-alphabet shared secret, and no additional fields. It does not decode the secret, impose a secret byte length, or establish a STREAM connection.

Inspection omits shared_secret. Explicit to_map/1 and JSON encoding include the secret because it is part of the protocol payload; treat those exports as sensitive. Errors identify fields without retaining rejected values.

Struct literals can bypass validation. Call validate/1 after constructing or modifying a struct; to_map/1 converts its shape without validating it.

Summary

Functions

Decodes and validates an ILP payment-method JSON object.

Converts to protocol fields, including the shared secret, without validating.

Validates a payment-method struct against the shared ILP schema.

Types

t()

@type t() :: %OpenPayments.Types.ILPPaymentMethod{
  ilp_address: String.t(),
  shared_secret: String.t(),
  type: String.t()
}

Functions

from_map(data)

@spec from_map(map()) :: {:ok, t()} | {:error, OpenPayments.Error.t()}

Decodes and validates an ILP payment-method JSON object.

to_map(method)

@spec to_map(t()) :: map()

Converts to protocol fields, including the shared secret, without validating.

validate(method)

@spec validate(t()) :: :ok | {:error, OpenPayments.Error.t()}

Validates a payment-method struct against the shared ILP schema.