mppx 0.17.5 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/dist/cli/cli.js +141 -139
- package/dist/cli/plugins/index.js +6 -6
- package/dist/cli/stripe.d.ts +6 -1
- package/dist/cli/stripe.js +89 -5
- package/dist/client/Mppx.js +13 -3
- package/dist/client/internal/Fetch.js +9 -5
- package/dist/extensions/identity/attestation/Constants.d.ts +23 -0
- package/dist/extensions/identity/attestation/Constants.js +23 -0
- package/dist/extensions/identity/attestation/Jwks.d.ts +30 -0
- package/dist/extensions/identity/attestation/Jwks.js +114 -0
- package/dist/extensions/identity/attestation/Token.d.ts +80 -0
- package/dist/extensions/identity/attestation/Token.js +143 -0
- package/dist/extensions/identity/attestation/Types.d.ts +48 -0
- package/dist/extensions/identity/attestation/Types.js +2 -0
- package/dist/extensions/identity/attestation/client/index.d.ts +66 -0
- package/dist/extensions/identity/attestation/client/index.js +273 -0
- package/dist/extensions/identity/attestation/index.d.ts +20 -0
- package/dist/extensions/identity/attestation/index.js +18 -0
- package/dist/extensions/identity/attestation/internal/Cache.d.ts +120 -0
- package/dist/extensions/identity/attestation/internal/Cache.js +90 -0
- package/dist/extensions/identity/attestation/server/index.d.ts +66 -0
- package/dist/extensions/identity/attestation/server/index.js +119 -0
- package/dist/extensions/identity/email-otp/Constants.d.ts +16 -0
- package/dist/extensions/identity/email-otp/Constants.js +17 -0
- package/dist/extensions/identity/email-otp/Types.d.ts +12 -0
- package/dist/extensions/identity/email-otp/Types.js +2 -0
- package/dist/extensions/identity/email-otp/client/index.d.ts +123 -0
- package/dist/extensions/identity/email-otp/client/index.js +131 -0
- package/dist/extensions/identity/email-otp/index.d.ts +12 -0
- package/dist/extensions/identity/email-otp/index.js +11 -0
- package/dist/extensions/identity/email-otp/server/index.d.ts +48 -0
- package/dist/extensions/identity/email-otp/server/index.js +59 -0
- package/dist/extensions/identity/index.d.ts +4 -0
- package/dist/extensions/identity/index.js +4 -0
- package/dist/extensions/identity/internal/Verification.js +9 -5
- package/dist/identity/Callback.d.ts +66 -0
- package/dist/identity/Callback.js +88 -0
- package/dist/identity/Client.d.ts +78 -5
- package/dist/identity/Client.js +165 -48
- package/dist/identity/Headers.d.ts +16 -0
- package/dist/identity/Headers.js +19 -0
- package/dist/identity/Server.d.ts +159 -37
- package/dist/identity/Server.js +307 -138
- package/dist/identity/Status.d.ts +14 -0
- package/dist/identity/Status.js +19 -0
- package/dist/identity/Types.d.ts +161 -65
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +3 -0
- package/dist/identity/internal/Requirements.d.ts +28 -0
- package/dist/identity/internal/Requirements.js +78 -0
- package/dist/integrations/x402/Evm.d.ts +1 -0
- package/dist/internal/env.d.ts +14 -0
- package/dist/internal/env.js +38 -0
- package/dist/internal/version.d.ts +2 -2
- package/dist/internal/version.js +1 -1
- package/dist/proxy/internal/Headers.d.ts +1 -1
- package/dist/proxy/internal/Headers.js +7 -1
- package/dist/server/Mppx.d.ts +14 -6
- package/dist/server/Mppx.js +252 -148
- package/dist/server/internal/challengeMeta.d.ts +0 -6
- package/dist/server/internal/challengeMeta.js +3 -17
- package/dist/tempo/server/Charge.d.ts +14 -9
- package/dist/tempo/server/Charge.js +5 -1
- package/dist/tempo/server/Methods.js +4 -1
- package/dist/tempo/server/Subscription.d.ts +8 -0
- package/dist/tempo/server/internal/fallback-store.d.ts +7 -2
- package/dist/tempo/server/internal/fallback-store.js +12 -3
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/dist/tempo/session/server/Session.d.ts +5 -1
- package/package.json +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# mppx
|
|
2
2
|
|
|
3
|
+
## 0.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- de802b9: Reworked identity verification around explicit statuses and data.
|
|
8
|
+
|
|
9
|
+
- Changed `Identity.Verification` to fixed statuses: `valid`, `missing` (401), `invalid` (401), `forbidden` (403) and `unavailable` (503), exported as `Identity.Status.codes` with the precedence list `Identity.Status.precedence`. When several verifiers (or every `anyOf` member) reject, the status with the highest precedence decides, and the headers of every rejection are merged. **Breaking:** `missing` now answers 401 instead of 403.
|
|
10
|
+
- Added `status` to `Identity.Rejection` (`invalid`, `forbidden` or `unavailable`).
|
|
11
|
+
- Marked identity rejections with a `rejection` field (`{ stage, status, reason }`) on the route result's non-200 branch, which `compose` now reads.
|
|
12
|
+
- Replaced payment-stage verifiers with an experimental payment check, `identity: { request, payment }`: `payment.requires` is listed in every 402's new `Identity-Required` header (merged across composed offers), and `payment.verify` runs once on the paid retry with the Credential. **Breaking:** `stage: 'payment'` verifiers now throw, the identity nonce is no longer added to Challenges, and request verifiers' `verify` receives only the request.
|
|
13
|
+
- Routes with a payment check reject x402 Credentials and do not offer x402. `compose` requires every payment check in a route to be the same one, and refuses a checked and an unchecked offer with the same payment terms, since a Credential could reach either.
|
|
14
|
+
- Changed `Prover.prepare` to receive the selected Challenge and the parsed `Identity-Required` requirements, and `Prover.retry` to return headers to resend with.
|
|
15
|
+
- Deprecated `Verifier.stage`, `Verifier.challenge`, the `code` of `missing` and `invalid` outcomes and `Identity.Rejection`'s `code`, and a `retry` result of `true`. They keep working.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 802a27a: **Behavior change in production:** Changed `tempo.charge()`, `tempo.session()`, `tempo.subscription()` and `tempo()` to throw at construction when no `store` is passed and `NODE_ENV` is `production`, the server runs on a multi-instance platform (Vercel, AWS Lambda, Netlify, Fly.io, Cloud Run, Render, Railway, Heroku, Deno Deploy) or on Cloudflare Workers, instead of silently keeping replay protection and sponsor budgets in per-instance memory. Pass a shared store, or `store: Store.memory()` to keep instance-local state; local development and tests still fall back to memory with a warning. Charges served through `relay` need no store, since the relay enforces single use.
|
|
20
|
+
- 454b9e0: Added `mppx/extensions/identity/attestation` and rebuilt the identity extensions on fixed statuses.
|
|
21
|
+
|
|
22
|
+
- Added the attestation module (`Attestation` from `mppx/extensions/identity`): `Attestation.Server.verifier` for any attestation type, `Attestation.Client.prover`, `Attestation.sign`, `decode` and `verify` for issuers, `Attestation.Jwks.resolver` and `Attestation.Constants`. The attestation wire format and the `Identity-Attestation` header are unchanged.
|
|
23
|
+
- Grouped alternatives in `Identity-Attestation-Required`: `Identity.anyOf` lists its members' requirements as one inner list, and the prover meets each group with one attestation, the first that succeeds in listed order, so a route accepting any of several issuers costs one code. `Attestation.Client.requirements` returns these groups.
|
|
24
|
+
- Rebuilt `EmailOtp` on it, with the same public API. Deprecated `EmailOtp.Constants.header` and `requiredHeader` in favor of `Attestation.Constants`.
|
|
25
|
+
- Added `Identity.Headers`, the identity request headers that never cross origins or reach upstream and the identity response headers a proxy drops, and `Prover.headers` for a prover's own sensitive request headers. The client's cross-origin redirect stripping and the proxy now read them instead of hardcoded names.
|
|
26
|
+
- Added a second `Prover.retry` parameter, `{ request }`: the request that got the rejected response.
|
|
27
|
+
- Simplified the attestation prover: it caches one attestation per audience, issuer and type, sends every unexpired one on a paid attempt and only those outside the refresh margin (`min(300s, half the lifetime)`) on an unpaid one, and its `retry` returns the attestations to resend with. Fixed a paid retry dropping an attestation close to expiry, and a late 401 on a concurrent request discarding a just-obtained attestation and asking for another code.
|
|
28
|
+
- Moved the identity extensions to fixed statuses: an untrusted or unresolvable signature key and an attestation the route's policy rejects are `forbidden` (403), an unreachable issuer key set is `unavailable` (503). `Attestation.verify` returns `unavailable` instead of `invalid` with `unavailable: true`.
|
|
29
|
+
- Deprecated the function form of `audience` in `Attestation.Server.verifier` and `EmailOtp.Server.verifier`: it is only safe where the platform guarantees the request's host.
|
|
30
|
+
|
|
31
|
+
## 0.17.6
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- 9bd6ad6: Fixed the email OTP client helpers so they refuse to send an address or code to a plaintext http issuer other than localhost.
|
|
36
|
+
- 0a01b79: Added `mppx/extensions/identity/email-otp`: `EmailOtp.Server.verifier` requires a verified email address, sent as an issuer-signed attestation in `Identity-Attestation` and bound to the server's origin, and `EmailOtp.Client.prover` obtains one with a one-time code when a server answers 401 with `Identity-Attestation-Required`.
|
|
37
|
+
- 9bd6ad6: Fixed the email OTP verifier so an attestation the route's policy rejects no longer hides an allowed one later in the same request.
|
|
38
|
+
- 3d8fe95: Fixed the email OTP verifier so a forged attestation with a later expiry no longer hides a valid one, and a key rotated in during an issuer outage answers 503 instead of 401.
|
|
39
|
+
- 970ac7b: Added `Identity.from` and `Identity.Rejection` to `mppx/identity`: `Identity.from({ verify })` turns a function, such as a lookup in your own database, session store or KYC provider, into a route identity verifier. It returns the caller's identity, `undefined` for a 401, or throws `Identity.Rejection` to reject the request before any payment.
|
|
40
|
+
- db73851: Fixed `mppx stripe address --env` to recognize multiline dotenv values under any key Node accepts, such as one starting with a digit or holding a space, and in files with CRLF line endings, so a line inside one is no longer taken for the deposit address. It also checks the result with Node's dotenv parser and refuses to write when Node would read the address or any other entry differently.
|
|
41
|
+
- 2067b0c: Fixed `mppx stripe address` to reject a deposit address that isn't valid for its network (Solana addresses must decode to 32 bytes), refuse env values with line breaks, and leave exactly one assignment of the key when writing with `--env`.
|
|
42
|
+
|
|
3
43
|
## 0.17.5
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|