MPP.Methods.XRPL (mpp v0.17.0)

Copy Markdown View Source

XRPL charge verification for native XRP, issued currencies and MPTs.

Implements draft-xrpl-charge-00 at mpp-specs commit 213b098. Pull credentials carry type: "transaction", blob: "<hex>"; push credentials carry type: "hash", hash: "<64 hex>". Pull blobs are decoded and checked before submission, then checked again against validated ledger metadata.

Configure rpc_url (HTTPS), network (mainnet/testnet/devnet), store (a durable, shared MPP.Tempo.Store implementation) and store_retention_ms. Retention must cover challenge expiry plus poll_timeout_ms (default 60 seconds). The store operator must guarantee the declared retention across restarts and replicas. Testnet/devnet may explicitly set allow_process_local_store: true to use a configured ConCache store. Disabling the store is not supported.

MPP.Verifier supplies challenge_id, challenge_expires, credential_source and realm. Direct callers must supply authenticated values themselves. The source is did:pkh:xrpl:<network ID>:<classic address>. Binding defaults to SHA-512Half of the challenge ID, never a static tag. An explicit invoiceId must be unique to that challenge. expires_in (seconds, default 300) must match the challenge issuer's TTL — MPP.Plug merges its own :expires_in in unless set explicitly; settlement must not precede challenge_expires minus that TTL.

Public details are network, reference, invoiceId, destinationTag, sourceTag, and memos. The draft leaves memo entry structure unspecified; this implementation accepts UTF-8 maps with data, optional type and format, mapping to the corresponding XRPL Memo fields. They must match exactly. req_options configures Req; poll_interval_ms defaults to 1000 milliseconds. The JSON-RPC connection must support server_info, submit and tx API v1.

API Functions

FunctionArityDescriptionParam Kinds
verify2Verify a charge against a validated XRPL Payment and atomically consume it.-
challenge_method_details1Expose only the draft's public method details plus credential types.-
validate_config!1Validate the RPC, network and mandatory replay-store configuration.-
credential_types0Return the draft's two charge credential types.-
method_name0Return the XRPL payment method identifier.-

Summary

Functions

Expose only the draft's public method details plus credential types.

Return the draft's two charge credential types.

Return the XRPL payment method identifier.

Validate the RPC, network and mandatory replay-store configuration.

Verify a charge against a validated XRPL Payment and atomically consume it.

Functions

challenge_method_details(charge)

@spec challenge_method_details(MPP.Method.intent()) :: map() | nil
@spec challenge_method_details(MPP.Intents.Charge.t()) :: map()

Expose only the draft's public method details plus credential types.

# descripex:contract
%{}

credential_types()

@spec credential_types() :: [String.t()]
@spec credential_types() :: [String.t()]

Return the draft's two charge credential types.

# descripex:contract
%{}

method_name()

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

Return the XRPL payment method identifier.

# descripex:contract
%{}

validate_config!(config)

@spec validate_config!(map()) :: :ok
@spec validate_config!(map()) :: :ok

Validate the RPC, network and mandatory replay-store configuration.

# descripex:contract
%{}

verify(payload, charge)

@spec verify(map(), MPP.Intents.Charge.t()) ::
  {:ok, MPP.Receipt.t()} | {:error, MPP.Errors.t()}

Verify a charge against a validated XRPL Payment and atomically consume it.

# descripex:contract
%{}