Repository navigation
mppx@0.18.0
Minor Changes
-
de802b9: Reworked identity verification around explicit statuses and data.
- Changed
Identity.Verificationto fixed statuses:valid,missing(401),invalid(401),forbidden(403) andunavailable(503), exported asIdentity.Status.codeswith the precedence listIdentity.Status.precedence. When several verifiers (or everyanyOfmember) reject, the status with the highest precedence decides, and the headers of every rejection are merged. Breaking:missingnow answers 401 instead of 403. - Added
statustoIdentity.Rejection(invalid,forbiddenorunavailable). - Marked identity rejections with a
rejectionfield ({ stage, status, reason }) on the route result's non-200 branch, whichcomposenow reads. - Replaced payment-stage verifiers with an experimental payment check,
identity: { request, payment }:payment.requiresis listed in every 402's newIdentity-Requiredheader (merged across composed offers), andpayment.verifyruns 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'verifyreceives only the request. - Routes with a payment check reject x402 Credentials and do not offer x402.
composerequires 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. - Changed
Prover.prepareto receive the selected Challenge and the parsedIdentity-Requiredrequirements, andProver.retryto return headers to resend with. - Deprecated
Verifier.stage,Verifier.challenge, thecodeofmissingandinvalidoutcomes andIdentity.Rejection'scode, and aretryresult oftrue. They keep working.
- Changed
Patch Changes
-
802a27a: Behavior change in production: Changed
tempo.charge(),tempo.session(),tempo.subscription()andtempo()to throw at construction when nostoreis passed andNODE_ENVisproduction, 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, orstore: Store.memory()to keep instance-local state; local development and tests still fall back to memory with a warning. Charges served throughrelayneed no store, since the relay enforces single use. -
454b9e0: Added
mppx/extensions/identity/attestationand rebuilt the identity extensions on fixed statuses.- Added the attestation module (
Attestationfrommppx/extensions/identity):Attestation.Server.verifierfor any attestation type,Attestation.Client.prover,Attestation.sign,decodeandverifyfor issuers,Attestation.Jwks.resolverandAttestation.Constants. The attestation wire format and theIdentity-Attestationheader are unchanged. - Grouped alternatives in
Identity-Attestation-Required:Identity.anyOflists 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.requirementsreturns these groups. - Rebuilt
EmailOtpon it, with the same public API. DeprecatedEmailOtp.Constants.headerandrequiredHeaderin favor ofAttestation.Constants. - Added
Identity.Headers, the identity request headers that never cross origins or reach upstream and the identity response headers a proxy drops, andProver.headersfor a prover's own sensitive request headers. The client's cross-origin redirect stripping and the proxy now read them instead of hardcoded names. - Added a second
Prover.retryparameter,{ request }: the request that got the rejected response. - 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 itsretryreturns 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. - 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 isunavailable(503).Attestation.verifyreturnsunavailableinstead ofinvalidwithunavailable: true. - Deprecated the function form of
audienceinAttestation.Server.verifierandEmailOtp.Server.verifier: it is only safe where the platform guarantees the request's host.
- Added the attestation module (