# auth.md — With Silex Agent Authentication & Payment Modes

> **Origin:** [https://withsilex.com](https://withsilex.com) | **DID:** `did:web:withsilex.com` | **Custody:** 100% Non-Custodial (`FinCEN FIN-2019-G001`, zero preloaded deposits, zero server wallet keys).

With Silex lets autonomous AI agents discover, search, register anonymously, and settle sub-cent unlocks immediately with **zero signup**, **zero custodial wallets**, and **zero required API keys**.

## Agent Registration

With Silex supports keyless anonymous agent onboarding (zero server key generation, zero secrets stored). Register an optional public agent descriptor via `POST` to [https://withsilex.com/api/v1/agents/register](https://withsilex.com/api/v1/agents/register):

```bash
curl -sS -X POST https://withsilex.com/api/v1/agents/register \
  -H 'Content-Type: application/json' \
  -d '{"agent_name":"my-agent","scope":"public:read mcp:read x402:pay mpp:pay"}'
```

- **Identity Type:** `anonymous` (`token_endpoint_auth_method: "none"`)
- **Supported Credentials:** `x402` (`PAYMENT-SIGNATURE` / `X-Payment`), `mpp` (`Authorization: Payment`), and `spass_bearer` (`Authorization: Bearer spass_<token>`)
- **Session Claim / Pass Mint:** [https://withsilex.com/pass](https://withsilex.com/pass) (`POST` [https://withsilex.com/api/x402/pass/mint](https://withsilex.com/api/x402/pass/mint))

## 1. Anonymous `$0.00` Public Access (No Auth Required)
- **Native `$0.00` Agent Search (`GET` & RFC 10008 `HTTP QUERY`):** [https://withsilex.com/.well-known/search?q=computing&limit=5](https://withsilex.com/.well-known/search?q=computing&limit=5)
- **NLWeb Natural-Language Search (`schema.org` JSON):** [https://withsilex.com/ask?query=nano&streaming=false](https://withsilex.com/ask?query=nano&streaming=false)
- **Morning Coffee Wake Beacon (`<5ms` `HTTP 304 NO_REPLY`):** [https://withsilex.com/.well-known/coffee.json?tz=America/New_York](https://withsilex.com/.well-known/coffee.json?tz=America/New_York)
- **MCP Discovery & Free Search Tool (`POST`):** [https://withsilex.com/mcp](https://withsilex.com/mcp) (`tools/list`, `prompts/list`, `resources/list`, `silex_search`, `silex_live_questions`, `silex_suggest_entities`)
- **Zero-Balance PoW First-Taste Trial:** [https://withsilex.com/api/x402/first-taste](https://withsilex.com/api/x402/first-taste) (`GET` challenge -> solve SHA-256 `00` prefix -> `POST` redeem)

## 2. Keyless `x402 v2` (`PAYMENT-SIGNATURE` & `X-Payment`)
- Request any paid resource (starter verification: [https://withsilex.com/api/x402/starter/ping](https://withsilex.com/api/x402/starter/ping) at `$0.0003` USD / `0.001 XNO`, or [https://withsilex.com/api/v1](https://withsilex.com/api/v1) at `$0.001` USD) to receive `HTTP 402` with an Ed25519-signed `PAYMENT-REQUIRED` header.
- **Path A (Zero Client Nano Node):** Submit an unbroadcast signed Nano `state` send block in `PAYMENT-SIGNATURE: <base64_or_json>` (omit `block.work` for facilitator PoW cascade; pre-validated before broadcast so `0 XNO` is stranded).
- **Path B (Confirmed Block Hash):** Broadcast your Nano send block and retry with `X-Payment: <64_HEX_HASH>`.
- **MCP `x402/payment` `_meta`:** Pass credentials in `params._meta["x402/payment"]` on `tools/call`; verified settlements return `_meta["x402/payment-response"]` + `_meta["org.paymentauth/receipt"]`.

## 3. Polyglot IETF `MPP` (`Authorization: Payment` & `/mcp?payment=mpp` `-32042`)
- Every `HTTP 402` emits `WWW-Authenticate: Payment id="mpp1_...", realm="withsilex.com", method="nano", intent="charge", request="<base64url>"`.
- Retry with `Authorization: Payment <base64url_credential>` (containing `{ txHash }` or `{ block }`). Settled `200 OK` responses return `Payment-Receipt` alongside `PAYMENT-RESPONSE` and `X-Silex-Receipt`.
- **MCP MPP Mode:** Connect to [https://withsilex.com/mcp?payment=mpp](https://withsilex.com/mcp?payment=mpp) to receive JSON-RPC error `code: -32042` (`message: "Payment Required"`, `data.challenges`) on unpaid paid tools, inspect `_meta["org.paymentauth/price"]` in `tools/list`, submit credentials in `params._meta["org.paymentauth/credential"]`, and read `_meta["org.paymentauth/receipt"]` upon settlement.

## 4. `0ms` `Tab-402` Prepaid Bearer Sessions (`Authorization: Bearer spass_*`)
- Mint a prepaid micro-session via `POST` [https://withsilex.com/api/x402/pass/mint](https://withsilex.com/api/x402/pass/mint) and attach `Authorization: Bearer spass_<token>` (automatically mapped to `X-Silex-Pass` across HTTP & `/mcp`) for `<8ms` burst unlocks with zero per-call RPC wait.
- Creators and registered agents may attach `Authorization: Bearer sxp_<token>` (`X-Silex-Passport`) for `@handle` identity and 50 daily Lumen turns.
- Reuse the returned `X-Silex-Receipt` header for 24-hour idempotent recovery without paying twice.

## 5. OAuth 2.0 & Commerce Discovery Metadata (RFC 9728 / RFC 8414)
- Protected Resource Metadata: [https://withsilex.com/.well-known/oauth-protected-resource](https://withsilex.com/.well-known/oauth-protected-resource)
- MCP Protected Resource Metadata: [https://withsilex.com/.well-known/oauth-protected-resource/mcp](https://withsilex.com/.well-known/oauth-protected-resource/mcp)
- Authorization Server Metadata (`agent_auth` + CIMD + RFC 9207 `iss`): [https://withsilex.com/.well-known/oauth-authorization-server](https://withsilex.com/.well-known/oauth-authorization-server)
- ACP Checkout Sessions: [https://withsilex.com/api/v1/acp/checkout_sessions](https://withsilex.com/api/v1/acp/checkout_sessions) ([/.well-known/acp.json](https://withsilex.com/.well-known/acp.json))
- Public OpenAPI 3.1 Contract: [https://withsilex.com/openapi.json](https://withsilex.com/openapi.json)
- Agent Quickstart (4 Steps): [https://withsilex.com/docs/quickstart](https://withsilex.com/docs/quickstart) ([Markdown](https://withsilex.com/docs/quickstart.md))
- CLI Documentation: [https://withsilex.com/docs/cli](https://withsilex.com/docs/cli)

## 6. Why Stateless HTTP 402 / MPP Eliminates MCP OAuth Takeovers (Salt Labs Dec 2026 Mitigated)

Salt Security Labs (Dec 1, 2026, *"Registered Is Not Trusted: One-Click Account Takeovers Through MCP OAuth"*) demonstrated how over-trusted Dynamic Client Registration (DCR), loose `redirect_uri` validation, missing `RFC 8707` audience checks, and iframe clickjacking enable 1-click MCP OAuth account takeovers.

With Silex eliminates this entire attack class at both the protocol and edge layers:
1. **Zero Privileged Dynamic Client Registration (DCR):** `/.well-known/oauth-authorization-server` advertises `client_id_metadata_document_supported: true` and `dynamic_client_registration_supported: false`. `POST /api/v1/agents/register` issues strictly untrusted `public:read` anonymous client descriptors with **0 account privileges**, **0 stored credentials**, and **0 server keys**.
2. **Strict `new URL()` Exact `redirect_uri` Validation:** Any supplied `redirect_uri` is parsed strictly via `new URL()` and restricted to exact `https://` public domains or exact loopback (`http://127.0.0.1`, `http://localhost`, `http://[::1]`). `javascript:`, `data:`, wildcards (`*`), fragments, and substring tricks are rejected with `HTTP 400`.
3. **RFC 8707 `resource` Audience Binding:** OAuth validation enforces exact canonical resource targets (`https://withsilex.com`, `https://withsilex.com/mcp`, `https://withsilex.com/api/v1`) and RFC 9207 `iss` issuer parity.
4. **Anti-Clickjacking Headers on `/api/v1/oauth/*`:** Every `/api/v1/oauth/*` endpoint emits `X-Frame-Options: DENY` and `Content-Security-Policy: default-src 'none'; frame-ancestors 'none'`.
5. **Cryptographic Per-Call Settlement (`HTTP 402` / `MPP`):** Because paid unlocks settle atomically with self-signed Nano (`$XNO`) blocks (`PAYMENT-SIGNATURE` / `Authorization: Payment`) rather than ambient OAuth cookies or long-lived account bearer tokens, there is no custodial account balance or OAuth consent flow to hijack.
