Replace the design-note docs (p1–p7) with the implemented "make it real" phase docs (p8–p10) and wire production-grade, env-gated real integrations: - p8 Casper Testnet: byte-exact deploys + WASM install via casper-js-sdk; live node reads (node.testnet.casper.network); CRED402_CHAIN=sim|testnet transport. - p9 x402 + data + MCP: real EIP-712 typed-data digests (@casper-ecosystem/ casper-eip-712); casper-x402 facilitator client (x402 V2); live Open-Meteo GHI; official @modelcontextprotocol/sdk server; casper-sidecar SSE event feed. - p10 RealFi + cross-chain: real Stripe test-mode webhooks (HMAC-verified) and Plaid sandbox → privacy-preserving on-chain envelopes; Base Sepolia EVM deploy (Foundry); reachable via /api/realfi/* and /api/x402/facilitator routes. - Sign-in with Casper Wallet: real extension provider + challenge/ed25519/session flow (/v1/auth/wallet/*), console connect + sign-in button. - Branding: Cred402 logo mark, favicon, OG image; Vercel config for the console. All env-gated with sim/free-API fallbacks; full suite green, all toolchains (TS/Rust/Go/Solidity) build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
23 lines
855 B
Markdown
23 lines
855 B
Markdown
# Cred402 webhook receiver (example)
|
|
|
|
A real, runnable endpoint that receives Cred402 protocol webhooks and verifies
|
|
their HMAC-SHA256 signature with `@cred402/sdk`'s `verifyWebhookSignature`.
|
|
|
|
```bash
|
|
# 1. subscribe a webhook (note the returned `secret`)
|
|
curl -s -XPOST http://localhost:4021/v1/webhooks \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"url":"http://localhost:4055/","events":["*"]}'
|
|
|
|
# 2. run the receiver with that secret
|
|
CRED402_WEBHOOK_SECRET=whsec_xxx npx tsx examples/webhook-receiver/server.ts
|
|
|
|
# 3. trigger protocol events
|
|
curl -s -XPOST http://localhost:4021/api/demo/run
|
|
```
|
|
|
|
The receiver prints `✓ VERIFIED <Event> {payload}` for each authentic delivery
|
|
and rejects tampered/stale signatures with `401`. Signatures use the
|
|
`X-Cred402-Signature: t=<ts>,v1=<hmac>` scheme over `${t}.${rawBody}` with a
|
|
5-minute replay window.
|