@agenticprimitives/agent-profile 1.0.0-alpha.4 → 1.0.0-alpha.40

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 (93) hide show
  1. package/README.md +91 -37
  2. package/dist/a2a/binding.d.ts +99 -0
  3. package/dist/a2a/binding.d.ts.map +1 -0
  4. package/dist/a2a/binding.js +142 -0
  5. package/dist/a2a/binding.js.map +1 -0
  6. package/dist/a2a/canonical.d.ts +31 -0
  7. package/dist/a2a/canonical.d.ts.map +1 -0
  8. package/dist/a2a/canonical.js +43 -0
  9. package/dist/a2a/canonical.js.map +1 -0
  10. package/dist/a2a/field-binding.d.ts +125 -0
  11. package/dist/a2a/field-binding.d.ts.map +1 -0
  12. package/dist/a2a/field-binding.js +242 -0
  13. package/dist/a2a/field-binding.js.map +1 -0
  14. package/dist/a2a/import.d.ts +39 -0
  15. package/dist/a2a/import.d.ts.map +1 -0
  16. package/dist/a2a/import.js +134 -0
  17. package/dist/a2a/import.js.map +1 -0
  18. package/dist/a2a/index.d.ts +13 -0
  19. package/dist/a2a/index.d.ts.map +1 -0
  20. package/dist/a2a/index.js +24 -0
  21. package/dist/a2a/index.js.map +1 -0
  22. package/dist/a2a/jws.d.ts +76 -0
  23. package/dist/a2a/jws.d.ts.map +1 -0
  24. package/dist/a2a/jws.js +186 -0
  25. package/dist/a2a/jws.js.map +1 -0
  26. package/dist/a2a/playbook-binding.d.ts +29 -0
  27. package/dist/a2a/playbook-binding.d.ts.map +1 -0
  28. package/dist/a2a/playbook-binding.js +65 -0
  29. package/dist/a2a/playbook-binding.js.map +1 -0
  30. package/dist/a2a/pointer.d.ts +13 -0
  31. package/dist/a2a/pointer.d.ts.map +1 -0
  32. package/dist/a2a/pointer.js +78 -0
  33. package/dist/a2a/pointer.js.map +1 -0
  34. package/dist/a2a/release.d.ts +77 -0
  35. package/dist/a2a/release.d.ts.map +1 -0
  36. package/dist/a2a/release.js +197 -0
  37. package/dist/a2a/release.js.map +1 -0
  38. package/dist/a2a/types.d.ts +327 -0
  39. package/dist/a2a/types.d.ts.map +1 -0
  40. package/dist/a2a/types.js +49 -0
  41. package/dist/a2a/types.js.map +1 -0
  42. package/dist/a2a/validation.d.ts +81 -0
  43. package/dist/a2a/validation.d.ts.map +1 -0
  44. package/dist/a2a/validation.js +506 -0
  45. package/dist/a2a/validation.js.map +1 -0
  46. package/dist/caip10.d.ts +4 -3
  47. package/dist/caip10.d.ts.map +1 -1
  48. package/dist/caip10.js +8 -5
  49. package/dist/caip10.js.map +1 -1
  50. package/dist/calls.d.ts +23 -0
  51. package/dist/calls.d.ts.map +1 -1
  52. package/dist/calls.js +31 -1
  53. package/dist/calls.js.map +1 -1
  54. package/dist/card.d.ts +70 -0
  55. package/dist/card.d.ts.map +1 -0
  56. package/dist/card.js +130 -0
  57. package/dist/card.js.map +1 -0
  58. package/dist/client-key-binding.d.ts +196 -0
  59. package/dist/client-key-binding.d.ts.map +1 -0
  60. package/dist/client-key-binding.js +282 -0
  61. package/dist/client-key-binding.js.map +1 -0
  62. package/dist/client.d.ts +6 -4
  63. package/dist/client.d.ts.map +1 -1
  64. package/dist/client.js +79 -8
  65. package/dist/client.js.map +1 -1
  66. package/dist/constants.d.ts +31 -1
  67. package/dist/constants.d.ts.map +1 -1
  68. package/dist/constants.js +38 -1
  69. package/dist/constants.js.map +1 -1
  70. package/dist/derived-type.d.ts +14 -0
  71. package/dist/derived-type.d.ts.map +1 -0
  72. package/dist/derived-type.js +56 -0
  73. package/dist/derived-type.js.map +1 -0
  74. package/dist/distribution.d.ts +32 -0
  75. package/dist/distribution.d.ts.map +1 -0
  76. package/dist/distribution.js +167 -0
  77. package/dist/distribution.js.map +1 -0
  78. package/dist/errors.d.ts +6 -0
  79. package/dist/errors.d.ts.map +1 -1
  80. package/dist/errors.js +11 -0
  81. package/dist/errors.js.map +1 -1
  82. package/dist/index.d.ts +12 -8
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +19 -7
  85. package/dist/index.js.map +1 -1
  86. package/dist/profile.d.ts +4 -4
  87. package/dist/profile.d.ts.map +1 -1
  88. package/dist/profile.js +25 -3
  89. package/dist/profile.js.map +1 -1
  90. package/dist/types.d.ts +135 -9
  91. package/dist/types.d.ts.map +1 -1
  92. package/package.json +32 -12
  93. package/spec.md +5 -1
package/dist/caip10.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
- * CAIP-10 chain-agnostic account identifier helpers (HCS-14 +
3
- * ERC-8004 aligned; ADR-0008).
2
+ * CAIP-10 chain-agnostic account identifier helpers. AP uses CAIP-10
3
+ * as a portable back-link to the canonical Smart Agent (ADR-0008);
4
+ * external registry-specific identifiers are derived outside Ring 0.
4
5
  *
5
6
  * Subpath: `@agenticprimitives/agent-profile/caip10`.
6
7
  *
@@ -11,7 +12,7 @@
11
12
  * (any grammar-valid string accepted) — this is the "validate at write,
12
13
  * forward-compat at read" pattern.
13
14
  */
14
- import { CAIP10_NAMESPACE_ALLOWLIST } from './constants';
15
+ import { CAIP10_NAMESPACE_ALLOWLIST } from './constants.js';
15
16
  import type { Caip10Address, Caip10Parts } from '@agenticprimitives/types';
16
17
  export type { Caip10Address, Caip10Parts };
17
18
  export { CAIP10_NAMESPACE_ALLOWLIST };
@@ -1 +1 @@
1
- {"version":3,"file":"caip10.d.ts","sourceRoot":"","sources":["../src/caip10.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAM3E,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAItC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,CAcpE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAMtD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD"}
1
+ {"version":3,"file":"caip10.d.ts","sourceRoot":"","sources":["../src/caip10.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAM3E,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAMtC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,CAcpE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAMtD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD"}
package/dist/caip10.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
- * CAIP-10 chain-agnostic account identifier helpers (HCS-14 +
3
- * ERC-8004 aligned; ADR-0008).
2
+ * CAIP-10 chain-agnostic account identifier helpers. AP uses CAIP-10
3
+ * as a portable back-link to the canonical Smart Agent (ADR-0008);
4
+ * external registry-specific identifiers are derived outside Ring 0.
4
5
  *
5
6
  * Subpath: `@agenticprimitives/agent-profile/caip10`.
6
7
  *
@@ -11,10 +12,12 @@
11
12
  * (any grammar-valid string accepted) — this is the "validate at write,
12
13
  * forward-compat at read" pattern.
13
14
  */
14
- import { CAIP10_NAMESPACE_ALLOWLIST } from './constants';
15
- import { InvalidCaip10Error } from './errors';
15
+ import { CAIP10_NAMESPACE_ALLOWLIST } from './constants.js';
16
+ import { InvalidCaip10Error } from './errors.js';
16
17
  export { CAIP10_NAMESPACE_ALLOWLIST };
17
- const CAIP10_GRAMMAR = /^([-a-z0-9]{3,8}):([-_a-zA-Z0-9]{1,32}):([-.%a-zA-Z0-9]{1,128})$/;
18
+ // The GRAMMAR is a protocol fact and lives in `types`, where the five packages that cannot import
19
+ // this one can reach it. The ALLOWLIST below is policy and stays here — that split is the point.
20
+ import { CAIP10_GRAMMAR } from '@agenticprimitives/types';
18
21
  /**
19
22
  * Build a CAIP-10 string. Strict on the encode side — namespace must
20
23
  * be in `CAIP10_NAMESPACE_ALLOWLIST`. Address half is lowercased for
@@ -1 +1 @@
1
- {"version":3,"file":"caip10.js","sourceRoot":"","sources":["../src/caip10.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAQ9C,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC,MAAM,cAAc,GAAG,kEAAkE,CAAC;AAE1F;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAkB;IACnD,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAChD,IAAI,CAAC,0BAA0B,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,kBAAkB,CAC1B,GAAG,SAAS,IAAI,SAAS,IAAI,OAAO,EAAE,EACtC,cAAc,SAAS,uBAAuB,CAAC,GAAG,0BAA0B,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAC3F,CAAC;IACJ,CAAC;IACD,MAAM,iBAAiB,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IACnF,MAAM,GAAG,GAAG,GAAG,SAAS,IAAI,SAAS,IAAI,iBAAiB,EAAE,CAAC;IAC7D,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EA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Ac,SAAS,uBAAuB,CAAC,GAAG,0BAA0B,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAC3F,CAAC;IACJ,CAAC;IACD,MAAM,iBAAiB,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IACnF,MAAM,GAAG,GAAG,GAAG,SAAS,IAAI,SAAS,IAAI,iBAAiB,EAAE,CAAC;IAC7D,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,kBAAkB,CAAC,GAAG,EAAE,gCAAgC,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,GAAoB,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,MAAM,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrC,IAAI,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,IAAI,kBAAkB,CAAC,KAAK,EAAE,gCAAgC,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC;AAChE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC"}
package/dist/calls.d.ts CHANGED
@@ -14,6 +14,8 @@
14
14
  * pure encode-only.
15
15
  */
16
16
  import type { Address, Hex } from '@agenticprimitives/types';
17
+ import { type ClientKeysRecordV1 } from './client-key-binding.js';
18
+ import type { AgentDistributionV1 } from './types.js';
17
19
  /** Minimal call-shape: the standard `{ to, value, data }` triple. */
18
20
  export interface ContractCall {
19
21
  to: Address;
@@ -51,6 +53,27 @@ export declare function buildSetProfileStringCall(args: {
51
53
  predicate: Hex;
52
54
  value: string;
53
55
  }): ContractCall;
56
+ /**
57
+ * Set the SA-keyed `atl:distribution` record (spec 347 §8.5) — the JCS-canonical JSON of an
58
+ * `AgentDistributionV1` via `setStringProperty`. Validates first and throws `InvalidProfileError` on an
59
+ * invalid distribution, so nothing unreadable reaches the chain. The walletClient's account MUST equal
60
+ * `agent` (the record is the agent's own declaration; a registry only projects it).
61
+ */
62
+ export declare function buildSetDistributionCall(args: {
63
+ profileResolver: Address;
64
+ agent: Address;
65
+ distribution: AgentDistributionV1;
66
+ }): ContractCall;
67
+ /**
68
+ * Set the SA-keyed `atl:clientKeys` record (spec 442 §3) via `setStringProperty`. The SA signs this call itself —
69
+ * a registry never writes it. Validates first and throws `InvalidProfileError`. Writing a record WITHOUT a row is
70
+ * the explicit revocation of that key (the custody-epoch bump is the other).
71
+ */
72
+ export declare function buildSetClientKeysCall(args: {
73
+ profileResolver: Address;
74
+ agent: Address;
75
+ clientKeys: ClientKeysRecordV1;
76
+ }): ContractCall;
54
77
  /** Set a single address property on an agent's profile. */
55
78
  export declare function buildSetProfileAddressCall(args: {
56
79
  profileResolver: Address;
@@ -1 +1 @@
1
- {"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../src/calls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAG7D,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;CACX;AAID;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EA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C;IACf,UAAU,EAAE,kBAAkB,CAAC;CAChC,GAAG,YAAY,CAOf;AAED,2DAA2D;AAC3D,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,GAAG,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,YAAY,CAUf;AAED,2DAA2D;AAC3D,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,GAAG,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;CACZ,GAAG,YAAY,CAUf;AAED,yDAAyD;AACzD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB,GAAG,YAAY,CAUf"}
package/dist/calls.js CHANGED
@@ -14,7 +14,10 @@
14
14
  * pure encode-only.
15
15
  */
16
16
  import { encodeFunctionData } from 'viem';
17
- import { agentProfileResolverAbi } from './abis';
17
+ import { agentProfileResolverAbi } from './abis.js';
18
+ import { CLIENT_KEYS, DISTRIBUTION } from './constants.js';
19
+ import { encodeClientKeys } from './client-key-binding.js';
20
+ import { encodeDistribution } from './distribution.js';
18
21
  const ZERO_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000';
19
22
  /**
20
23
  * Build a call to register an agent's profile for the first time.
@@ -66,6 +69,33 @@ export function buildSetProfileStringCall(args) {
66
69
  }),
67
70
  };
68
71
  }
72
+ /**
73
+ * Set the SA-keyed `atl:distribution` record (spec 347 §8.5) — the JCS-canonical JSON of an
74
+ * `AgentDistributionV1` via `setStringProperty`. Validates first and throws `InvalidProfileError` on an
75
+ * invalid distribution, so nothing unreadable reaches the chain. The walletClient's account MUST equal
76
+ * `agent` (the record is the agent's own declaration; a registry only projects it).
77
+ */
78
+ export function buildSetDistributionCall(args) {
79
+ return buildSetProfileStringCall({
80
+ profileResolver: args.profileResolver,
81
+ agent: args.agent,
82
+ predicate: DISTRIBUTION,
83
+ value: encodeDistribution(args.distribution),
84
+ });
85
+ }
86
+ /**
87
+ * Set the SA-keyed `atl:clientKeys` record (spec 442 §3) via `setStringProperty`. The SA signs this call itself —
88
+ * a registry never writes it. Validates first and throws `InvalidProfileError`. Writing a record WITHOUT a row is
89
+ * the explicit revocation of that key (the custody-epoch bump is the other).
90
+ */
91
+ export function buildSetClientKeysCall(args) {
92
+ return buildSetProfileStringCall({
93
+ profileResolver: args.profileResolver,
94
+ agent: args.agent,
95
+ predicate: CLIENT_KEYS,
96
+ value: encodeClientKeys(args.clientKeys),
97
+ });
98
+ }
69
99
  /** Set a single address property on an agent's profile. */
70
100
  export function buildSetProfileAddressCall(args) {
71
101
  return {
package/dist/calls.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"calls.js","sourceRoot":"","sources":["../src/calls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AASjD,MAAM,YAAY,GAAG,oEAA2E,CAAC;AAEjG;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAOxC;IACC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,eAAe;QACxB,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,kBAAkB,CAAC;YACvB,GAAG,EAAE,uBAAuB;YAC5B,YAAY,EAAE,UAAU;YACxB,IAAI,EAAE;gBACJ,IAAI,CAAC,KAAK;gBACV,IAAI,CAAC,WAAW,IAAI,EAAE;gBACtB,IAAI,CAAC,WAAW,IAAI,EAAE;gBACtB,IAAI,CAAC,SAAS,IAAI,YAAY;gBAC9B,IAAI,CAAC,gBAAgB,IAAI,EAAE;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,EAAE,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC;KACzC,CAAC,CAAC;AACL,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,0BAA0B,CAAC,IAK1C;IACC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,eAAe;QACxB,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,kBAAkB,CAAC;YACvB,GAAG,EAAE,uBAAuB;YAC5B,YAAY,EAAE,oBAAoB;YAClC,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC;SAC/C,CAAC;KACH,CAAC;AACJ,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,0BAA0B,CAAC,IAK1C;IACC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,eAAe;QACxB,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,kBAAkB,CAAC;YACvB,GAAG,EAAE,uBAAuB;YAC5B,YAAY,EAAE,oBAAoB;YAClC,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC;SAC/C,CAAC;KACH,CAAC;AACJ,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,yBAAyB,CAAC,IAIzC;IACC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,eAAe;QACxB,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,kBAAkB,CAAC;YACvB,GAAG,EAAE,uBAAuB;YAC5B,YAAY,EAAE,WAAW;YACzB,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;SAChC,CAAC;KACH,CAAC;AACJ,CAAC"}
package/dist/card.d.ts ADDED
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Signed agent card bundle (spec 279 §3.2) — the discovery-substrate primitive that lets a verifier prove
3
+ * `cardHash → subjectAgent` WITHOUT trusting the registry or server that served the card.
4
+ *
5
+ * Subpath: `@agenticprimitives/agent-profile/card`.
6
+ *
7
+ * Shape: `cardHash` = sha256 of the canonical-JSON card; the subject Smart Agent signs (ERC-1271) a digest
8
+ * binding `{cardHash, subjectAgent, issuedAt, expiresAt, chainId, verifyingContract}`. Verification
9
+ * recomputes the card hash (catches a card tamper) AND re-checks the subject SA's ERC-1271 signature over
10
+ * that digest (authoritative — catches a tamper that also rewrote the hash). Both the signer and the
11
+ * on-chain ERC-1271 read are INJECTED so the module stays a pure, network-free helper (ADR-0006/0021);
12
+ * fail-closed throughout (ADR-0013).
13
+ *
14
+ * This is the off-chain card whose hash a registry entry references (`@agenticprimitives/registry-kit`).
15
+ * It is descriptive evidence only and carries NO authority to act.
16
+ */
17
+ import { type Address, type Hex } from 'viem';
18
+ import type { CanonicalAgentProfileV1, Sha256, SignedCanonicalProfileBundleV1 } from './types.js';
19
+ /** sha256 over the canonical-JSON encoding of a card → `sha256:<hex>`. Deterministic across runtimes
20
+ * (UTF-8 byte-level). Reuses {@link canonicalProfileJson} so the bytes hashed here match the package's
21
+ * one canonical card encoding. */
22
+ export declare function hashCanonicalProfile(profile: CanonicalAgentProfileV1): Sha256;
23
+ /** @deprecated Renamed `hashCanonicalProfile` (spec 347 §0.3). Same bytes, same hash. */
24
+ export declare const hashAgentCard: typeof hashCanonicalProfile;
25
+ /** Injected ERC-1271 read — `verifyingContract.isValidSignature(hash, signature)` resolved to a bool.
26
+ * Satisfied structurally by a viem `PublicClient` (`verifyHash`). */
27
+ export interface Erc1271Verifier {
28
+ verifyHash(args: {
29
+ address: Address;
30
+ hash: Hex;
31
+ signature: Hex;
32
+ }): Promise<boolean>;
33
+ }
34
+ /** Injected Smart-Agent signer: signs the 32-byte digest, returning the ERC-1271-validatable signature. */
35
+ export type SmartAgentCardSigner = (digest: Hex) => Promise<Hex>;
36
+ export interface BuildSignedAgentCardInput {
37
+ card: CanonicalAgentProfileV1;
38
+ /** The canonical Smart Agent the card describes. Also the signer + verifying contract in V1. */
39
+ subjectAgent: Address;
40
+ chainId: number;
41
+ issuedAt: string;
42
+ expiresAt?: string;
43
+ /** ERC-1271 verifying contract; defaults to `subjectAgent` (the SA validates its own card). */
44
+ verifyingContract?: Address;
45
+ }
46
+ /** Build a signed card bundle: hash the card, have the subject SA sign the digest (ERC-1271), return the
47
+ * signed {@link SignedAgentCardBundleV1}. */
48
+ export declare function buildSignedCanonicalProfileBundle(input: BuildSignedAgentCardInput, sign: SmartAgentCardSigner): Promise<SignedCanonicalProfileBundleV1>;
49
+ /** @deprecated Renamed `buildSignedCanonicalProfileBundle` (spec 347 §0.3). */
50
+ export declare const buildSignedAgentCardBundle: typeof buildSignedCanonicalProfileBundle;
51
+ export type VerifySignedAgentCardResult = {
52
+ ok: true;
53
+ subjectAgent: Address;
54
+ cardHash: Sha256;
55
+ card: CanonicalAgentProfileV1;
56
+ } | {
57
+ ok: false;
58
+ reason: 'bad_shape' | 'card_hash_mismatch' | 'subject_mismatch' | 'expired' | 'signature_invalid';
59
+ };
60
+ /** Verify a signed card bundle WITHOUT trusting whoever served it: recompute `cardHash` from the card
61
+ * (catches a card tamper that left the hash stale), confirm the proof is self-asserted by the subject SA
62
+ * (signer == verifyingContract == subjectAgent — V1), enforce expiry, then re-check the subject SA's
63
+ * ERC-1271 signature over the digest (authoritative). Fail-closed: any anomaly → `ok:false`. */
64
+ export declare function verifySignedCanonicalProfileBundle(bundle: SignedCanonicalProfileBundleV1, opts: {
65
+ verifier: Erc1271Verifier;
66
+ now?: number;
67
+ }): Promise<VerifySignedAgentCardResult>;
68
+ /** @deprecated Renamed `verifySignedCanonicalProfileBundle` (spec 347 §0.3). */
69
+ export declare const verifySignedAgentCardBundle: typeof verifySignedCanonicalProfileBundle;
70
+ //# sourceMappingURL=card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../src/card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAA+B,KAAK,OAAO,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AAC,MAAM,EAAE,WAAW,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,SAAS,GAAG,mBAAmB,CAAA;CAAE,CAAC;AAErH;;;iGAGiG;AACjG,wBAAsB,kCAAkC,CACtD,MAAM,EAAE,8BAA8B,EACtC,IAAI,EAAE;IAAE,QAAQ,EAAE,eAAe,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAChD,OAAO,CAAC,2BAA2B,CAAC,CAkDtC;AAED,gFAAgF;AAChF,eAAO,MAAM,2BAA2B,2CAAqC,CAAC"}
package/dist/card.js ADDED
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Signed agent card bundle (spec 279 §3.2) — the discovery-substrate primitive that lets a verifier prove
3
+ * `cardHash → subjectAgent` WITHOUT trusting the registry or server that served the card.
4
+ *
5
+ * Subpath: `@agenticprimitives/agent-profile/card`.
6
+ *
7
+ * Shape: `cardHash` = sha256 of the canonical-JSON card; the subject Smart Agent signs (ERC-1271) a digest
8
+ * binding `{cardHash, subjectAgent, issuedAt, expiresAt, chainId, verifyingContract}`. Verification
9
+ * recomputes the card hash (catches a card tamper) AND re-checks the subject SA's ERC-1271 signature over
10
+ * that digest (authoritative — catches a tamper that also rewrote the hash). Both the signer and the
11
+ * on-chain ERC-1271 read are INJECTED so the module stays a pure, network-free helper (ADR-0006/0021);
12
+ * fail-closed throughout (ADR-0013).
13
+ *
14
+ * This is the off-chain card whose hash a registry entry references (`@agenticprimitives/registry-kit`).
15
+ * It is descriptive evidence only and carries NO authority to act.
16
+ */
17
+ import { sha256 as viemSha256, toHex } from 'viem';
18
+ import { canonicalProfileJson } from './profile.js';
19
+ // Sorted-key canonical JSON is `types.canonicalizeJson`. This file declared a BYTE-IDENTICAL
20
+ // copy; aliased rather than renamed so call sites are untouched and the output cannot change —
21
+ // which matters, because these bytes get hashed and signed.
22
+ import { canonicalizeJson as canonicalize } from '@agenticprimitives/types';
23
+ /** sha256 over the canonical-JSON encoding of a card → `sha256:<hex>`. Deterministic across runtimes
24
+ * (UTF-8 byte-level). Reuses {@link canonicalProfileJson} so the bytes hashed here match the package's
25
+ * one canonical card encoding. */
26
+ export function hashCanonicalProfile(profile) {
27
+ return `sha256:${viemSha256(toHex(canonicalProfileJson(profile))).slice(2)}`;
28
+ }
29
+ /** @deprecated Renamed `hashCanonicalProfile` (spec 347 §0.3). Same bytes, same hash. */
30
+ export const hashAgentCard = hashCanonicalProfile;
31
+ /** The 32-byte digest (0x-hex) the subject SA signs / the ERC-1271 read validates over. Binds the card
32
+ * hash to the subject + chain + verifying contract, so a card cannot be replayed for another SA/chain. */
33
+ function cardDigest(b) {
34
+ return viemSha256(toHex(canonicalize({
35
+ cardHash: b.cardHash,
36
+ subjectAgent: b.subjectAgent.toLowerCase(),
37
+ issuedAt: b.issuedAt,
38
+ expiresAt: b.expiresAt,
39
+ chainId: b.chainId,
40
+ verifyingContract: b.verifyingContract.toLowerCase(),
41
+ })));
42
+ }
43
+ /** Build a signed card bundle: hash the card, have the subject SA sign the digest (ERC-1271), return the
44
+ * signed {@link SignedAgentCardBundleV1}. */
45
+ export async function buildSignedCanonicalProfileBundle(input, sign) {
46
+ const verifyingContract = input.verifyingContract ?? input.subjectAgent;
47
+ const cardHash = hashCanonicalProfile(input.card);
48
+ const signature = await sign(cardDigest({
49
+ cardHash,
50
+ subjectAgent: input.subjectAgent,
51
+ issuedAt: input.issuedAt,
52
+ expiresAt: input.expiresAt,
53
+ chainId: input.chainId,
54
+ verifyingContract,
55
+ }));
56
+ return {
57
+ type: 'SignedAgentCardBundleV1',
58
+ card: input.card,
59
+ cardHash,
60
+ subjectAgent: input.subjectAgent,
61
+ issuedAt: input.issuedAt,
62
+ expiresAt: input.expiresAt,
63
+ proof: {
64
+ type: 'ERC1271SmartAgentSignature',
65
+ chainId: input.chainId,
66
+ verifyingContract,
67
+ signer: input.subjectAgent,
68
+ signature,
69
+ },
70
+ };
71
+ }
72
+ /** @deprecated Renamed `buildSignedCanonicalProfileBundle` (spec 347 §0.3). */
73
+ export const buildSignedAgentCardBundle = buildSignedCanonicalProfileBundle;
74
+ /** Verify a signed card bundle WITHOUT trusting whoever served it: recompute `cardHash` from the card
75
+ * (catches a card tamper that left the hash stale), confirm the proof is self-asserted by the subject SA
76
+ * (signer == verifyingContract == subjectAgent — V1), enforce expiry, then re-check the subject SA's
77
+ * ERC-1271 signature over the digest (authoritative). Fail-closed: any anomaly → `ok:false`. */
78
+ export async function verifySignedCanonicalProfileBundle(bundle, opts) {
79
+ if (!bundle ||
80
+ bundle.type !== 'SignedAgentCardBundleV1' ||
81
+ !bundle.card ||
82
+ !bundle.proof?.signature ||
83
+ bundle.proof.type !== 'ERC1271SmartAgentSignature') {
84
+ return { ok: false, reason: 'bad_shape' };
85
+ }
86
+ let recomputed;
87
+ try {
88
+ recomputed = hashCanonicalProfile(bundle.card);
89
+ }
90
+ catch {
91
+ return { ok: false, reason: 'bad_shape' }; // invalid card shape
92
+ }
93
+ if (recomputed !== bundle.cardHash)
94
+ return { ok: false, reason: 'card_hash_mismatch' };
95
+ // V1: the subject SA self-asserts its own card. A delegated signer is a future version.
96
+ const subject = bundle.subjectAgent.toLowerCase();
97
+ if (bundle.proof.signer.toLowerCase() !== subject || bundle.proof.verifyingContract.toLowerCase() !== subject) {
98
+ return { ok: false, reason: 'subject_mismatch' };
99
+ }
100
+ if (bundle.expiresAt) {
101
+ const exp = Date.parse(bundle.expiresAt);
102
+ const now = opts.now ?? Date.now();
103
+ if (!Number.isNaN(exp) && now > exp)
104
+ return { ok: false, reason: 'expired' };
105
+ }
106
+ let valid;
107
+ try {
108
+ valid = await opts.verifier.verifyHash({
109
+ address: bundle.proof.verifyingContract,
110
+ hash: cardDigest({
111
+ cardHash: bundle.cardHash,
112
+ subjectAgent: bundle.subjectAgent,
113
+ issuedAt: bundle.issuedAt,
114
+ expiresAt: bundle.expiresAt,
115
+ chainId: bundle.proof.chainId,
116
+ verifyingContract: bundle.proof.verifyingContract,
117
+ }),
118
+ signature: bundle.proof.signature,
119
+ });
120
+ }
121
+ catch {
122
+ return { ok: false, reason: 'signature_invalid' };
123
+ }
124
+ if (!valid)
125
+ return { ok: false, reason: 'signature_invalid' };
126
+ return { ok: true, subjectAgent: bundle.subjectAgent, cardHash: bundle.cardHash, card: bundle.card };
127
+ }
128
+ /** @deprecated Renamed `verifySignedCanonicalProfileBundle` (spec 347 §0.3). */
129
+ export const verifySignedAgentCardBundle = verifySignedCanonicalProfileBundle;
130
+ //# sourceMappingURL=card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.js","sourceRoot":"","sources":["../src/card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,KAAK,EAA0B,MAAM,MAAM,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,6FAA6F;AAC7F,+FAA+F;AAC/F,4DAA4D;AAC5D,OAAO,EAAE,gBAAgB,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE5E;;mCAEmC;AACnC,MAAM,UAAU,oBAAoB,CAAC,OAAgC;IACnE,OAAO,UAAU,UAAU,CAAC,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAY,CAAC;AACzF,CAAC;AAED,yFAAyF;AACzF,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAIlD;2GAC2G;AAC3G,SAAS,UAAU,CAAC,CAOnB;IACC,OAAO,UAAU,CACf,KAAK,CACH,YAAY,CAAC;QACX,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,YAAY,EAAE,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE;QAC1C,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,iBAAiB,EAAE,CAAC,CAAC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AC,UAAU,CAAC;YACrC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,iBAAiB;YACvC,IAAI,EAAE,UAAU,CAAC;gBACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,YAAY,EAAE,MAAM,CAAC,YAAY;gBACjC,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;gBAC7B,iBAAiB,EAAE,MAAM,CAAC,KAAK,CAAC,iBAAiB;aAClD,CAAC;YACF,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS;SAClC,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;IACpD,CAAC;IACD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9D,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AACvG,CAAC;AAED,gFAAgF;AAChF,MAAM,CAAC,MAAM,2BAA2B,GAAG,kCAAkC,CAAC"}
@@ -0,0 +1,196 @@
1
+ /**
2
+ * `ClientKeyBindingV1` — the Smart Agent's EIP-712 statement that ONE public key (a JWK, by RFC 7638
3
+ * thumbprint) may PRESENT for it at external doors — OAuth `private_key_jwt`, DPoP, RFC 9421 HTTP signatures,
4
+ * a TAP key directory — under one custody epoch, between `notBefore` and `notAfter`, published under one
5
+ * `clientId` (spec 442 §3; ontology `ap:ClientKeyBinding`; on-chain record `atl:clientKeys`).
6
+ *
7
+ * The service-agent-signing rule, applied to the doors the field runs: the service never holds the identity's
8
+ * key; it holds a DELEGATE (a custodied P-256 / Ed25519 key behind `JwsSignerPort`) and presents this binding beside
9
+ * it. Those doors cannot verify an ERC-7710 wire, so the binding takes the form they can carry: a signed
10
+ * statement the SA stands behind, validated through ERC-1271 by anyone who wants more than OAuth's trust.
11
+ *
12
+ * WHAT IT IS NOT. It is not an authority wire: it grants the key NO authority to act. Signatures under this key are the
13
+ * agent's PRESENTATIONS; what the agent may do at a door is still a mandate, verified per step (spec 350 §3.6).
14
+ * Revoked by a custody-epoch bump (every binding under the old epoch is dead — rotation re-approves, recovery
15
+ * does not; spec 410 §1) or by an explicit `atl:clientKeys` write. Short `notAfter` (≤ 90 days) is the default.
16
+ *
17
+ * Domain: `{ name:'AgenticPrimitivesClientKey', version:'1', chainId, verifyingContract: <SA> }`. The ERC-1271
18
+ * read and the custody-epoch read are INJECTED so this module stays network-free (same ports as `a2a/binding`).
19
+ */
20
+ import { type Address, type Hex } from 'viem';
21
+ import type { Erc1271Verifier, SmartAgentCardSigner } from './card.js';
22
+ import { CLIENT_KEYS } from './constants.js';
23
+ /** What the FIELD verifies at a door. secp256k1 (`ES256K`) is deliberately absent: no OAuth / DPoP / 9421 door checks it. */
24
+ export type ClientKeyAlg = 'ES256' | 'EdDSA';
25
+ export declare const CLIENT_KEY_ALGS: readonly ClientKeyAlg[];
26
+ /**
27
+ * `service` — the estate's personal-agent SERVICE presents (the only client at a company's door, spec 442 §7.1).
28
+ * `person` — the person's own SA presents under its own `clientId`; allowed ONLY for a `naming: public` posture,
29
+ * because a per-person client document publishes the person's label to every company (§7).
30
+ */
31
+ export type ClientKeyScope = 'service' | 'person';
32
+ export interface ClientKeyBindingV1 {
33
+ /** The Smart Agent, CAIP-10 (`eip155:<chainId>:<address>`). */
34
+ canonicalAgentId: string;
35
+ scope: ClientKeyScope;
36
+ /** The HTTPS URL the key is published under (the client metadata document / JWKS / key directory). */
37
+ clientId: string;
38
+ /** RFC 7638 thumbprint (base64url sha256) of the public JWK. */
39
+ jwkThumbprint: string;
40
+ alg: ClientKeyAlg;
41
+ /** The SA's custody epoch at signing (`AgentAccount.custodyEpoch()`; 0 for a generation-1 account). */
42
+ custodyEpoch: number;
43
+ /** Unix seconds. */
44
+ notBefore: number;
45
+ notAfter: number;
46
+ }
47
+ /** A binding plus the SA's ERC-1271-validatable signature over its EIP-712 digest. */
48
+ export interface SignedClientKeyBindingV1 {
49
+ binding: ClientKeyBindingV1;
50
+ chainId: number;
51
+ /** The Smart Agent (EIP-712 `verifyingContract`; ERC-1271 validator). */
52
+ verifyingContract: Address;
53
+ signature: Hex;
54
+ }
55
+ export declare const CLIENT_KEY_BINDING_DOMAIN_NAME = "AgenticPrimitivesClientKey";
56
+ export declare const CLIENT_KEY_BINDING_DOMAIN_VERSION = "1";
57
+ export declare const CLIENT_KEY_BINDING_TYPES: {
58
+ readonly ClientKeyBinding: readonly [{
59
+ readonly name: "canonicalAgentId";
60
+ readonly type: "string";
61
+ }, {
62
+ readonly name: "scope";
63
+ readonly type: "string";
64
+ }, {
65
+ readonly name: "clientId";
66
+ readonly type: "string";
67
+ }, {
68
+ readonly name: "jwkThumbprint";
69
+ readonly type: "bytes32";
70
+ }, {
71
+ readonly name: "alg";
72
+ readonly type: "string";
73
+ }, {
74
+ readonly name: "custodyEpoch";
75
+ readonly type: "uint64";
76
+ }, {
77
+ readonly name: "notBefore";
78
+ readonly type: "uint64";
79
+ }, {
80
+ readonly name: "notAfter";
81
+ readonly type: "uint64";
82
+ }];
83
+ };
84
+ /** The EIP-712 type string (for TYPEHASH parity checks). Off-chain only today: no contract consumes it. */
85
+ export declare const CLIENT_KEY_BINDING_TYPE_STRING = "ClientKeyBinding(string canonicalAgentId,string scope,string clientId,bytes32 jwkThumbprint,string alg,uint64 custodyEpoch,uint64 notBefore,uint64 notAfter)";
86
+ /** The default validity a Home signs for: 90 days. Longer is allowed and visible; it is never silently extended. */
87
+ export declare const CLIENT_KEY_BINDING_DEFAULT_TTL_SECONDS: number;
88
+ export declare function clientKeyBindingDomain(chainId: number, smartAgent: Address): {
89
+ readonly name: "AgenticPrimitivesClientKey";
90
+ readonly version: "1";
91
+ readonly chainId: number;
92
+ readonly verifyingContract: `0x${string}`;
93
+ };
94
+ /**
95
+ * Validate a candidate binding. Returns `[]` when well-formed, else one issue per violation. Shape only — the
96
+ * posture rule is `assertClientKeyScopeAllowed`, the epoch rule is `verifySignedClientKeyBinding`.
97
+ */
98
+ export declare function validateClientKeyBinding(b: unknown): string[];
99
+ /** The EIP-712 message as signed: the thumbprint as bytes32, the integers as uint64. */
100
+ export declare function clientKeyBindingMessage(b: ClientKeyBindingV1): {
101
+ canonicalAgentId: string;
102
+ scope: ClientKeyScope;
103
+ clientId: string;
104
+ jwkThumbprint: `0x${string}`;
105
+ alg: ClientKeyAlg;
106
+ custodyEpoch: bigint;
107
+ notBefore: bigint;
108
+ notAfter: bigint;
109
+ };
110
+ /** The 32-byte EIP-712 digest the SA signs and ERC-1271 validates. */
111
+ export declare function clientKeyBindingDigest(binding: ClientKeyBindingV1, chainId: number, smartAgent: Address): Hex;
112
+ /**
113
+ * Spec 442 §7: a `scope: 'person'` binding publishes a per-person client document, which names the person to
114
+ * every company and is enumerable — allowed only when the person's naming posture is already `public`. The
115
+ * posture is the agent's `AgentDiscoveryPolicyV1.naming` (agent-resolution); passed structurally so this module
116
+ * depends on nothing. The estate's personal-agent SERVICE (`scope: 'service'`) is the client for everyone else.
117
+ */
118
+ export declare function clientKeyScopeRefusal(binding: Pick<ClientKeyBindingV1, 'scope'>, posture: {
119
+ naming: string;
120
+ }): string | null;
121
+ export declare function assertClientKeyScopeAllowed(binding: Pick<ClientKeyBindingV1, 'scope'>, posture: {
122
+ naming: string;
123
+ }): void;
124
+ export interface BuildSignedClientKeyBindingInput {
125
+ binding: ClientKeyBindingV1;
126
+ chainId: number;
127
+ smartAgent: Address;
128
+ /** Signs the 32-byte digest as the SA (ERC-1271-validatable). */
129
+ signer: SmartAgentCardSigner;
130
+ /** The agent's naming posture — the §7 rule runs here, before any signature. */
131
+ posture: {
132
+ naming: string;
133
+ };
134
+ }
135
+ /** Validate → posture → sign. The binding names this SA on this chain or it is refused before signing. */
136
+ export declare function buildSignedClientKeyBinding(input: BuildSignedClientKeyBindingInput): Promise<SignedClientKeyBindingV1>;
137
+ export type VerifyClientKeyBindingResult = {
138
+ ok: true;
139
+ smartAgent: Address;
140
+ digest: Hex;
141
+ } | {
142
+ ok: false;
143
+ reason: 'bad_shape' | 'agent_mismatch' | 'alg_not_field_verifiable' | 'scope_refused' | 'thumbprint_mismatch' | 'stale_custody_epoch' | 'not_yet_valid' | 'expired' | 'signature_invalid';
144
+ detail?: string;
145
+ };
146
+ export interface VerifyClientKeyBindingOptions {
147
+ erc1271Verifier: Erc1271Verifier;
148
+ /** The SA's CURRENT custody epoch, read by the caller (`agent-account` `custodyEpochOf`). A binding under any other epoch is dead. */
149
+ currentCustodyEpoch: number;
150
+ /** Unix seconds; defaults to now. */
151
+ now?: number;
152
+ /** When given, the binding MUST name this key (the key that actually signed the request being verified). */
153
+ expectThumbprint?: string;
154
+ /** When given, the §7 posture rule is re-checked at verification (a door that knows the agent's posture). */
155
+ posture?: {
156
+ naming: string;
157
+ };
158
+ }
159
+ /**
160
+ * Fail-closed: shape → alg the field verifies → names this SA on this chain → expected key → posture → custody
161
+ * epoch is CURRENT → validity window → ERC-1271 over the EIP-712 digest. Any anomaly ⇒ `ok:false`.
162
+ */
163
+ export declare function verifySignedClientKeyBinding(signed: SignedClientKeyBindingV1, opts: VerifyClientKeyBindingOptions): Promise<VerifyClientKeyBindingResult>;
164
+ /**
165
+ * One row of the SA-keyed `atl:clientKeys` string record: the PUBLIC half of every live binding (thumbprint,
166
+ * alg, scope, clientId, epoch, notAfter) — what a verifier that wants more than OAuth's trust checks a
167
+ * presented binding against, and what a JWKS / key directory is projected from. Never the signature, never a
168
+ * private key. Written by the SA itself (`buildSetClientKeysCall`); an explicit write with the row removed is
169
+ * the second way to revoke (the first is the custody-epoch bump).
170
+ */
171
+ export interface ClientKeyRecordRowV1 {
172
+ thumbprint: string;
173
+ alg: ClientKeyAlg;
174
+ scope: ClientKeyScope;
175
+ clientId: string;
176
+ custodyEpoch: number;
177
+ notAfter: number;
178
+ }
179
+ export interface ClientKeysRecordV1 {
180
+ v: 1;
181
+ keys: ClientKeyRecordRowV1[];
182
+ }
183
+ export declare function clientKeyRecordRow(b: ClientKeyBindingV1): ClientKeyRecordRowV1;
184
+ /** Validate a candidate record. `[]` when valid. */
185
+ export declare function validateClientKeysRecord(r: unknown): string[];
186
+ /** RFC 8785 canonical JSON — two equal records encode to identical bytes (as `atl:distribution`). */
187
+ export declare function encodeClientKeys(record: ClientKeysRecordV1): string;
188
+ /** Fail-closed: anything that is not a valid record is `null` — an unreadable record is an answer, never a guess (ADR-0013). */
189
+ export declare function decodeClientKeys(value: string | null | undefined): ClientKeysRecordV1 | null;
190
+ /** The rows a verifier treats as LIVE now: current epoch, not past `notAfter`. Stale rows are dead, not pruned here. */
191
+ export declare function liveClientKeys(record: ClientKeysRecordV1, opts: {
192
+ currentCustodyEpoch: number;
193
+ now?: number;
194
+ }): ClientKeyRecordRowV1[];
195
+ export { CLIENT_KEYS };
196
+ //# sourceMappingURL=client-key-binding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-key-binding.d.ts","sourceRoot":"","sources":["../src/client-key-binding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAiB,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK7C,6HAA6H;AAC7H,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,OAAO,CAAC;AAC7C,eAAO,MAAM,eAAe,EAAE,SAAS,YAAY,EAAgC,CAAC;AAEpF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GA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