mppx 0.16.0 → 0.17.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 +19 -0
- package/dist/Challenge.d.ts +6 -0
- package/dist/Challenge.js +12 -0
- package/dist/Method.d.ts +2 -0
- package/dist/cli/cli.js +31 -25
- package/dist/cli/plugins/index.js +11 -11
- package/dist/cli/validate/payment.js +39 -15
- package/dist/client/internal/protocols/Mpp.js +4 -1
- package/dist/identity/Client.js +3 -3
- package/dist/identity/Server.d.ts +13 -0
- package/dist/identity/Server.js +50 -1
- package/dist/identity/Types.d.ts +32 -10
- package/dist/internal/version.d.ts +2 -2
- package/dist/internal/version.js +1 -1
- package/dist/server/Mppx.d.ts +2 -2
- package/dist/server/Mppx.js +49 -24
- package/dist/server/internal/challengeMeta.d.ts +6 -0
- package/dist/server/internal/challengeMeta.js +17 -1
- package/dist/tempo/client/Charge.d.ts +11 -0
- package/dist/tempo/client/Charge.js +30 -1
- package/dist/tempo/internal/defaults.d.ts +9 -0
- package/dist/tempo/internal/defaults.js +9 -0
- package/dist/tempo/internal/fee-payer.js +2 -2
- package/dist/tempo/server/Charge.js +12 -1
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# mppx
|
|
2
2
|
|
|
3
|
+
## 0.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 25c8468: Simplified payment-stage identity. Breaking changes to `mppx/identity`:
|
|
8
|
+
|
|
9
|
+
- Every payment offer in one 402 now carries the same HMAC-bound identity nonce, passed to verifiers as `context.nonce`. Bind payment-stage proofs to it instead of the challenge id. Routes may combine several offers with payment-stage identity (for example `tempo()`'s default currencies, or Tempo and Stripe), as long as they require the same verifiers; previously a route allowed only one such offer.
|
|
10
|
+
- Verifiers issue their 402 challenge headers through a new optional `challenge(request, { nonce })` hook, which runs once per 402, instead of returning them from `verify` as `missing`. `verify` only checks proofs.
|
|
11
|
+
- `Prover.retry` is split: `prepare(response, { challenge })` runs on a 402 before the payment retry, and `retry(response)` runs on other rejections and returns whether to resend.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- b149237: Raised the @hono/node-server override to 2.1.5 to resolve a dependency audit advisory.
|
|
16
|
+
- faa4735: Fixed the client throwing `No Payment schemes found.` on a `402` whose `WWW-Authenticate` has no Payment challenge, so other protocols such as x402 now handle it.
|
|
17
|
+
- 73b464f: Fixed the Tempo charge client signing a sponsored transaction whose `validBefore` had fewer than 15 seconds left after slow preparation: the pre-sign check now measures `validBefore` as well as the challenge expiry.
|
|
18
|
+
- a0d54fd: Enforced the fee payer's 15-second remaining-validity minimum for Tempo charges: clients refused to sign a sponsored pull transaction for a challenge expiring in under 15 seconds, checking again right before signing, and servers refused to issue a sponsored challenge with a paid amount and pull mode that expires that soon. Push and zero-amount challenges were exempt. Request hooks received the expiry echoed by the credential when verifying it.
|
|
19
|
+
- 7a68c55: Fixed focused tests failing in a clean checkout by generating the HTML modules on demand, and the package check's cleanup reinstalling dependencies with the publish manifest.
|
|
20
|
+
- 443ad6d: Improved `mppx validate` SSE receipt scanning to search only newly received text for event boundaries, so long events no longer cost quadratic time.
|
|
21
|
+
|
|
3
22
|
## 0.16.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/dist/Challenge.d.ts
CHANGED
|
@@ -215,6 +215,12 @@ export declare function serialize(challenge: Challenge): string;
|
|
|
215
215
|
* @returns The deserialized challenge.
|
|
216
216
|
*/
|
|
217
217
|
export declare function deserialize<const methods extends readonly Method.Method[] | undefined = undefined>(value: string, options?: from.Options<methods>): from.ReturnType<from.Parameters, methods>;
|
|
218
|
+
/**
|
|
219
|
+
* Returns whether a `WWW-Authenticate` value contains a Payment challenge.
|
|
220
|
+
*
|
|
221
|
+
* @internal
|
|
222
|
+
*/
|
|
223
|
+
export declare function hasPaymentScheme(value: string): boolean;
|
|
218
224
|
/**
|
|
219
225
|
* Extracts the challenge from a Headers object.
|
|
220
226
|
*
|
package/dist/Challenge.js
CHANGED
|
@@ -335,6 +335,18 @@ function startsWithSchemeToken(value, index, token) {
|
|
|
335
335
|
const next = value[index + token.length];
|
|
336
336
|
return Boolean(next && /\s/.test(next));
|
|
337
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Returns whether a `WWW-Authenticate` value contains a Payment challenge.
|
|
340
|
+
*
|
|
341
|
+
* @internal
|
|
342
|
+
*/
|
|
343
|
+
export function hasPaymentScheme(value) {
|
|
344
|
+
// A bare `Payment` scheme with no parameters is still a (malformed) Payment challenge.
|
|
345
|
+
return (findSchemeStarts(value, Constants.Schemes.payment).length > 0 ||
|
|
346
|
+
value
|
|
347
|
+
.split(',')
|
|
348
|
+
.some((part) => part.trim().toLowerCase() === Constants.Schemes.payment.toLowerCase()));
|
|
349
|
+
}
|
|
338
350
|
/** @internal Finds auth scheme boundaries while ignoring quoted-string contents. */
|
|
339
351
|
function findSchemeStarts(value, token) {
|
|
340
352
|
const starts = [];
|
package/dist/Method.d.ts
CHANGED
|
@@ -75,6 +75,8 @@ export type VerifiedChallengeEnvelope<request extends Record<string, unknown> =
|
|
|
75
75
|
export type RequestContext<method extends Method> = {
|
|
76
76
|
capturedRequest?: CapturedRequest;
|
|
77
77
|
credential?: Credential.Credential | null;
|
|
78
|
+
/** Expiry (ISO 8601) of the challenge being issued, or echoed by `credential`. */
|
|
79
|
+
expires?: string | undefined;
|
|
78
80
|
request: z.input<method['schema']['request']>;
|
|
79
81
|
};
|
|
80
82
|
/** Verification hook parameters for a single method. */
|