@seedhape/core 0.1.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 (133) hide show
  1. package/dist/__tests__/acp.test.d.ts +2 -0
  2. package/dist/__tests__/acp.test.d.ts.map +1 -0
  3. package/dist/__tests__/acp.test.js +16 -0
  4. package/dist/__tests__/acp.test.js.map +1 -0
  5. package/dist/__tests__/ap2-official.test.d.ts +2 -0
  6. package/dist/__tests__/ap2-official.test.d.ts.map +1 -0
  7. package/dist/__tests__/ap2-official.test.js +49 -0
  8. package/dist/__tests__/ap2-official.test.js.map +1 -0
  9. package/dist/__tests__/mpp.test.d.ts +2 -0
  10. package/dist/__tests__/mpp.test.d.ts.map +1 -0
  11. package/dist/__tests__/mpp.test.js +42 -0
  12. package/dist/__tests__/mpp.test.js.map +1 -0
  13. package/dist/__tests__/outbound.test.d.ts +2 -0
  14. package/dist/__tests__/outbound.test.d.ts.map +1 -0
  15. package/dist/__tests__/outbound.test.js +23 -0
  16. package/dist/__tests__/outbound.test.js.map +1 -0
  17. package/dist/__tests__/protocols.test.d.ts +2 -0
  18. package/dist/__tests__/protocols.test.d.ts.map +1 -0
  19. package/dist/__tests__/protocols.test.js +16 -0
  20. package/dist/__tests__/protocols.test.js.map +1 -0
  21. package/dist/__tests__/providers.test.d.ts +2 -0
  22. package/dist/__tests__/providers.test.d.ts.map +1 -0
  23. package/dist/__tests__/providers.test.js +41 -0
  24. package/dist/__tests__/providers.test.js.map +1 -0
  25. package/dist/__tests__/reconciliation.test.d.ts +2 -0
  26. package/dist/__tests__/reconciliation.test.d.ts.map +1 -0
  27. package/dist/__tests__/reconciliation.test.js +35 -0
  28. package/dist/__tests__/reconciliation.test.js.map +1 -0
  29. package/dist/__tests__/spending-controls.test.d.ts +2 -0
  30. package/dist/__tests__/spending-controls.test.d.ts.map +1 -0
  31. package/dist/__tests__/spending-controls.test.js +47 -0
  32. package/dist/__tests__/spending-controls.test.js.map +1 -0
  33. package/dist/__tests__/tax-and-policy.test.d.ts +7 -0
  34. package/dist/__tests__/tax-and-policy.test.d.ts.map +1 -0
  35. package/dist/__tests__/tax-and-policy.test.js +389 -0
  36. package/dist/__tests__/tax-and-policy.test.js.map +1 -0
  37. package/dist/__tests__/web-bot-auth.test.d.ts +2 -0
  38. package/dist/__tests__/web-bot-auth.test.d.ts.map +1 -0
  39. package/dist/__tests__/web-bot-auth.test.js +33 -0
  40. package/dist/__tests__/web-bot-auth.test.js.map +1 -0
  41. package/dist/__tests__/x402-solana.test.d.ts +2 -0
  42. package/dist/__tests__/x402-solana.test.d.ts.map +1 -0
  43. package/dist/__tests__/x402-solana.test.js +155 -0
  44. package/dist/__tests__/x402-solana.test.js.map +1 -0
  45. package/dist/acp.d.ts +28 -0
  46. package/dist/acp.d.ts.map +1 -0
  47. package/dist/acp.js +49 -0
  48. package/dist/acp.js.map +1 -0
  49. package/dist/ap2/mandates.d.ts +319 -0
  50. package/dist/ap2/mandates.d.ts.map +1 -0
  51. package/dist/ap2/mandates.js +214 -0
  52. package/dist/ap2/mandates.js.map +1 -0
  53. package/dist/ap2/official.d.ts +156 -0
  54. package/dist/ap2/official.d.ts.map +1 -0
  55. package/dist/ap2/official.js +222 -0
  56. package/dist/ap2/official.js.map +1 -0
  57. package/dist/ap2/policy.d.ts +93 -0
  58. package/dist/ap2/policy.d.ts.map +1 -0
  59. package/dist/ap2/policy.js +216 -0
  60. package/dist/ap2/policy.js.map +1 -0
  61. package/dist/index.d.ts +22 -0
  62. package/dist/index.d.ts.map +1 -0
  63. package/dist/index.js +22 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/india/fx.d.ts +59 -0
  66. package/dist/india/fx.d.ts.map +1 -0
  67. package/dist/india/fx.js +93 -0
  68. package/dist/india/fx.js.map +1 -0
  69. package/dist/india/vda-tax.d.ts +151 -0
  70. package/dist/india/vda-tax.d.ts.map +1 -0
  71. package/dist/india/vda-tax.js +226 -0
  72. package/dist/india/vda-tax.js.map +1 -0
  73. package/dist/mandate-builder.d.ts +102 -0
  74. package/dist/mandate-builder.d.ts.map +1 -0
  75. package/dist/mandate-builder.js +99 -0
  76. package/dist/mandate-builder.js.map +1 -0
  77. package/dist/mpp.d.ts +53 -0
  78. package/dist/mpp.d.ts.map +1 -0
  79. package/dist/mpp.js +164 -0
  80. package/dist/mpp.js.map +1 -0
  81. package/dist/orchestrator.d.ts +115 -0
  82. package/dist/orchestrator.d.ts.map +1 -0
  83. package/dist/orchestrator.js +351 -0
  84. package/dist/orchestrator.js.map +1 -0
  85. package/dist/postgres-store.d.ts +60 -0
  86. package/dist/postgres-store.d.ts.map +1 -0
  87. package/dist/postgres-store.js +441 -0
  88. package/dist/postgres-store.js.map +1 -0
  89. package/dist/protocols.d.ts +18 -0
  90. package/dist/protocols.d.ts.map +1 -0
  91. package/dist/protocols.js +24 -0
  92. package/dist/protocols.js.map +1 -0
  93. package/dist/reconciliation.d.ts +27 -0
  94. package/dist/reconciliation.d.ts.map +1 -0
  95. package/dist/reconciliation.js +38 -0
  96. package/dist/reconciliation.js.map +1 -0
  97. package/dist/store.d.ts +110 -0
  98. package/dist/store.d.ts.map +1 -0
  99. package/dist/store.js +369 -0
  100. package/dist/store.js.map +1 -0
  101. package/dist/types.d.ts +195 -0
  102. package/dist/types.d.ts.map +1 -0
  103. package/dist/types.js +30 -0
  104. package/dist/types.js.map +1 -0
  105. package/dist/util/canonical.d.ts +9 -0
  106. package/dist/util/canonical.d.ts.map +1 -0
  107. package/dist/util/canonical.js +35 -0
  108. package/dist/util/canonical.js.map +1 -0
  109. package/dist/wallet/provider.d.ts +118 -0
  110. package/dist/wallet/provider.d.ts.map +1 -0
  111. package/dist/wallet/provider.js +160 -0
  112. package/dist/wallet/provider.js.map +1 -0
  113. package/dist/wallet/providers.d.ts +107 -0
  114. package/dist/wallet/providers.d.ts.map +1 -0
  115. package/dist/wallet/providers.js +188 -0
  116. package/dist/wallet/providers.js.map +1 -0
  117. package/dist/web-bot-auth.d.ts +54 -0
  118. package/dist/web-bot-auth.d.ts.map +1 -0
  119. package/dist/web-bot-auth.js +112 -0
  120. package/dist/web-bot-auth.js.map +1 -0
  121. package/dist/x402/client.d.ts +101 -0
  122. package/dist/x402/client.d.ts.map +1 -0
  123. package/dist/x402/client.js +291 -0
  124. package/dist/x402/client.js.map +1 -0
  125. package/dist/x402/outbound.d.ts +15 -0
  126. package/dist/x402/outbound.d.ts.map +1 -0
  127. package/dist/x402/outbound.js +59 -0
  128. package/dist/x402/outbound.js.map +1 -0
  129. package/dist/x402/types.d.ts +80 -0
  130. package/dist/x402/types.d.ts.map +1 -0
  131. package/dist/x402/types.js +2 -0
  132. package/dist/x402/types.js.map +1 -0
  133. package/package.json +29 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x402-solana.test.js","sourceRoot":"","sources":["../../src/__tests__/x402-solana.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAErE,MAAM,cAAc,GAAG,yCAAyC,CAAC;AACjE,MAAM,WAAW,GAAG,8CAA8C,CAAC;AAEnE,IAAI,CAAC,kEAAkE,EAAE,KAAK,IAAI,EAAE;IAClF,MAAM,SAAS,GAAG;QAChB,WAAW,EAAE,CAAC;QACd,QAAQ,EAAE;YACR,GAAG,EAAE,4BAA4B;YACjC,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,kBAAkB;SAC7B;QACD,OAAO,EAAE,CAAC;gBACR,MAAM,EAAE,OAAO;gBACf,OAAO,EAAE,cAAc;gBACvB,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,WAAW;gBAClB,KAAK,EAAE,8CAA8C;gBACrD,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E;iBAC5F,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC1D,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;QACrE,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,QAAoC,CAAA,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACvF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,OAAmC,CAAA,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC7F,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACxG,CAAC;AACH,CAAC,CAAC,CAAC"}
package/dist/acp.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ /** Versioned, protocol-specific ACP checkout contracts.
2
+ *
3
+ * These types validate the boundary only. Completing an ACP checkout still
4
+ * requires an authenticated merchant adapter, durable session state, payment
5
+ * authorization, and the shared order/fulfillment service.
6
+ */
7
+ export declare const ACP_VERSION = "2026-04-17";
8
+ export type AcpCheckoutItem = {
9
+ id: string;
10
+ quantity: number;
11
+ };
12
+ export type AcpCreateCheckoutRequest = {
13
+ items: AcpCheckoutItem[];
14
+ buyer?: Record<string, unknown>;
15
+ fulfillment_address?: Record<string, unknown>;
16
+ };
17
+ export type AcpRequestContext = {
18
+ authorization: string;
19
+ idempotencyKey: string;
20
+ requestId?: string;
21
+ timestamp: string;
22
+ apiVersion: string;
23
+ };
24
+ /** Validate and copy the ACP create-session payload before any side effect. */
25
+ export declare function validateAcpCreateCheckout(input: unknown): AcpCreateCheckoutRequest;
26
+ /** Require the common ACP request headers used for idempotent seller calls. */
27
+ export declare function validateAcpRequestContext(headers: Headers | Record<string, string | undefined>): AcpRequestContext;
28
+ //# sourceMappingURL=acp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acp.d.ts","sourceRoot":"","sources":["../src/acp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,WAAW,eAAe,CAAC;AAExC,MAAM,MAAM,eAAe,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/D,MAAM,MAAM,wBAAwB,GAAG;IAAE,KAAK,EAAE,eAAe,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC;AACpJ,MAAM,MAAM,iBAAiB,GAAG;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAO7I,+EAA+E;AAC/E,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAclF;AAED,+EAA+E;AAC/E,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,iBAAiB,CAWlH"}
package/dist/acp.js ADDED
@@ -0,0 +1,49 @@
1
+ /** Versioned, protocol-specific ACP checkout contracts.
2
+ *
3
+ * These types validate the boundary only. Completing an ACP checkout still
4
+ * requires an authenticated merchant adapter, durable session state, payment
5
+ * authorization, and the shared order/fulfillment service.
6
+ */
7
+ export const ACP_VERSION = "2026-04-17";
8
+ function object(value, label) {
9
+ if (!value || typeof value !== "object" || Array.isArray(value))
10
+ throw new Error(`${label} must be an object.`);
11
+ return value;
12
+ }
13
+ /** Validate and copy the ACP create-session payload before any side effect. */
14
+ export function validateAcpCreateCheckout(input) {
15
+ const body = object(input, "ACP checkout request");
16
+ if (!Array.isArray(body.items) || body.items.length === 0)
17
+ throw new Error("ACP checkout items must be a non-empty array.");
18
+ const items = body.items.map((item, index) => {
19
+ const value = object(item, `ACP checkout item ${index}`);
20
+ if (typeof value.id !== "string" || value.id.trim().length === 0 || value.id.length > 256)
21
+ throw new Error(`ACP checkout item ${index} has an invalid id.`);
22
+ if (!Number.isSafeInteger(value.quantity) || value.quantity <= 0)
23
+ throw new Error(`ACP checkout item ${index} quantity must be a positive integer.`);
24
+ return { id: value.id, quantity: value.quantity };
25
+ });
26
+ return {
27
+ items,
28
+ ...(body.buyer === undefined ? {} : { buyer: object(body.buyer, "ACP buyer") }),
29
+ ...(body.fulfillment_address === undefined ? {} : { fulfillment_address: object(body.fulfillment_address, "ACP fulfillment_address") }),
30
+ };
31
+ }
32
+ /** Require the common ACP request headers used for idempotent seller calls. */
33
+ export function validateAcpRequestContext(headers) {
34
+ const read = (name) => headers instanceof Headers ? headers.get(name) ?? undefined : headers[name] ?? headers[name.toLowerCase()];
35
+ const authorization = read("Authorization");
36
+ const idempotencyKey = read("Idempotency-Key");
37
+ const timestamp = read("Timestamp");
38
+ const apiVersion = read("API-Version");
39
+ if (!authorization?.startsWith("Bearer ") || authorization.length <= 7)
40
+ throw new Error("ACP Authorization bearer token is required.");
41
+ if (!idempotencyKey || idempotencyKey.length > 256)
42
+ throw new Error("ACP Idempotency-Key is required.");
43
+ if (!timestamp || Number.isNaN(Date.parse(timestamp)))
44
+ throw new Error("ACP Timestamp must be RFC 3339.");
45
+ if (!apiVersion)
46
+ throw new Error("ACP API-Version is required.");
47
+ return { authorization, idempotencyKey, ...(read("Request-Id") ? { requestId: read("Request-Id") } : {}), timestamp, apiVersion };
48
+ }
49
+ //# sourceMappingURL=acp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acp.js","sourceRoot":"","sources":["../src/acp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AAMxC,SAAS,MAAM,CAAC,KAAc,EAAE,KAAa;IAC3C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,qBAAqB,CAAC,CAAC;IAChH,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACtD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC;IACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAC5H,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,qBAAqB,KAAK,EAAE,CAAC,CAAC;QACzD,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,KAAK,qBAAqB,CAAC,CAAC;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AAU,CAAC,SAAS,CAAC,IAAI,aAAa,CAAC,MAAM,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACvI,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,MAAM,GAAG,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACxG,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC1G,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACjE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AACpI,CAAC"}
@@ -0,0 +1,319 @@
1
+ /**
2
+ * AP2 mandates expressed as EIP-712 typed data.
3
+ *
4
+ * Why EIP-712 rather than the reference W3C Verifiable Credential encoding:
5
+ * 1. The user can sign an Intent Mandate in any wallet they already own,
6
+ * with a readable prompt, no new key material and no VC tooling.
7
+ * 2. The same hash is verifiable on-chain, so an Intent Mandate can later be
8
+ * registered against a spend-permission contract without re-signing.
9
+ * 3. It composes with EIP-3009 / EIP-1271, which is what x402 settlement uses.
10
+ *
11
+ * The JSON-LD VC form is produced on export (see `toVerifiableCredential`) so
12
+ * the audit trail stays interoperable with AP2 verifiers that expect VCs.
13
+ */
14
+ import { type TypedDataDomain } from "viem";
15
+ import type { Address, CartMandate, Hex, IntentMandate, PaymentMandate, SignedCartMandate, SignedIntentMandate, SignedPaymentMandate } from "../types.js";
16
+ export declare const AP2_DOMAIN_NAME = "Seedhape-AP2";
17
+ export declare const AP2_DOMAIN_VERSION = "1";
18
+ export declare const INTENT_TYPES: {
19
+ readonly IntentMandate: readonly [{
20
+ readonly name: "subject";
21
+ readonly type: "address";
22
+ }, {
23
+ readonly name: "agent";
24
+ readonly type: "address";
25
+ }, {
26
+ readonly name: "purpose";
27
+ readonly type: "string";
28
+ }, {
29
+ readonly name: "maxPerTransaction";
30
+ readonly type: "uint256";
31
+ }, {
32
+ readonly name: "maxPerPeriod";
33
+ readonly type: "uint256";
34
+ }, {
35
+ readonly name: "periodSeconds";
36
+ readonly type: "uint64";
37
+ }, {
38
+ readonly name: "maxTxPerPeriod";
39
+ readonly type: "uint32";
40
+ }, {
41
+ readonly name: "allowedPayToRoot";
42
+ readonly type: "bytes32";
43
+ }, {
44
+ readonly name: "allowedHostsRoot";
45
+ readonly type: "bytes32";
46
+ }, {
47
+ readonly name: "asset";
48
+ readonly type: "address";
49
+ }, {
50
+ readonly name: "notBefore";
51
+ readonly type: "uint64";
52
+ }, {
53
+ readonly name: "expiry";
54
+ readonly type: "uint64";
55
+ }, {
56
+ readonly name: "nonce";
57
+ readonly type: "bytes32";
58
+ }];
59
+ };
60
+ export declare const CART_TYPES: {
61
+ readonly CartMandate: readonly [{
62
+ readonly name: "intentHash";
63
+ readonly type: "bytes32";
64
+ }, {
65
+ readonly name: "payTo";
66
+ readonly type: "address";
67
+ }, {
68
+ readonly name: "resourceHash";
69
+ readonly type: "bytes32";
70
+ }, {
71
+ readonly name: "descriptionHash";
72
+ readonly type: "bytes32";
73
+ }, {
74
+ readonly name: "amount";
75
+ readonly type: "uint256";
76
+ }, {
77
+ readonly name: "asset";
78
+ readonly type: "address";
79
+ }, {
80
+ readonly name: "quotedAt";
81
+ readonly type: "uint64";
82
+ }, {
83
+ readonly name: "expiry";
84
+ readonly type: "uint64";
85
+ }, {
86
+ readonly name: "nonce";
87
+ readonly type: "bytes32";
88
+ }];
89
+ };
90
+ export declare const PAYMENT_TYPES: {
91
+ readonly PaymentMandate: readonly [{
92
+ readonly name: "intentHash";
93
+ readonly type: "bytes32";
94
+ }, {
95
+ readonly name: "cartHash";
96
+ readonly type: "bytes32";
97
+ }, {
98
+ readonly name: "payTo";
99
+ readonly type: "address";
100
+ }, {
101
+ readonly name: "amount";
102
+ readonly type: "uint256";
103
+ }, {
104
+ readonly name: "asset";
105
+ readonly type: "address";
106
+ }, {
107
+ readonly name: "payloadHash";
108
+ readonly type: "bytes32";
109
+ }, {
110
+ readonly name: "createdAt";
111
+ readonly type: "uint64";
112
+ }, {
113
+ readonly name: "nonce";
114
+ readonly type: "bytes32";
115
+ }];
116
+ };
117
+ /**
118
+ * Commit to a list without putting an unbounded array in the typed data.
119
+ * An empty list commits to bytes32(0), which the policy engine reads as
120
+ * "unrestricted". The full list travels alongside the signature and is checked
121
+ * against this root before use.
122
+ */
123
+ export declare function listRoot(items: string[]): Hex;
124
+ export declare function intentMessage(m: IntentMandate): {
125
+ subject: `0x${string}`;
126
+ agent: `0x${string}`;
127
+ purpose: string;
128
+ maxPerTransaction: bigint;
129
+ maxPerPeriod: bigint;
130
+ periodSeconds: bigint;
131
+ maxTxPerPeriod: number;
132
+ allowedPayToRoot: `0x${string}`;
133
+ allowedHostsRoot: `0x${string}`;
134
+ asset: `0x${string}`;
135
+ notBefore: bigint;
136
+ expiry: bigint;
137
+ nonce: `0x${string}`;
138
+ };
139
+ export declare function hashIntentMandate(m: IntentMandate): Hex;
140
+ /** Typed-data bundle to hand to a wallet for signature. */
141
+ export declare function intentTypedData(m: IntentMandate): {
142
+ domain: TypedDataDomain;
143
+ types: {
144
+ readonly IntentMandate: readonly [{
145
+ readonly name: "subject";
146
+ readonly type: "address";
147
+ }, {
148
+ readonly name: "agent";
149
+ readonly type: "address";
150
+ }, {
151
+ readonly name: "purpose";
152
+ readonly type: "string";
153
+ }, {
154
+ readonly name: "maxPerTransaction";
155
+ readonly type: "uint256";
156
+ }, {
157
+ readonly name: "maxPerPeriod";
158
+ readonly type: "uint256";
159
+ }, {
160
+ readonly name: "periodSeconds";
161
+ readonly type: "uint64";
162
+ }, {
163
+ readonly name: "maxTxPerPeriod";
164
+ readonly type: "uint32";
165
+ }, {
166
+ readonly name: "allowedPayToRoot";
167
+ readonly type: "bytes32";
168
+ }, {
169
+ readonly name: "allowedHostsRoot";
170
+ readonly type: "bytes32";
171
+ }, {
172
+ readonly name: "asset";
173
+ readonly type: "address";
174
+ }, {
175
+ readonly name: "notBefore";
176
+ readonly type: "uint64";
177
+ }, {
178
+ readonly name: "expiry";
179
+ readonly type: "uint64";
180
+ }, {
181
+ readonly name: "nonce";
182
+ readonly type: "bytes32";
183
+ }];
184
+ };
185
+ primaryType: "IntentMandate";
186
+ message: {
187
+ subject: `0x${string}`;
188
+ agent: `0x${string}`;
189
+ purpose: string;
190
+ maxPerTransaction: bigint;
191
+ maxPerPeriod: bigint;
192
+ periodSeconds: bigint;
193
+ maxTxPerPeriod: number;
194
+ allowedPayToRoot: `0x${string}`;
195
+ allowedHostsRoot: `0x${string}`;
196
+ asset: `0x${string}`;
197
+ notBefore: bigint;
198
+ expiry: bigint;
199
+ nonce: `0x${string}`;
200
+ };
201
+ };
202
+ export declare function verifyIntentMandate(signed: SignedIntentMandate): Promise<boolean>;
203
+ export declare function cartTypedData(m: CartMandate): {
204
+ domain: TypedDataDomain;
205
+ types: {
206
+ readonly CartMandate: readonly [{
207
+ readonly name: "intentHash";
208
+ readonly type: "bytes32";
209
+ }, {
210
+ readonly name: "payTo";
211
+ readonly type: "address";
212
+ }, {
213
+ readonly name: "resourceHash";
214
+ readonly type: "bytes32";
215
+ }, {
216
+ readonly name: "descriptionHash";
217
+ readonly type: "bytes32";
218
+ }, {
219
+ readonly name: "amount";
220
+ readonly type: "uint256";
221
+ }, {
222
+ readonly name: "asset";
223
+ readonly type: "address";
224
+ }, {
225
+ readonly name: "quotedAt";
226
+ readonly type: "uint64";
227
+ }, {
228
+ readonly name: "expiry";
229
+ readonly type: "uint64";
230
+ }, {
231
+ readonly name: "nonce";
232
+ readonly type: "bytes32";
233
+ }];
234
+ };
235
+ primaryType: "CartMandate";
236
+ message: {
237
+ intentHash: `0x${string}`;
238
+ payTo: `0x${string}`;
239
+ resourceHash: `0x${string}`;
240
+ descriptionHash: `0x${string}`;
241
+ amount: bigint;
242
+ asset: `0x${string}`;
243
+ quotedAt: bigint;
244
+ expiry: bigint;
245
+ nonce: `0x${string}`;
246
+ };
247
+ };
248
+ export declare function hashCartMandate(m: CartMandate): Hex;
249
+ export declare function verifyCartMandate(signed: SignedCartMandate, expectedSigner: Address): Promise<boolean>;
250
+ export declare function paymentTypedData(m: PaymentMandate): {
251
+ domain: TypedDataDomain;
252
+ types: {
253
+ readonly PaymentMandate: readonly [{
254
+ readonly name: "intentHash";
255
+ readonly type: "bytes32";
256
+ }, {
257
+ readonly name: "cartHash";
258
+ readonly type: "bytes32";
259
+ }, {
260
+ readonly name: "payTo";
261
+ readonly type: "address";
262
+ }, {
263
+ readonly name: "amount";
264
+ readonly type: "uint256";
265
+ }, {
266
+ readonly name: "asset";
267
+ readonly type: "address";
268
+ }, {
269
+ readonly name: "payloadHash";
270
+ readonly type: "bytes32";
271
+ }, {
272
+ readonly name: "createdAt";
273
+ readonly type: "uint64";
274
+ }, {
275
+ readonly name: "nonce";
276
+ readonly type: "bytes32";
277
+ }];
278
+ };
279
+ primaryType: "PaymentMandate";
280
+ message: {
281
+ intentHash: `0x${string}`;
282
+ cartHash: `0x${string}`;
283
+ payTo: `0x${string}`;
284
+ amount: bigint;
285
+ asset: `0x${string}`;
286
+ payloadHash: `0x${string}`;
287
+ createdAt: bigint;
288
+ nonce: `0x${string}`;
289
+ };
290
+ };
291
+ export declare function hashPaymentMandate(m: PaymentMandate): Hex;
292
+ /** Bind a payment mandate to the exact bytes that will be sent to the merchant. */
293
+ export declare function payloadHash(payload: unknown): Hex;
294
+ /**
295
+ * Render a signed mandate chain as a W3C Verifiable Credential envelope so it
296
+ * can be handed to AP2 verifiers, dispute processes, or archived for audit.
297
+ * We do not claim VC-JWT conformance here — this is the data-model form with
298
+ * an EthereumEip712Signature2021-style proof.
299
+ */
300
+ export declare function toVerifiableCredential(signed: SignedIntentMandate | SignedCartMandate | SignedPaymentMandate, kind: "IntentMandate" | "CartMandate" | "PaymentMandate", issuer: string): {
301
+ "@context": string[];
302
+ type: string[];
303
+ issuer: string;
304
+ issuanceDate: string;
305
+ credentialSubject: any;
306
+ proof: {
307
+ type: string;
308
+ proofPurpose: string;
309
+ created: string;
310
+ eip712Domain: {
311
+ name: string;
312
+ version: string;
313
+ primaryType: "IntentMandate" | "CartMandate" | "PaymentMandate";
314
+ };
315
+ typedDataHash: `0x${string}`;
316
+ proofValue: `0x${string}`;
317
+ };
318
+ };
319
+ //# sourceMappingURL=mandates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mandates.d.ts","sourceRoot":"","sources":["../../src/ap2/mandates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,GAAG,EACH,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAGrB,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAC9C,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAQtC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBf,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYb,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;CAWhB,CAAC;AAOX;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,GAAG,CAI7C;AAQD,wBAAgB,aAAa,CAAC,CAAC,EAAE,aAAa;;;;;;;;;;;;;;EAgB7C;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,aAAa,GAAG,GAAG,CAOvD;AAED,2DAA2D;AAC3D,wBAAgB,eAAe,CAAC,CAAC,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO/C;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,OAAO,CAAC,CAQlB;AAID,wBAAgB,aAAa,CAAC,CAAC,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB3C;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,WAAW,GAAG,GAAG,CAEnD;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,iBAAiB,EACzB,cAAc,EAAE,OAAO,GACtB,OAAO,CAAC,OAAO,CAAC,CAOlB;AAID,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBjD;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,cAAc,GAAG,GAAG,CAEzD;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAEjD;AAID;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,mBAAmB,GAAG,iBAAiB,GAAG,oBAAoB,EACtE,IAAI,EAAE,eAAe,GAAG,aAAa,GAAG,gBAAgB,EACxD,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;EA6Bf"}
@@ -0,0 +1,214 @@
1
+ /**
2
+ * AP2 mandates expressed as EIP-712 typed data.
3
+ *
4
+ * Why EIP-712 rather than the reference W3C Verifiable Credential encoding:
5
+ * 1. The user can sign an Intent Mandate in any wallet they already own,
6
+ * with a readable prompt, no new key material and no VC tooling.
7
+ * 2. The same hash is verifiable on-chain, so an Intent Mandate can later be
8
+ * registered against a spend-permission contract without re-signing.
9
+ * 3. It composes with EIP-3009 / EIP-1271, which is what x402 settlement uses.
10
+ *
11
+ * The JSON-LD VC form is produced on export (see `toVerifiableCredential`) so
12
+ * the audit trail stays interoperable with AP2 verifiers that expect VCs.
13
+ */
14
+ import { hashTypedData, recoverTypedDataAddress, keccak256, toHex, } from "viem";
15
+ import { canonicalJson } from "../util/canonical.js";
16
+ export const AP2_DOMAIN_NAME = "Seedhape-AP2";
17
+ export const AP2_DOMAIN_VERSION = "1";
18
+ function domain(chainId) {
19
+ return { name: AP2_DOMAIN_NAME, version: AP2_DOMAIN_VERSION, chainId };
20
+ }
21
+ // --- Typed data definitions ------------------------------------------------
22
+ export const INTENT_TYPES = {
23
+ IntentMandate: [
24
+ { name: "subject", type: "address" },
25
+ { name: "agent", type: "address" },
26
+ { name: "purpose", type: "string" },
27
+ { name: "maxPerTransaction", type: "uint256" },
28
+ { name: "maxPerPeriod", type: "uint256" },
29
+ { name: "periodSeconds", type: "uint64" },
30
+ { name: "maxTxPerPeriod", type: "uint32" },
31
+ { name: "allowedPayToRoot", type: "bytes32" },
32
+ { name: "allowedHostsRoot", type: "bytes32" },
33
+ { name: "asset", type: "address" },
34
+ { name: "notBefore", type: "uint64" },
35
+ { name: "expiry", type: "uint64" },
36
+ { name: "nonce", type: "bytes32" },
37
+ ],
38
+ };
39
+ export const CART_TYPES = {
40
+ CartMandate: [
41
+ { name: "intentHash", type: "bytes32" },
42
+ { name: "payTo", type: "address" },
43
+ { name: "resourceHash", type: "bytes32" },
44
+ { name: "descriptionHash", type: "bytes32" },
45
+ { name: "amount", type: "uint256" },
46
+ { name: "asset", type: "address" },
47
+ { name: "quotedAt", type: "uint64" },
48
+ { name: "expiry", type: "uint64" },
49
+ { name: "nonce", type: "bytes32" },
50
+ ],
51
+ };
52
+ export const PAYMENT_TYPES = {
53
+ PaymentMandate: [
54
+ { name: "intentHash", type: "bytes32" },
55
+ { name: "cartHash", type: "bytes32" },
56
+ { name: "payTo", type: "address" },
57
+ { name: "amount", type: "uint256" },
58
+ { name: "asset", type: "address" },
59
+ { name: "payloadHash", type: "bytes32" },
60
+ { name: "createdAt", type: "uint64" },
61
+ { name: "nonce", type: "bytes32" },
62
+ ],
63
+ };
64
+ // --- Helpers ---------------------------------------------------------------
65
+ const ZERO_ROOT = "0x0000000000000000000000000000000000000000000000000000000000000000";
66
+ /**
67
+ * Commit to a list without putting an unbounded array in the typed data.
68
+ * An empty list commits to bytes32(0), which the policy engine reads as
69
+ * "unrestricted". The full list travels alongside the signature and is checked
70
+ * against this root before use.
71
+ */
72
+ export function listRoot(items) {
73
+ if (items.length === 0)
74
+ return ZERO_ROOT;
75
+ const normalised = items.map((i) => i.trim().toLowerCase()).sort();
76
+ return keccak256(toHex(JSON.stringify(normalised)));
77
+ }
78
+ function strHash(s) {
79
+ return keccak256(toHex(s));
80
+ }
81
+ // --- Intent ----------------------------------------------------------------
82
+ export function intentMessage(m) {
83
+ return {
84
+ subject: m.subject,
85
+ agent: m.agent,
86
+ purpose: m.purpose,
87
+ maxPerTransaction: m.maxPerTransaction,
88
+ maxPerPeriod: m.maxPerPeriod,
89
+ periodSeconds: BigInt(m.periodSeconds),
90
+ maxTxPerPeriod: m.maxTxPerPeriod,
91
+ allowedPayToRoot: listRoot(m.allowedPayTo),
92
+ allowedHostsRoot: listRoot(m.allowedHosts),
93
+ asset: m.asset.address,
94
+ notBefore: BigInt(m.notBefore),
95
+ expiry: BigInt(m.expiry),
96
+ nonce: m.nonce,
97
+ };
98
+ }
99
+ export function hashIntentMandate(m) {
100
+ return hashTypedData({
101
+ domain: domain(m.chainId),
102
+ types: INTENT_TYPES,
103
+ primaryType: "IntentMandate",
104
+ message: intentMessage(m),
105
+ });
106
+ }
107
+ /** Typed-data bundle to hand to a wallet for signature. */
108
+ export function intentTypedData(m) {
109
+ return {
110
+ domain: domain(m.chainId),
111
+ types: INTENT_TYPES,
112
+ primaryType: "IntentMandate",
113
+ message: intentMessage(m),
114
+ };
115
+ }
116
+ export async function verifyIntentMandate(signed) {
117
+ const { mandate, signature } = signed;
118
+ if (hashIntentMandate(mandate) !== signed.hash)
119
+ return false;
120
+ const recovered = await recoverTypedDataAddress({
121
+ ...intentTypedData(mandate),
122
+ signature,
123
+ });
124
+ return recovered.toLowerCase() === mandate.subject.toLowerCase();
125
+ }
126
+ // --- Cart ------------------------------------------------------------------
127
+ export function cartTypedData(m) {
128
+ return {
129
+ domain: domain(m.chainId),
130
+ types: CART_TYPES,
131
+ primaryType: "CartMandate",
132
+ message: {
133
+ intentHash: m.intentHash,
134
+ payTo: m.payTo,
135
+ resourceHash: strHash(m.resource),
136
+ descriptionHash: strHash(m.description),
137
+ amount: m.amount,
138
+ asset: m.asset.address,
139
+ quotedAt: BigInt(m.quotedAt),
140
+ expiry: BigInt(m.expiry),
141
+ nonce: m.nonce,
142
+ },
143
+ };
144
+ }
145
+ export function hashCartMandate(m) {
146
+ return hashTypedData(cartTypedData(m));
147
+ }
148
+ export async function verifyCartMandate(signed, expectedSigner) {
149
+ if (hashCartMandate(signed.mandate) !== signed.hash)
150
+ return false;
151
+ const recovered = await recoverTypedDataAddress({
152
+ ...cartTypedData(signed.mandate),
153
+ signature: signed.signature,
154
+ });
155
+ return recovered.toLowerCase() === expectedSigner.toLowerCase();
156
+ }
157
+ // --- Payment ---------------------------------------------------------------
158
+ export function paymentTypedData(m) {
159
+ return {
160
+ domain: domain(m.chainId),
161
+ types: PAYMENT_TYPES,
162
+ primaryType: "PaymentMandate",
163
+ message: {
164
+ intentHash: m.intentHash,
165
+ cartHash: m.cartHash,
166
+ payTo: m.payTo,
167
+ amount: m.amount,
168
+ asset: m.asset.address,
169
+ payloadHash: m.payloadHash,
170
+ createdAt: BigInt(m.createdAt),
171
+ nonce: m.nonce,
172
+ },
173
+ };
174
+ }
175
+ export function hashPaymentMandate(m) {
176
+ return hashTypedData(paymentTypedData(m));
177
+ }
178
+ /** Bind a payment mandate to the exact bytes that will be sent to the merchant. */
179
+ export function payloadHash(payload) {
180
+ return keccak256(toHex(canonicalJson(payload)));
181
+ }
182
+ // --- AP2 interop export ----------------------------------------------------
183
+ /**
184
+ * Render a signed mandate chain as a W3C Verifiable Credential envelope so it
185
+ * can be handed to AP2 verifiers, dispute processes, or archived for audit.
186
+ * We do not claim VC-JWT conformance here — this is the data-model form with
187
+ * an EthereumEip712Signature2021-style proof.
188
+ */
189
+ export function toVerifiableCredential(signed, kind, issuer) {
190
+ const { mandate, hash, signature } = signed;
191
+ return {
192
+ "@context": [
193
+ "https://www.w3.org/2018/credentials/v1",
194
+ "https://ap2-protocol.org/contexts/v1",
195
+ ],
196
+ type: ["VerifiableCredential", kind],
197
+ issuer,
198
+ issuanceDate: new Date().toISOString(),
199
+ credentialSubject: JSON.parse(canonicalJson(mandate)),
200
+ proof: {
201
+ type: "EthereumEip712Signature2021",
202
+ proofPurpose: "assertionMethod",
203
+ created: new Date().toISOString(),
204
+ eip712Domain: {
205
+ name: AP2_DOMAIN_NAME,
206
+ version: AP2_DOMAIN_VERSION,
207
+ primaryType: kind,
208
+ },
209
+ typedDataHash: hash,
210
+ proofValue: signature,
211
+ },
212
+ };
213
+ }
214
+ //# sourceMappingURL=mandates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mandates.js","sourceRoot":"","sources":["../../src/ap2/mandates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,SAAS,EACT,KAAK,GAEN,MAAM,MAAM,CAAC;AAWd,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAC9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,SAAS,MAAM,CAAC,OAAe;IAC7B,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC;AACzE,CAAC;AAED,8EAA8E;AAE9E,MAAM,CAAC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