Class: X402::StatusEndpoint
- Inherits:
-
Object
- Object
- X402::StatusEndpoint
- Defined in:
- lib/x402/status_endpoint.rb
Overview
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 <token>— there is no localhost bypass and no network-trust heuristic. - If
status_endpoint_tokenis unset, the configuration auto-generates one atvalidate!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.
Constant Summary collapse
- ADDRESS_NOTE =
"Identity address — used for BRC-42 derivation. " \ "Not the per-payment receive address. Payments are " \ "settled to per-payment derived addresses."
Instance Method Summary collapse
-
#call(env) ⇒ Array(Integer, Hash, Array)
Rack response triple.
-
#initialize(config) ⇒ StatusEndpoint
constructor
A new instance of StatusEndpoint.
Constructor Details
#initialize(config) ⇒ StatusEndpoint
Returns a new instance of StatusEndpoint.
43 44 45 |
# File 'lib/x402/status_endpoint.rb', line 43 def initialize(config) @config = config end |
Instance Method Details
#call(env) ⇒ Array(Integer, Hash, Array)
Returns Rack response triple.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/x402/status_endpoint.rb', line 49 def call(env) return forbidden unless (env) data = build_data if json_requested?(env) json_response(data) else html_response(data) end end |