mppx 0.17.6 → 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 +28 -0
- package/dist/cli/cli.js +139 -139
- package/dist/cli/plugins/index.js +6 -6
- package/dist/client/Mppx.js +13 -4
- package/dist/client/internal/Fetch.js +9 -5
- package/dist/extensions/identity/{email-otp/internal → attestation}/Constants.d.ts +4 -1
- package/dist/extensions/identity/{email-otp/internal → attestation}/Constants.js +4 -1
- package/dist/extensions/identity/{email-otp/internal → attestation}/Jwks.d.ts +5 -5
- package/dist/extensions/identity/{email-otp/internal → attestation}/Jwks.js +1 -1
- package/dist/extensions/identity/{email-otp/internal/Attestation.d.ts → attestation/Token.d.ts} +40 -26
- package/dist/extensions/identity/{email-otp/internal/Attestation.js → attestation/Token.js} +18 -3
- package/dist/extensions/identity/{email-otp/internal → attestation}/Types.d.ts +14 -14
- 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 +5 -5
- package/dist/extensions/identity/email-otp/Constants.js +6 -5
- package/dist/extensions/identity/email-otp/Types.d.ts +4 -4
- package/dist/extensions/identity/email-otp/client/index.d.ts +22 -15
- package/dist/extensions/identity/email-otp/client/index.js +17 -5
- package/dist/extensions/identity/email-otp/index.d.ts +3 -8
- package/dist/extensions/identity/email-otp/index.js +3 -8
- package/dist/extensions/identity/email-otp/server/index.d.ts +16 -16
- package/dist/extensions/identity/email-otp/server/index.js +17 -14
- package/dist/extensions/identity/index.d.ts +2 -0
- package/dist/extensions/identity/index.js +2 -0
- package/dist/extensions/identity/internal/Verification.js +9 -5
- package/dist/identity/Callback.d.ts +24 -5
- package/dist/identity/Callback.js +35 -11
- 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 +2 -0
- package/dist/identity/index.js +2 -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 -3
- 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 +5 -1
- package/dist/extensions/identity/email-otp/internal/Prover.d.ts +0 -46
- package/dist/extensions/identity/email-otp/internal/Prover.js +0 -168
- package/dist/extensions/identity/email-otp/internal/Verifier.d.ts +0 -56
- package/dist/extensions/identity/email-otp/internal/Verifier.js +0 -116
- /package/dist/extensions/identity/{email-otp/internal → attestation}/Types.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
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
|
+
|
|
3
31
|
## 0.17.6
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|