mppx 0.18.1 → 0.19.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 +33 -0
- package/dist/Errors.d.ts +40 -4
- package/dist/Errors.js +40 -6
- package/dist/cli/cli.js +96 -96
- package/dist/cli/plugins/index.js +12 -12
- package/dist/extensions/identity/Types.d.ts +26 -0
- package/dist/extensions/identity/attestation/Token.d.ts +6 -4
- package/dist/extensions/identity/attestation/Token.js +11 -5
- package/dist/extensions/identity/index.d.ts +2 -0
- package/dist/extensions/identity/index.js +2 -0
- package/dist/extensions/identity/internal/HttpMessageSignature.d.ts +2 -2
- package/dist/extensions/identity/internal/HttpMessageSignature.js +13 -10
- package/dist/extensions/identity/{web-bot-auth/internal → internal}/JwkThumbprint.js +1 -1
- package/dist/extensions/identity/internal/Signer.d.ts +20 -0
- package/dist/extensions/identity/internal/Signer.js +94 -0
- package/dist/extensions/identity/poppy/Constants.d.ts +26 -0
- package/dist/extensions/identity/poppy/Constants.js +26 -0
- package/dist/extensions/identity/poppy/Types.d.ts +19 -0
- package/dist/extensions/identity/poppy/Types.js +2 -0
- package/dist/extensions/identity/poppy/client/index.d.ts +69 -0
- package/dist/extensions/identity/poppy/client/index.js +81 -0
- package/dist/extensions/identity/poppy/index.d.ts +7 -0
- package/dist/extensions/identity/poppy/index.js +7 -0
- package/dist/extensions/identity/poppy/internal/Jws.d.ts +12 -0
- package/dist/extensions/identity/poppy/internal/Jws.js +78 -0
- package/dist/extensions/identity/poppy/server/index.d.ts +40 -0
- package/dist/extensions/identity/poppy/server/index.js +181 -0
- package/dist/extensions/identity/tap/client/index.d.ts +6 -2
- package/dist/extensions/identity/tap/client/index.js +2 -0
- package/dist/extensions/identity/tempo/Constants.d.ts +14 -0
- package/dist/extensions/identity/tempo/Constants.js +14 -0
- package/dist/extensions/identity/tempo/Types.d.ts +31 -0
- package/dist/extensions/identity/tempo/Types.js +2 -0
- package/dist/extensions/identity/tempo/client/index.d.ts +34 -0
- package/dist/extensions/identity/tempo/client/index.js +60 -0
- package/dist/extensions/identity/tempo/index.d.ts +5 -0
- package/dist/extensions/identity/tempo/index.js +4 -0
- package/dist/extensions/identity/tempo/internal/Jwt.d.ts +36 -0
- package/dist/extensions/identity/tempo/internal/Jwt.js +114 -0
- package/dist/extensions/identity/tempo/server/index.d.ts +65 -0
- package/dist/extensions/identity/tempo/server/index.js +247 -0
- package/dist/extensions/identity/web-bot-auth/client/index.d.ts +6 -4
- package/dist/extensions/identity/web-bot-auth/client/index.js +7 -5
- package/dist/extensions/identity/web-bot-auth/server/index.js +1 -1
- package/dist/extensions/identity/world/Constants.d.ts +50 -0
- package/dist/extensions/identity/world/Constants.js +50 -0
- package/dist/extensions/identity/world/Types.d.ts +52 -0
- package/dist/extensions/identity/world/Types.js +2 -0
- package/dist/extensions/identity/world/client/index.d.ts +103 -0
- package/dist/extensions/identity/world/client/index.js +208 -0
- package/dist/extensions/identity/world/index.d.ts +6 -0
- package/dist/extensions/identity/world/index.js +5 -0
- package/dist/extensions/identity/world/internal/Idp.d.ts +50 -0
- package/dist/extensions/identity/world/internal/Idp.js +265 -0
- package/dist/extensions/identity/world/issuer/index.d.ts +120 -0
- package/dist/extensions/identity/world/issuer/index.js +520 -0
- package/dist/extensions/identity/world/server/index.d.ts +49 -0
- package/dist/extensions/identity/world/server/index.js +63 -0
- package/dist/identity/Headers.d.ts +1 -1
- package/dist/identity/Headers.js +7 -1
- package/dist/identity/Types.d.ts +5 -0
- package/dist/internal/version.d.ts +2 -2
- package/dist/internal/version.js +1 -1
- package/dist/server/Mppx.js +2 -1
- package/dist/tempo/client/Charge.js +39 -16
- package/dist/tempo/internal/simulation.d.ts +33 -0
- package/dist/tempo/internal/simulation.js +80 -0
- package/dist/tempo/internal/zone.d.ts +27 -0
- package/dist/tempo/internal/zone.js +54 -7
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/dist/tempo/session/client/ChannelOps.js +5 -2
- package/package.json +13 -1
- /package/dist/extensions/identity/{web-bot-auth/internal → internal}/JwkThumbprint.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# mppx
|
|
2
2
|
|
|
3
|
+
## 0.19.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 03bd18d: Hardened `Poppy.Server.verifier`: it rejects invalid `clients` and `maxAge` config, returns `unavailable` instead of throwing on a malformed key set and `invalid` on a non-object `cnf.jwk`, caches a failed key load for 30 seconds, reloads keys once for an unknown `kid` after 30 seconds, only verifies delegations with signing keys that match their `kid` and `alg`, and rejects `Authorization` values that combine an access token with other credentials. `Poppy-Session` is now an `Identity.Headers.request` header, so the proxy no longer forwards it upstream.
|
|
8
|
+
- 9405660: Added `mppx/extensions/identity/poppy`, an identity provider for Poppy (Personal Agent Protocol 1.0) Sessions: `Poppy.Client.prover` signs a fresh `Poppy-Session` JWT for each request, including the paid retry, and `Poppy.Server.verifier` verifies it, with its delegation and the agent's published keys, before any payment Challenge, returning the agent's `client_id`, the pseudonymous User ID, the Session ID and the optional Agent ID.
|
|
9
|
+
- 4e51d05: Fixed `Poppy.Server.verifier` so a failed key reload keeps the agent's previously loaded keys for up to an hour after they loaded, instead of answering `unavailable` until the next reload. The Poppy prover and verifier now bind any single `Bearer` or `DPoP` token, ignore scheme names inside quoted `Authorization` parameters, and the prover throws instead of signing a Session for an `Authorization` value the verifier would reject.
|
|
10
|
+
- 5e21a2e: Added `Errors.SpendingLimitExceededError`. The Tempo charge client and session open and top-up now throw it, or `Errors.InsufficientBalanceError`, when the pre-signing gas estimate reverts with the access key's `SpendingLimitExceeded` or the token's `InsufficientBalance`, instead of signing a transaction that would revert on chain at the fee payer's cost.
|
|
11
|
+
|
|
12
|
+
## 0.19.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- f2c69d5: Added remote signers (a cloud KMS, an HSM or Turnkey) to the Web Bot Auth and TAP client provers, `Attestation.sign` and the World ID issuer, through one `SigningKey` type: a `CryptoKeyPair` or a `Signer` (`{ publicKey, sign({ payload }) }`). mppx checks each remote signature against `publicKey` before it uses it.
|
|
17
|
+
|
|
18
|
+
Breaking: these take a key pair instead of a private key alone. `WebBotAuth.Client.prover` no longer takes `keyId`: it derives the keyid from the public key. `Attestation.sign`'s `keyId` is optional and defaults to the public key's RFC 7638 thumbprint.
|
|
19
|
+
|
|
20
|
+
```diff
|
|
21
|
+
- WebBotAuth.Client.prover({ key: keys.privateKey, keyId, scope, signatureAgent })
|
|
22
|
+
+ WebBotAuth.Client.prover({ key: keys, scope, signatureAgent })
|
|
23
|
+
- Tap.Client.prover({ key: keys.privateKey, keyId, intent, scope })
|
|
24
|
+
+ Tap.Client.prover({ key: keys, keyId, intent, scope })
|
|
25
|
+
- Attestation.sign(claims, { key: keys.privateKey, keyId })
|
|
26
|
+
+ Attestation.sign(claims, { key: keys })
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- 602682c: Fixed HTTP message signing to check a request's signature labels, the new label and a consumed body before it calls a remote signer, so a request it refuses no longer spends a signing operation.
|
|
32
|
+
- f253219: Added `mppx/extensions/identity/tempo`: `TempoId.Server.create` verifies Tempo ID access tokens offline, with DPoP proofs, and returns a payment check that requires a `tempo` payment from a Tempo Account the token grants to the app. Without `clientId` it accepts any app's token. Its `allow` option decides by the user's ID, app, accounts, compliance states, and the email address of an ID token the client sends. `TempoId.Client.prover` sends the access token, a DPoP proof per request, and the optional ID token.
|
|
33
|
+
- 7645703: Added `mppx/extensions/identity/world`: `World.Server.verifier` requires a human verified with World ID, as an `Identity-Attestation` of type `world-id` from a World ID issuer, `World.Issuer` runs that issuer as a shared service or inside an app, and `World.Client.prover` runs the issuer's device flow, shows the human World IdP's approval link and sends the attestation.
|
|
34
|
+
- 3233543: Fixed paying from a Zone whose RPC redacts the outbox's `WithdrawalRequested` event from receipts. The client now derives the sender tag from the outbox's `lastFallbackNonce` and matches the portal's `WithdrawalProcessed` event on Tempo. A failed read of the sender tag is retried with the Challenge, without withdrawing again, and `ZoneSettlementPendingError` has `senderTags`, every candidate tag, with `senderTag` `undefined` when more than one remains.
|
|
35
|
+
|
|
3
36
|
## 0.18.1
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/dist/Errors.d.ts
CHANGED
|
@@ -272,19 +272,51 @@ export declare namespace PaymentSimulationError {
|
|
|
272
272
|
sender?: `0x${string}` | undefined;
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* The access key that signs a Tempo payment has less spending limit left than the payment needs,
|
|
277
|
+
* so the client did not sign it.
|
|
278
|
+
*
|
|
279
|
+
* The client simulates a payment before it signs. On chain the transaction would revert with the
|
|
280
|
+
* account keychain's `SpendingLimitExceeded()` error, and a fee payer would still pay for it.
|
|
281
|
+
* Raise the key's limit, wait for its period to reset, or pay with another key. The simulation
|
|
282
|
+
* error is the `cause`.
|
|
283
|
+
*/
|
|
284
|
+
export declare class SpendingLimitExceededError extends Error {
|
|
285
|
+
readonly name = "SpendingLimitExceededError";
|
|
286
|
+
/** Access key that signs the payment, when the account is an access key. */
|
|
287
|
+
readonly accessKey: `0x${string}` | undefined;
|
|
288
|
+
/** Account that pays. */
|
|
289
|
+
readonly account: `0x${string}`;
|
|
290
|
+
constructor(options: SpendingLimitExceededError.Options);
|
|
291
|
+
}
|
|
292
|
+
export declare namespace SpendingLimitExceededError {
|
|
293
|
+
type Options = {
|
|
294
|
+
/** Access key that signs the payment. */
|
|
295
|
+
accessKey?: `0x${string}` | undefined;
|
|
296
|
+
/** Account that pays. */
|
|
297
|
+
account: `0x${string}`;
|
|
298
|
+
/** The simulation error. */
|
|
299
|
+
cause?: unknown;
|
|
300
|
+
};
|
|
301
|
+
}
|
|
275
302
|
/**
|
|
276
303
|
* A client withdrew from a Zone to pay a challenge, but the withdrawal did not settle on Tempo
|
|
277
304
|
* before the client stopped waiting. The withdrawal cannot be undone and may still settle.
|
|
278
305
|
*
|
|
279
306
|
* Retry the same challenge with the same `tempo.charge` client to resume waiting without
|
|
280
|
-
* withdrawing again, or find the settlement with `senderTag` on the Zone's portal.
|
|
307
|
+
* withdrawing again, or find the settlement with `senderTag` (or one of `senderTags`) on the Zone's portal.
|
|
281
308
|
*/
|
|
282
309
|
export declare class ZoneSettlementPendingError extends Error {
|
|
283
310
|
readonly name = "ZoneSettlementPendingError";
|
|
284
311
|
/** ID of the challenge the withdrawal pays. */
|
|
285
312
|
readonly challengeId: string;
|
|
286
|
-
/**
|
|
287
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Sender tag of the withdrawal, as the portal's `WithdrawalProcessed` event carries it.
|
|
315
|
+
* `undefined` when a Zone RPC hid it and more than one candidate remains: see `senderTags`.
|
|
316
|
+
*/
|
|
317
|
+
readonly senderTag: `0x${string}` | undefined;
|
|
318
|
+
/** Sender tags the withdrawal may carry: its tag alone when known, else every candidate. */
|
|
319
|
+
readonly senderTags: readonly `0x${string}`[];
|
|
288
320
|
/** ID of the Zone the withdrawal left. */
|
|
289
321
|
readonly zoneId: number;
|
|
290
322
|
constructor(options: ZoneSettlementPendingError.Options);
|
|
@@ -296,7 +328,9 @@ export declare namespace ZoneSettlementPendingError {
|
|
|
296
328
|
/** ID of the challenge the withdrawal pays. */
|
|
297
329
|
challengeId: string;
|
|
298
330
|
/** Sender tag of the withdrawal. */
|
|
299
|
-
senderTag
|
|
331
|
+
senderTag?: `0x${string}` | undefined;
|
|
332
|
+
/** Sender tags the withdrawal may carry, when a Zone RPC hid its tag. */
|
|
333
|
+
senderTags?: readonly `0x${string}`[] | undefined;
|
|
300
334
|
/** ID of the Zone the withdrawal left. */
|
|
301
335
|
zoneId: number;
|
|
302
336
|
};
|
|
@@ -392,6 +426,8 @@ export declare class InsufficientBalanceError extends PaymentError {
|
|
|
392
426
|
}
|
|
393
427
|
export declare namespace InsufficientBalanceError {
|
|
394
428
|
type Options = {
|
|
429
|
+
/** Underlying error, such as the failed simulation. Never serialized into Problem Details. */
|
|
430
|
+
cause?: unknown;
|
|
395
431
|
/** Page where the payer can get the funds, such as the MACH onramp. */
|
|
396
432
|
fundingUrl?: string | undefined;
|
|
397
433
|
/** Reason for insufficient balance. */
|
package/dist/Errors.js
CHANGED
|
@@ -226,26 +226,60 @@ export class PaymentSimulationError extends Error {
|
|
|
226
226
|
Object.defineProperty(this, 'cause', { configurable: true, value: cause, writable: true });
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* The access key that signs a Tempo payment has less spending limit left than the payment needs,
|
|
231
|
+
* so the client did not sign it.
|
|
232
|
+
*
|
|
233
|
+
* The client simulates a payment before it signs. On chain the transaction would revert with the
|
|
234
|
+
* account keychain's `SpendingLimitExceeded()` error, and a fee payer would still pay for it.
|
|
235
|
+
* Raise the key's limit, wait for its period to reset, or pay with another key. The simulation
|
|
236
|
+
* error is the `cause`.
|
|
237
|
+
*/
|
|
238
|
+
export class SpendingLimitExceededError extends Error {
|
|
239
|
+
name = 'SpendingLimitExceededError';
|
|
240
|
+
/** Access key that signs the payment, when the account is an access key. */
|
|
241
|
+
accessKey;
|
|
242
|
+
/** Account that pays. */
|
|
243
|
+
account;
|
|
244
|
+
constructor(options) {
|
|
245
|
+
const { accessKey, account, cause } = options;
|
|
246
|
+
super(`Access key spending limit exceeded: ${accessKey ? `key ${accessKey} of ` : ''}account ${account} cannot pay this amount, so the payment was not signed.`);
|
|
247
|
+
this.accessKey = accessKey;
|
|
248
|
+
this.account = account;
|
|
249
|
+
// Defined manually (non-enumerable, like native `cause`) so consumers on pre-ES2022 libs still typecheck.
|
|
250
|
+
if (cause !== undefined)
|
|
251
|
+
Object.defineProperty(this, 'cause', { configurable: true, value: cause, writable: true });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
229
254
|
/**
|
|
230
255
|
* A client withdrew from a Zone to pay a challenge, but the withdrawal did not settle on Tempo
|
|
231
256
|
* before the client stopped waiting. The withdrawal cannot be undone and may still settle.
|
|
232
257
|
*
|
|
233
258
|
* Retry the same challenge with the same `tempo.charge` client to resume waiting without
|
|
234
|
-
* withdrawing again, or find the settlement with `senderTag` on the Zone's portal.
|
|
259
|
+
* withdrawing again, or find the settlement with `senderTag` (or one of `senderTags`) on the Zone's portal.
|
|
235
260
|
*/
|
|
236
261
|
export class ZoneSettlementPendingError extends Error {
|
|
237
262
|
name = 'ZoneSettlementPendingError';
|
|
238
263
|
/** ID of the challenge the withdrawal pays. */
|
|
239
264
|
challengeId;
|
|
240
|
-
/**
|
|
265
|
+
/**
|
|
266
|
+
* Sender tag of the withdrawal, as the portal's `WithdrawalProcessed` event carries it.
|
|
267
|
+
* `undefined` when a Zone RPC hid it and more than one candidate remains: see `senderTags`.
|
|
268
|
+
*/
|
|
241
269
|
senderTag;
|
|
270
|
+
/** Sender tags the withdrawal may carry: its tag alone when known, else every candidate. */
|
|
271
|
+
senderTags;
|
|
242
272
|
/** ID of the Zone the withdrawal left. */
|
|
243
273
|
zoneId;
|
|
244
274
|
constructor(options) {
|
|
245
|
-
const { cause, challengeId,
|
|
246
|
-
|
|
275
|
+
const { cause, challengeId, zoneId } = options;
|
|
276
|
+
const senderTags = options.senderTags ?? (options.senderTag ? [options.senderTag] : []);
|
|
277
|
+
const senderTag = senderTags.length === 1 ? senderTags[0] : undefined;
|
|
278
|
+
const withdrawal = senderTag ?? `with sender tag ${senderTags.join(' or ')}`;
|
|
279
|
+
super(`Zone ${zoneId} withdrawal ${withdrawal} for challenge "${challengeId}" has not settled on Tempo yet. Retry the challenge to resume waiting instead of paying again.`);
|
|
247
280
|
this.challengeId = challengeId;
|
|
248
281
|
this.senderTag = senderTag;
|
|
282
|
+
this.senderTags = senderTags;
|
|
249
283
|
this.zoneId = zoneId;
|
|
250
284
|
// Defined manually (non-enumerable, like native `cause`) so consumers on pre-ES2022 libs still typecheck.
|
|
251
285
|
if (cause !== undefined)
|
|
@@ -328,8 +362,8 @@ export class InsufficientBalanceError extends PaymentError {
|
|
|
328
362
|
status = 402;
|
|
329
363
|
type = 'https://paymentauth.org/problems/session/insufficient-balance';
|
|
330
364
|
constructor(options = {}) {
|
|
331
|
-
const { fundingUrl, reason } = options;
|
|
332
|
-
super(withFundingUrl(reason ? `Insufficient balance: ${reason}.` : 'Insufficient balance.', fundingUrl), { fundingUrl });
|
|
365
|
+
const { cause, fundingUrl, reason } = options;
|
|
366
|
+
super(withFundingUrl(reason ? `Insufficient balance: ${reason}.` : 'Insufficient balance.', fundingUrl), { cause, fundingUrl });
|
|
333
367
|
}
|
|
334
368
|
}
|
|
335
369
|
/**
|