Skip to content

Commit 9bc9295

Browse files
authored
docs: gardening Apr 2026 (#40)
* docs: gardening Apr 2026 — update stale architecture, quality, golden-principles * docs: fix module tree and golden-principles consistency - Add X402.Utils and X402.Header to module structure tree - Add (added v0.3.2) annotation to Principle 12 - Fix Principle 1 wording: 'Any facilitator URL' → 'Any HTTPS facilitator URL' to remove conflict with Principle 12
1 parent b5f8295 commit 9bc9295

3 files changed

Lines changed: 28 additions & 5 deletions

File tree

docs/architecture.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Architecture — x402 Elixir SDK
22

3-
> Last updated: 2026-02-25
3+
> Last updated: 2026-04-01
44
55
## Overview
66

@@ -17,6 +17,8 @@ A pure Elixir library implementing the x402 HTTP payment protocol. Ships as a He
1717

1818
```
1919
X402 # Top-level convenience API (delegates to submodules)
20+
├── Utils # Shared utilities (decimal parsing, common helpers)
21+
├── Header # Shared header utilities
2022
├── PaymentRequired # Encode/decode PAYMENT-REQUIRED header (Base64 JSON)
2123
├── PaymentSignature # Decode and validate PAYMENT-SIGNATURE header
2224
├── PaymentResponse # Encode PAYMENT-RESPONSE header
@@ -91,3 +93,14 @@ Only raise on programmer errors (wrong type passed to function, etc.).
9193
[:x402, :settle, :stop]
9294
[:x402, :settle, :exception]
9395
```
96+
97+
## Recent Changes (v0.3.2 → v0.3.3)
98+
99+
- **`X402.Utils`** — new centralized utilities module; decimal parsing optimized, shared helpers extracted from multiple modules
100+
- **`X402.Facilitator.HTTP`** — TLS peer verification now enforced; secure pool options exposed via `HTTP.secure_pool_opts/0`; HTTPS-only on `base_url` (rejects `http://` at config time)
101+
- **`X402.PaymentSignature`** — format validation tightened; 8KB size cap enforced to prevent oversized headers
102+
- **`X402.PaymentRequired` / `X402.PaymentResponse`** — 8KB payload size cap added
103+
- **`X402.Extensions.SIWX.ETSStorage`** — ETS size cap added; read consistency fixes; atomic claim to prevent double-settle; safe cache eviction
104+
- **Elixir minimum** — bumped to `~> 1.19`
105+
- **`X402.Header`** — new shared header utilities module
106+
- **`X402.Wallet`** — Solana address validation tightened

docs/golden-principles.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> These are non-negotiable. Every PR is judged against them.
44
55
## 1. Zero Lock-In
6-
The library never forces a specific facilitator, chain, HTTP client, or framework. Users bring their own `Finch` process. Any facilitator URL is accepted. Any CAIP-2 network is valid.
6+
The library never forces a specific facilitator, chain, HTTP client, or framework. Users bring their own `Finch` process. Any HTTPS facilitator URL is accepted. Any CAIP-2 network is valid.
77

88
**Violation:** Hardcoding Coinbase's facilitator URL. Requiring a specific HTTP client at compile time.
99

@@ -51,3 +51,13 @@ Unit tests use Bypass or Mox. Real HTTP calls are forbidden in test suite. CI ne
5151
If a PR drops coverage below 90%, it is not merged. Period. Coverage is a floor, not a vanity metric.
5252

5353
**Violation:** Merging a PR with coverage at 88% "because it's close enough".
54+
55+
## 11. TLS Must Be Verified (added v0.3.2)
56+
All HTTP connections to the facilitator must use TLS peer verification. No `:verify_none` in production configuration. `HTTP.secure_pool_opts/0` is the canonical source of pool config.
57+
58+
**Violation:** Passing `[transport_opts: [verify: :verify_none]]` to `Finch.start_link`.
59+
60+
## 12. Enforce HTTPS on Facilitator URL (added v0.3.2)
61+
The facilitator `base_url` must start with `https://`. This is validated at `Facilitator.start_link/1` time, not at call time.
62+
63+
**Violation:** Accepting an `http://` facilitator URL at startup without raising.

docs/quality.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Quality Status — x402 Elixir SDK
22

3-
> Last updated: 2026-02-25
3+
> Last updated: 2026-04-01
44
55
## Current Grades
66

77
| Area | Grade | Notes |
88
|------|-------|-------|
9-
| Tests | A- | >89% line coverage (ExCoveralls), doctests on all pure functions |
9+
| Tests | A | >90% line coverage (ExCoveralls), doctests on all pure functions; new HTTP + PaymentSignature tests added |
1010
| Architecture | A | Flat modules, behaviours, minimal deps — Dashbit-level |
1111
| Docs | A | hexdocs published, @moduledoc + @doc + @spec on all publics |
1212
| Type Safety | A | Dialyzer-clean, full typespecs |
13-
| Security | B+ | No secrets stored, wallet validation tested, SIWX needs more fuzz |
13+
| Security | A- | TLS peer verification enforced, HTTPS-only base_url, 8KB size caps on all headers, atomic ETS claim |
1414
| Optional Deps | A | Compiles cleanly with `--no-optional-deps` |
1515

1616
## Coverage Target

0 commit comments

Comments
 (0)