🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

pch-x402

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pch-x402

Server-side SDK to verify EIP-712 x402 debit authorizations against a PCHEscrow contract, look up Path Score, and accept paid calls.

latest
npmnpm
Version
0.1.0
Version published
Weekly downloads
4
-86.21%
Maintainers
1
Weekly downloads
 
Created
Source

pch-x402 (server SDK)

Server-side SDK to accept x402 signed-debit-per-call payments: verify EIP-712 DebitAuthorizations against a PCHEscrow deployment, compute settlement digests, and forward verified paid calls. A standalone, third-party-hostable mirror of what the PCH gateway does internally.

Phase E E.1 greenfield skeleton (worktree-e). DRAFT, NOT PUBLISHED. The JS core is tested; the Python port is a skeleton pending the Phase E full build. Source is fully readable in this package (Principle 13). Documentation and source links resolve to https://pathcoursehealth.com.

JS usage

const { verifyDebitAuthorization } = require('pch-x402');

const result = verifyDebitAuthorization(authorization, {
  domain: { name: 'PCHEscrow', version: '1', chainId: 8453, verifyingContract: ESCROW_ADDRESS },
  method: 'POST',
  canonicalUrl: 'https://your-gateway.example.com/v1/chat/completions',
  rawBody: rawRequestBodyBytes,
});
if (!result.ok) reject(result.error);

result.error is one of: missing_authorization, invalid_authorization, invalid_signature, signer_mismatch, authorization_expired, request_binding_mismatch.

EIP-712 schema (frozen at the contract deployment block)

DebitAuthorization(address wallet,uint256 amount,uint256 nonce,bytes32 requestHash,uint256 expiry)

requestHash = keccak256(abi.encode(keccak256(METHOD), keccak256(canonicalURL), keccak256(rawBody))) binds each signature to a single request. See contracts/specs/EIP712Spec.md.

Test

npm test   # node test/verifier.test.js

Status

Greenfield skeleton. Not on npm/PyPI. Publication is a Phase E hard stop.

FAQs

Package last updated on 18 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts