mppx 0.17.0 → 0.17.1
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 +17 -0
- package/dist/BodyDigest.js +13 -1
- package/dist/Method.d.ts +5 -0
- package/dist/cli/cli.js +133 -133
- package/dist/cli/plugins/index.js +11 -11
- package/dist/cli/sessions/store.js +7 -1
- package/dist/cli/validate/helpers.d.ts +1 -1
- package/dist/cli/validate/helpers.js +14 -2
- package/dist/client/Mppx.js +11 -3
- package/dist/client/internal/Fetch.d.ts +2 -0
- package/dist/client/internal/Fetch.js +59 -3
- package/dist/internal/AcceptPayment.d.ts +12 -2
- package/dist/internal/AcceptPayment.js +12 -3
- package/dist/internal/version.d.ts +2 -2
- package/dist/internal/version.js +1 -1
- package/dist/mcp/client/McpClient.js +1 -1
- package/dist/proxy/Proxy.d.ts +15 -0
- package/dist/proxy/Proxy.js +89 -1
- package/dist/proxy/internal/Replay.d.ts +105 -0
- package/dist/proxy/internal/Replay.js +257 -0
- package/dist/server/Mppx.d.ts +2 -0
- package/dist/server/Mppx.js +2 -1
- package/dist/tempo/client/Charge.d.ts +9 -0
- package/dist/tempo/client/Charge.js +13 -9
- package/dist/tempo/client/Methods.d.ts +2 -0
- package/dist/tempo/server/Charge.js +4 -1
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/dist/tempo/session/client/ChannelOps.d.ts +2 -0
- package/dist/tempo/session/client/ChannelStore.js +5 -0
- package/dist/tempo/session/client/Session.d.ts +26 -1
- package/dist/tempo/session/client/Session.js +72 -1
- package/dist/tempo/session/client/SessionManager.d.ts +1 -0
- package/dist/tempo/session/client/SessionManager.js +54 -7
- package/dist/tempo/session/client/Transports.d.ts +2 -0
- package/dist/tempo/session/client/Transports.js +31 -2
- package/dist/tempo/session/precompile/Voucher.js +20 -7
- package/dist/tempo/session/server/Session.d.ts +2 -1
- package/dist/tempo/session/server/Session.js +2 -1
- package/dist/tempo/session/server/Settlement.d.ts +4 -2
- package/dist/tempo/session/server/Settlement.js +2 -2
- package/dist/tempo/session/server/Ws.js +29 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# mppx
|
|
2
2
|
|
|
3
|
+
## 0.17.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 95dd056: Fixed closing a Tempo session paid with a Viem Tempo access key account. `signCloseAuthorization` now signs the close authorization hash raw with the access key, as vouchers already do, instead of returning a keychain signature that TIP-1034 rejects.
|
|
8
|
+
- ed76e8e: Accepted the RFC 9530 byte-sequence form (`sha-256=:base64:`) in `BodyDigest.verify`, alongside the existing bare form. `BodyDigest.compute` still emits the bare form.
|
|
9
|
+
- 20eca32: Added `feeToken` to the Tempo charge client, so an access key whose spending limits exclude the default fee token can pay an unsponsored charge's fee in a token it may spend.
|
|
10
|
+
- 2b747bf: Fixed Tempo charge settlement returning a fresh 402 after a paid transaction was mined: a broadcast rejected with `ExpiringNonceReplay` (for example, a retried send) now recovers the transaction's receipt instead of failing.
|
|
11
|
+
- cd6a2a7: Fixed payment retries losing Request-carried HTTP methods and bodies, including valid body overrides. Rejected automatic payment after redirects with ambiguous method rewriting before creating credentials.
|
|
12
|
+
- 807376f: Fixed cooperative HTTP session close inheriting the resource Request's body and abort signal while preserving its transport settings and the same resource URL.
|
|
13
|
+
- 2ca12d1: Charged request-priced SSE-enabled content before invoking application handlers, including POST requests that return plain responses. Marked the receipt prepaid to avoid charging the first stream unit twice. Per-item pricing remained stream-driven. Applications must refund request charges when they cannot serve the accepted request.
|
|
14
|
+
- 3fca0d6: Added an opt-in `replay` option to `Proxy.create`, so a payer who loses the connection during a long paid request can collect the response. The paid upstream request runs detached from the client, and a retry with the same credential and request gets the stored response, `202` while it runs, or a new upstream attempt after a failed delivery, without paying again.
|
|
15
|
+
- afb9924: Fixed rejected WebSocket payments leaving sockets open when detailed error messages exceeded the close-frame reason limit.
|
|
16
|
+
- 3c2bc84: Bound each session manager to its first HTTP origin and persisted that binding with reusable channels. Rejected cross-origin HTTP, SSE, and WebSocket reuse before disclosing channel hints or payment credentials, and prevented redirects from forwarding session requests. Existing unbound channel entries acquired an origin on their next validated reuse.
|
|
17
|
+
- 9957b10: Applied the `currencies`, `maxAmount`, `maxAtomicAmount` and `expectedRecipients` client options to Tempo session payments. `tempo()` passed them only to its charge method; its session method, and `tempo.session()` given them directly, now skip offers in other currencies, to other recipients or above the cap during selection and reject them before signing or topping up a channel. An explicit close passed to `Mppx.createCredential`, `fetch` or the MCP client stays available for any offer: `canHandleChallenge` now receives the caller's credential context when it is known before selection.
|
|
18
|
+
- 5d353bb: Prevented validation probes from authorizing payments through an installed global Mppx fetch wrapper.
|
|
19
|
+
|
|
3
20
|
## 0.17.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/BodyDigest.js
CHANGED
|
@@ -36,6 +36,18 @@ export function compute(body) {
|
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
38
|
export function verify(digest, body) {
|
|
39
|
-
return constantTimeEqual(compute(body), digest);
|
|
39
|
+
return constantTimeEqual(compute(body), normalize(digest));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Accepts the RFC 9530 byte-sequence form `sha-256=:base64hash:` (the form the
|
|
43
|
+
* Payment spec shows) by stripping its colons and restoring any padding it
|
|
44
|
+
* omits (RFC 8941 `4.2.7). Other text is left unchanged.
|
|
45
|
+
*/
|
|
46
|
+
function normalize(digest) {
|
|
47
|
+
const match = /^sha-256=:([A-Za-z0-9+/]+)=*:$/.exec(digest);
|
|
48
|
+
if (!match)
|
|
49
|
+
return digest;
|
|
50
|
+
const hash = match[1];
|
|
51
|
+
return `sha-256=${hash}${'='.repeat((4 - (hash.length % 4)) % 4)}`;
|
|
40
52
|
}
|
|
41
53
|
//# sourceMappingURL=BodyDigest.js.map
|
package/dist/Method.d.ts
CHANGED
|
@@ -226,8 +226,13 @@ export type CreateCredentialFn<method extends Method, context = unknown> = (para
|
|
|
226
226
|
context: context;
|
|
227
227
|
})) => Promise<string>;
|
|
228
228
|
/** Predicate used when multiple client implementations share a wire method/intent. */
|
|
229
|
+
/**
|
|
230
|
+
* Returns whether a client method can sign a challenge. `context` is the caller's credential
|
|
231
|
+
* context when the caller supplied it before selection, such as an explicit session close.
|
|
232
|
+
*/
|
|
229
233
|
export type CanHandleChallengeFn = (parameters: {
|
|
230
234
|
challenge: Challenge.Challenge;
|
|
235
|
+
context?: unknown;
|
|
231
236
|
}) => boolean;
|
|
232
237
|
/** Request transform function for a single method. */
|
|
233
238
|
export type RequestFn<method extends Method> = (options: RequestContext<method>) => MaybePromise<z.input<method['schema']['request']>>;
|