Skip to content

Class X402::BSV::BRC105Gateway

Inherits: Object

BRC-105 gateway for BSV settlement-gated HTTP.

Unlike PayGateway/ProofGateway, this does NOT inherit from Gateway. BRC-105 uses a fundamentally different pattern: no partial tx template, no OP_RETURN binding, no payTo HMAC. Key derivation (BRC-42/43) via KeyDeriver replaces the template-based approach.

Implements the three-method gateway interface required by Middleware: challenge_headers(rack_request, route) → Hash proof_header_names → Array settle!(header_name, proof_payload, rack_request, route) → SettlementResult

Constants

COMPRESSED_PUBKEY_HEX

Not documented.

MAX_DERIVATION_BYTES

Not documented.

PRINTABLE_ASCII

Not documented.

PROOF_HEADER

Not documented.

PROTOCOL

Not documented.

PROTOCOL_ID

Not documented.

Public Instance Methods

challenge_headers(rack_request, route)

Issue a 402 challenge with BRC-105 headers. - @param rack_request [Rack::Request] - @param route [X402::Configuration::Route] - @return [Hash] challenge headers (x-bsv-* namespace)

initialize(key_deriver:, prefix_store:, wallet:, arc_client: = nil, network_visibility_cache: = NetworkVisibility::Cache.new)

  • @param key_deriver [BSV::Wallet::KeyDeriver] provides identity key + BRC-42 derivation
  • @param prefix_store [#store!, #valid?, #consume!] replay protection for derivation prefixes
  • @param wallet [#internalize_action] BRC-100 wallet for payment internalisation
  • @param arc_client [#status, nil] ARC client for on-chain visibility verification. When nil, visibility verification is skipped (backward compatibility).
  • @param network_visibility_cache [NetworkVisibility::Cache] per-gateway positive-only TTL cache protecting ARC from duplicate-submission bursts.
  • @return [BRC105Gateway] a new instance of BRC105Gateway

proof_header_names()

Header names that carry the proof/payment from the client. - @return [Array]

settle!(_header_name, proof_payload, rack_request, route)

Verify and internalise a BRC-105 payment. - @param _header_name [String] which proof header matched - @param proof_payload [String] raw header value - @param rack_request [Rack::Request] - @param route [X402::Configuration::Route] - @return [SettlementResult]