Skip to content

Class X402::StatusEndpoint

Inherits: Object

Read-only HTTP status endpoint for the x402-rack middleware.

Renders a minimal page exposing wallet identity (public key + base P2PKH address) and the gem version. Designed to provide passive observability during development and ops without ever mutating state or making external network calls.

Auth model: * Bearer-token only. Every request requires +Authorization: Bearer + — there is no localhost bypass and no network-trust heuristic. * If status_endpoint_token is unset, the configuration auto-generates one at validate! time and logs it once at startup so it can be copied into a curl command. Production deployments should set the token explicitly via an environment variable.

Format selection: +?format=json+ or +Accept: application/json+ → JSON; otherwise HTML.

Phase 1 scope: identity public key, identity address, gem version. Balance, UTXOs, ARC reachability and other live signals are deferred to later phases — see issue #108.

@example Enable in configuration

X402.configure do |c|
  c.wallet = my_wallet  # any BRC-100 compatible wallet
  c.enable_status_endpoint
  # c.status_endpoint_token = ENV["X402_STATUS_TOKEN"] # explicit (recommended in prod)
  # c.status_endpoint_path  = "/_x402/status"          # default
end

Constants

ADDRESS_NOTE

Not documented.

Public Instance Methods

call(env)

  • @param env [Hash] Rack environment
  • @return [Array(Integer, Hash, Array)] Rack response triple

initialize(config)

  • @return [StatusEndpoint] a new instance of StatusEndpoint