mppx 0.14.1 → 0.16.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 (105) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +1 -1
  3. package/dist/Expires.js +1 -1
  4. package/dist/Store.d.ts +2 -2
  5. package/dist/Store.js +13 -3
  6. package/dist/cli/cli.js +137 -131
  7. package/dist/cli/plugins/index.js +11 -11
  8. package/dist/cli/validate/payment.d.ts +12 -0
  9. package/dist/cli/validate/payment.js +113 -14
  10. package/dist/client/Mppx.d.ts +13 -3
  11. package/dist/client/Mppx.js +47 -22
  12. package/dist/client/internal/Fetch.d.ts +11 -0
  13. package/dist/client/internal/Fetch.js +46 -8
  14. package/dist/client/internal/ProofRealm.d.ts +21 -0
  15. package/dist/client/internal/ProofRealm.js +55 -0
  16. package/dist/{attestation → extensions/identity}/Constants.d.ts +2 -2
  17. package/dist/{attestation → extensions/identity}/Constants.js +2 -2
  18. package/dist/extensions/identity/Types.d.ts +21 -0
  19. package/dist/extensions/identity/index.d.ts +7 -0
  20. package/dist/extensions/identity/index.js +6 -0
  21. package/dist/{attestation → extensions/identity}/internal/HttpMessageSignature.d.ts +3 -3
  22. package/dist/{attestation → extensions/identity}/internal/HttpMessageSignature.js +12 -10
  23. package/dist/extensions/identity/internal/SigningContext.d.ts +6 -0
  24. package/dist/{attestation → extensions/identity}/internal/SigningContext.js +3 -3
  25. package/dist/extensions/identity/internal/Verification.d.ts +9 -0
  26. package/dist/extensions/identity/internal/Verification.js +10 -0
  27. package/dist/{tap → extensions/identity/tap}/Constants.js +1 -1
  28. package/dist/extensions/identity/tap/client/index.d.ts +32 -0
  29. package/dist/{tap → extensions/identity/tap}/client/index.js +13 -9
  30. package/dist/extensions/identity/tap/server/index.d.ts +27 -0
  31. package/dist/{tap → extensions/identity/tap}/server/index.js +12 -4
  32. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/Constants.js +1 -1
  33. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/client/index.d.ts +6 -5
  34. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/client/index.js +5 -5
  35. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/server/index.d.ts +6 -5
  36. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/server/index.js +6 -4
  37. package/dist/identity/Client.d.ts +34 -0
  38. package/dist/identity/Client.js +133 -0
  39. package/dist/identity/Server.d.ts +46 -0
  40. package/dist/identity/Server.js +145 -0
  41. package/dist/identity/Types.d.ts +90 -0
  42. package/dist/identity/Types.js +2 -0
  43. package/dist/{attestation → identity}/index.d.ts +2 -2
  44. package/dist/{attestation → identity}/index.js +1 -2
  45. package/dist/identity/internal/SigningContext.d.ts +6 -0
  46. package/dist/identity/internal/SigningContext.js +11 -0
  47. package/dist/integrations/x402/Evm.d.ts +2 -0
  48. package/dist/internal/version.d.ts +2 -2
  49. package/dist/internal/version.js +1 -1
  50. package/dist/mcp/client/McpClient.d.ts +5 -0
  51. package/dist/mcp/client/McpClient.js +2 -0
  52. package/dist/middlewares/express.js +18 -6
  53. package/dist/proxy/Proxy.js +10 -5
  54. package/dist/proxy/Service.d.ts +42 -4
  55. package/dist/proxy/Service.js +21 -5
  56. package/dist/server/Mppx.d.ts +32 -8
  57. package/dist/server/Mppx.js +144 -54
  58. package/dist/stripe/server/internal/html.gen.js +1 -1
  59. package/dist/tempo/Methods.d.ts +5 -0
  60. package/dist/tempo/Methods.js +1 -0
  61. package/dist/tempo/client/Subscription.d.ts +5 -0
  62. package/dist/tempo/internal/charge.js +2 -1
  63. package/dist/tempo/internal/fee-payer.d.ts +0 -2
  64. package/dist/tempo/internal/fee-payer.js +0 -4
  65. package/dist/tempo/server/Charge.js +4 -0
  66. package/dist/tempo/server/Methods.d.ts +26 -0
  67. package/dist/tempo/server/Subscription.d.ts +5 -0
  68. package/dist/tempo/server/Subscription.js +8 -5
  69. package/dist/tempo/server/internal/html.gen.js +1 -1
  70. package/dist/tempo/session/client/Runtime.d.ts +2 -0
  71. package/dist/tempo/session/client/Session.js +1 -1
  72. package/dist/tempo/session/client/SessionManager.d.ts +6 -0
  73. package/dist/tempo/session/client/SessionManager.js +14 -7
  74. package/dist/tempo/session/client/Transports.d.ts +12 -3
  75. package/dist/tempo/session/client/Transports.js +37 -11
  76. package/dist/tempo/session/precompile/Chain.js +0 -3
  77. package/dist/tempo/session/server/Ws.d.ts +5 -2
  78. package/dist/tempo/session/server/Ws.js +11 -2
  79. package/dist/tempo/subscription/Store.d.ts +7 -1
  80. package/dist/tempo/subscription/Store.js +66 -13
  81. package/dist/tempo/subscription/Types.d.ts +2 -0
  82. package/package.json +15 -11
  83. package/dist/attestation/Client.d.ts +0 -17
  84. package/dist/attestation/Client.js +0 -28
  85. package/dist/attestation/Server.d.ts +0 -4
  86. package/dist/attestation/Server.js +0 -8
  87. package/dist/attestation/Types.d.ts +0 -76
  88. package/dist/attestation/internal/SigningContext.d.ts +0 -4
  89. package/dist/tap/client/index.d.ts +0 -26
  90. package/dist/tap/server/index.d.ts +0 -20
  91. /package/dist/{attestation → extensions/identity}/Types.js +0 -0
  92. /package/dist/{tap → extensions/identity/tap}/Constants.d.ts +0 -0
  93. /package/dist/{tap → extensions/identity/tap}/Types.d.ts +0 -0
  94. /package/dist/{tap → extensions/identity/tap}/Types.js +0 -0
  95. /package/dist/{tap → extensions/identity/tap}/index.d.ts +0 -0
  96. /package/dist/{tap → extensions/identity/tap}/index.js +0 -0
  97. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/Constants.d.ts +0 -0
  98. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/Types.d.ts +0 -0
  99. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/Types.js +0 -0
  100. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/index.d.ts +0 -0
  101. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/index.js +0 -0
  102. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/internal/JwkThumbprint.d.ts +0 -0
  103. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/internal/JwkThumbprint.js +0 -0
  104. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/internal/SignatureAgent.d.ts +0 -0
  105. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/internal/SignatureAgent.js +0 -0
@@ -1,8 +0,0 @@
1
- /** Verifies every configured request-attestation protocol. */
2
- export async function verify(request, verifiers) {
3
- const outcomes = {};
4
- for (const [name, verifier] of Object.entries(verifiers))
5
- outcomes[name] = await verifier.verify(request);
6
- return outcomes;
7
- }
8
- //# sourceMappingURL=Server.js.map
@@ -1,76 +0,0 @@
1
- import type { MaybePromise } from '../internal/types.js';
2
- import type { Algorithms } from './Constants.js';
3
- /** RFC 9421 algorithms implemented by the request-attestation signer and verifier. */
4
- export type SignatureAlgorithm = (typeof Algorithms)[keyof typeof Algorithms];
5
- /** Resolves a trusted public key for a parsed request signature. */
6
- export type KeyResolver = (parameters: {
7
- /** RFC 9421 algorithm declared by the signature. */
8
- algorithm: SignatureAlgorithm;
9
- /** Key identifier declared by the signature. */
10
- keyId: string;
11
- /** Request carrying the signature. */
12
- request: Request;
13
- }) => MaybePromise<CryptoKey | undefined>;
14
- /**
15
- * The complete outcome of attempting one protocol verifier.
16
- *
17
- * `absent` means the protocol did not appear on the request. `invalid` means
18
- * it appeared but failed validation and must reject the request. `unverified`
19
- * means key material or another required verification dependency was unavailable.
20
- * `verified` carries protocol-specific data that is safe for callers to inspect.
21
- */
22
- export type Verification<value = unknown> = {
23
- status: 'absent';
24
- } | {
25
- status: 'invalid';
26
- reason: string;
27
- } | {
28
- status: 'unverified';
29
- reason: string;
30
- } | {
31
- status: 'verified';
32
- value: value;
33
- };
34
- /**
35
- * Verifies one request-attestation protocol carried by an HTTP request.
36
- *
37
- * Verifiers are registered in a {@link VerifierMap}; each map key names the
38
- * result returned to the caller.
39
- */
40
- export type Verifier<value = unknown> = {
41
- /** Validates the request and returns a complete protocol verification outcome. */
42
- verify: (request: Request) => MaybePromise<Verification<value>>;
43
- };
44
- /** Maps each recognized protocol name to its verifier. */
45
- export type VerifierMap = Readonly<Record<string, Verifier>>;
46
- /** Preserves each configured protocol's complete verification outcome. */
47
- export type VerificationsFrom<verifiers extends VerifierMap> = {
48
- readonly [protocol in keyof verifiers]: Awaited<ReturnType<verifiers[protocol]['verify']>>;
49
- };
50
- /**
51
- * Values shared by every signer contributing to one HTTP request attempt.
52
- *
53
- * A caller may reuse this context across independent signature protocols so
54
- * they describe the same attempt. A later network retry must use a new context.
55
- */
56
- export type SigningContext = {
57
- /** Unix timestamp, in seconds, at which the request attempt was created. */
58
- readonly created: number;
59
- /** Base64url-encoded random value identifying this request attempt. */
60
- readonly nonce: string;
61
- };
62
- /**
63
- * Signs each outbound HTTP request, including MPP payment retries.
64
- *
65
- * The protocol type preserves which adapter produced the signer for diagnostics
66
- * and composition, without asserting that the signer alone authorizes payment.
67
- */
68
- export type Signer<protocol extends string = string> = {
69
- /** Protocol identifier used for diagnostics. */
70
- protocol: protocol;
71
- /** Returns a new request containing the protocol's signature material. */
72
- sign: (request: Request, context?: SigningContext | undefined) => MaybePromise<Request>;
73
- };
74
- /** Maps application-defined names to request-attestation signers. */
75
- export type SignerMap = Readonly<Record<string, Signer>>;
76
- //# sourceMappingURL=Types.d.ts.map
@@ -1,4 +0,0 @@
1
- import type * as Types from '../Types.js';
2
- /** Creates the signing context for one outbound HTTP request attempt. */
3
- export declare function create(): Types.SigningContext;
4
- //# sourceMappingURL=SigningContext.d.ts.map
@@ -1,26 +0,0 @@
1
- import type * as AttestationTypes from '../../attestation/Types.js';
2
- import { Constants } from '../Constants.js';
3
- /**
4
- * Creates a TAP request signer.
5
- *
6
- * The signer emits RFC 9421 HTTP message signatures with TAP's
7
- * `agent-browser-auth` or `agent-payer-auth` tag. Pass it to
8
- * `Attestation.Client.wrapFetch` so MPPX signs both the initial request and
9
- * its automatic paid retry.
10
- */
11
- export declare function signer(config: signer.Config): AttestationTypes.Signer<typeof Constants.protocol>;
12
- export declare namespace signer {
13
- type Config = {
14
- /** TAP signature type for the request. */
15
- intent: (typeof Constants.intents)[keyof typeof Constants.intents];
16
- /** Ed25519 or RSA-PSS SHA-512 private key provisioned to the agent provider. */
17
- key: CryptoKey;
18
- /** Identifier the merchant uses to resolve the signing public key. */
19
- keyId: string;
20
- /** Signature lifetime in seconds. TAP permits at most eight minutes. @default 480 */
21
- expiresIn?: number | undefined;
22
- /** RFC 9421 dictionary label. @default 'tap' */
23
- label?: string | undefined;
24
- };
25
- }
26
- //# sourceMappingURL=index.d.ts.map
@@ -1,20 +0,0 @@
1
- import type * as Attestation from '../../attestation/Types.js';
2
- import type * as Store from '../../Store.js';
3
- import type * as Types from '../Types.js';
4
- /**
5
- * Creates a verifier for TAP agent-recognition signatures.
6
- *
7
- * TAP verifies trusted agent participation and request integrity. Consumer
8
- * recognition and payment-container verification stay protocol-specific and
9
- * are intentionally not inferred from this header-only verifier.
10
- */
11
- export declare function verifier(config: verifier.Config): Attestation.Verifier<Types.VerifiedRequest>;
12
- export declare namespace verifier {
13
- type Config = {
14
- /** Resolves a TAP-approved public key by its `keyid` and signature algorithm. */
15
- keyResolver: Attestation.KeyResolver;
16
- /** Atomically consumes each nonce in shared storage for multi-instance deployments. */
17
- nonceStore: Store.AtomicStore;
18
- };
19
- }
20
- //# sourceMappingURL=index.d.ts.map
File without changes
File without changes