mppx 0.18.1 → 0.19.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/Errors.d.ts +11 -4
  3. package/dist/Errors.js +13 -4
  4. package/dist/cli/cli.js +25 -25
  5. package/dist/cli/plugins/index.js +12 -12
  6. package/dist/extensions/identity/Types.d.ts +26 -0
  7. package/dist/extensions/identity/attestation/Token.d.ts +6 -4
  8. package/dist/extensions/identity/attestation/Token.js +11 -5
  9. package/dist/extensions/identity/index.d.ts +2 -0
  10. package/dist/extensions/identity/index.js +2 -0
  11. package/dist/extensions/identity/internal/HttpMessageSignature.d.ts +2 -2
  12. package/dist/extensions/identity/internal/HttpMessageSignature.js +13 -10
  13. package/dist/extensions/identity/{web-bot-auth/internal → internal}/JwkThumbprint.js +1 -1
  14. package/dist/extensions/identity/internal/Signer.d.ts +20 -0
  15. package/dist/extensions/identity/internal/Signer.js +94 -0
  16. package/dist/extensions/identity/tap/client/index.d.ts +6 -2
  17. package/dist/extensions/identity/tap/client/index.js +2 -0
  18. package/dist/extensions/identity/tempo/Constants.d.ts +14 -0
  19. package/dist/extensions/identity/tempo/Constants.js +14 -0
  20. package/dist/extensions/identity/tempo/Types.d.ts +31 -0
  21. package/dist/extensions/identity/tempo/Types.js +2 -0
  22. package/dist/extensions/identity/tempo/client/index.d.ts +34 -0
  23. package/dist/extensions/identity/tempo/client/index.js +60 -0
  24. package/dist/extensions/identity/tempo/index.d.ts +5 -0
  25. package/dist/extensions/identity/tempo/index.js +4 -0
  26. package/dist/extensions/identity/tempo/internal/Jwt.d.ts +36 -0
  27. package/dist/extensions/identity/tempo/internal/Jwt.js +114 -0
  28. package/dist/extensions/identity/tempo/server/index.d.ts +65 -0
  29. package/dist/extensions/identity/tempo/server/index.js +247 -0
  30. package/dist/extensions/identity/web-bot-auth/client/index.d.ts +6 -4
  31. package/dist/extensions/identity/web-bot-auth/client/index.js +7 -5
  32. package/dist/extensions/identity/web-bot-auth/server/index.js +1 -1
  33. package/dist/extensions/identity/world/Constants.d.ts +50 -0
  34. package/dist/extensions/identity/world/Constants.js +50 -0
  35. package/dist/extensions/identity/world/Types.d.ts +52 -0
  36. package/dist/extensions/identity/world/Types.js +2 -0
  37. package/dist/extensions/identity/world/client/index.d.ts +103 -0
  38. package/dist/extensions/identity/world/client/index.js +208 -0
  39. package/dist/extensions/identity/world/index.d.ts +6 -0
  40. package/dist/extensions/identity/world/index.js +5 -0
  41. package/dist/extensions/identity/world/internal/Idp.d.ts +50 -0
  42. package/dist/extensions/identity/world/internal/Idp.js +265 -0
  43. package/dist/extensions/identity/world/issuer/index.d.ts +120 -0
  44. package/dist/extensions/identity/world/issuer/index.js +520 -0
  45. package/dist/extensions/identity/world/server/index.d.ts +49 -0
  46. package/dist/extensions/identity/world/server/index.js +63 -0
  47. package/dist/identity/Headers.d.ts +1 -1
  48. package/dist/identity/Headers.js +6 -1
  49. package/dist/identity/Types.d.ts +5 -0
  50. package/dist/internal/version.d.ts +2 -2
  51. package/dist/internal/version.js +1 -1
  52. package/dist/server/Mppx.js +2 -1
  53. package/dist/tempo/client/Charge.js +32 -12
  54. package/dist/tempo/internal/zone.d.ts +27 -0
  55. package/dist/tempo/internal/zone.js +54 -7
  56. package/dist/tempo/server/internal/html.gen.js +1 -1
  57. package/package.json +9 -1
  58. /package/dist/extensions/identity/{web-bot-auth/internal → internal}/JwkThumbprint.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # mppx
2
2
 
3
+ ## 0.19.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 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.
8
+
9
+ 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.
10
+
11
+ ```diff
12
+ - WebBotAuth.Client.prover({ key: keys.privateKey, keyId, scope, signatureAgent })
13
+ + WebBotAuth.Client.prover({ key: keys, scope, signatureAgent })
14
+ - Tap.Client.prover({ key: keys.privateKey, keyId, intent, scope })
15
+ + Tap.Client.prover({ key: keys, keyId, intent, scope })
16
+ - Attestation.sign(claims, { key: keys.privateKey, keyId })
17
+ + Attestation.sign(claims, { key: keys })
18
+ ```
19
+
20
+ ### Patch Changes
21
+
22
+ - 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.
23
+ - 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.
24
+ - 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.
25
+ - 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.
26
+
3
27
  ## 0.18.1
4
28
 
5
29
  ### Patch Changes
package/dist/Errors.d.ts CHANGED
@@ -277,14 +277,19 @@ export declare namespace PaymentSimulationError {
277
277
  * before the client stopped waiting. The withdrawal cannot be undone and may still settle.
278
278
  *
279
279
  * 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.
280
+ * withdrawing again, or find the settlement with `senderTag` (or one of `senderTags`) on the Zone's portal.
281
281
  */
282
282
  export declare class ZoneSettlementPendingError extends Error {
283
283
  readonly name = "ZoneSettlementPendingError";
284
284
  /** ID of the challenge the withdrawal pays. */
285
285
  readonly challengeId: string;
286
- /** Sender tag of the withdrawal, as the portal's `WithdrawalProcessed` event carries it. */
287
- readonly senderTag: `0x${string}`;
286
+ /**
287
+ * Sender tag of the withdrawal, as the portal's `WithdrawalProcessed` event carries it.
288
+ * `undefined` when a Zone RPC hid it and more than one candidate remains: see `senderTags`.
289
+ */
290
+ readonly senderTag: `0x${string}` | undefined;
291
+ /** Sender tags the withdrawal may carry: its tag alone when known, else every candidate. */
292
+ readonly senderTags: readonly `0x${string}`[];
288
293
  /** ID of the Zone the withdrawal left. */
289
294
  readonly zoneId: number;
290
295
  constructor(options: ZoneSettlementPendingError.Options);
@@ -296,7 +301,9 @@ export declare namespace ZoneSettlementPendingError {
296
301
  /** ID of the challenge the withdrawal pays. */
297
302
  challengeId: string;
298
303
  /** Sender tag of the withdrawal. */
299
- senderTag: `0x${string}`;
304
+ senderTag?: `0x${string}` | undefined;
305
+ /** Sender tags the withdrawal may carry, when a Zone RPC hid its tag. */
306
+ senderTags?: readonly `0x${string}`[] | undefined;
300
307
  /** ID of the Zone the withdrawal left. */
301
308
  zoneId: number;
302
309
  };
package/dist/Errors.js CHANGED
@@ -231,21 +231,30 @@ export class PaymentSimulationError extends Error {
231
231
  * before the client stopped waiting. The withdrawal cannot be undone and may still settle.
232
232
  *
233
233
  * 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.
234
+ * withdrawing again, or find the settlement with `senderTag` (or one of `senderTags`) on the Zone's portal.
235
235
  */
236
236
  export class ZoneSettlementPendingError extends Error {
237
237
  name = 'ZoneSettlementPendingError';
238
238
  /** ID of the challenge the withdrawal pays. */
239
239
  challengeId;
240
- /** Sender tag of the withdrawal, as the portal's `WithdrawalProcessed` event carries it. */
240
+ /**
241
+ * Sender tag of the withdrawal, as the portal's `WithdrawalProcessed` event carries it.
242
+ * `undefined` when a Zone RPC hid it and more than one candidate remains: see `senderTags`.
243
+ */
241
244
  senderTag;
245
+ /** Sender tags the withdrawal may carry: its tag alone when known, else every candidate. */
246
+ senderTags;
242
247
  /** ID of the Zone the withdrawal left. */
243
248
  zoneId;
244
249
  constructor(options) {
245
- const { cause, challengeId, senderTag, zoneId } = options;
246
- super(`Zone ${zoneId} withdrawal ${senderTag} for challenge "${challengeId}" has not settled on Tempo yet. Retry the challenge to resume waiting instead of paying again.`);
250
+ const { cause, challengeId, zoneId } = options;
251
+ const senderTags = options.senderTags ?? (options.senderTag ? [options.senderTag] : []);
252
+ const senderTag = senderTags.length === 1 ? senderTags[0] : undefined;
253
+ const withdrawal = senderTag ?? `with sender tag ${senderTags.join(' or ')}`;
254
+ 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
255
  this.challengeId = challengeId;
248
256
  this.senderTag = senderTag;
257
+ this.senderTags = senderTags;
249
258
  this.zoneId = zoneId;
250
259
  // Defined manually (non-enumerable, like native `cause`) so consumers on pre-ES2022 libs still typecheck.
251
260
  if (cause !== undefined)