@agenticprimitives/agent-profile 1.0.0-alpha.38 → 1.0.0-alpha.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/calls.d.ts CHANGED
@@ -14,6 +14,7 @@
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';
17
18
  import type { AgentDistributionV1 } from './types.js';
18
19
  /** Minimal call-shape: the standard `{ to, value, data }` triple. */
19
20
  export interface ContractCall {
@@ -63,6 +64,16 @@ export declare function buildSetDistributionCall(args: {
63
64
  agent: Address;
64
65
  distribution: AgentDistributionV1;
65
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;
66
77
  /** Set a single address property on an agent's profile. */
67
78
  export declare function buildSetProfileAddressCall(args: {
68
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;AAI7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,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,EA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,CAUf;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,mBAAmB,CAAC;CACnC,GAAG,YAAY,CAOf;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;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
@@ -15,7 +15,8 @@
15
15
  */
16
16
  import { encodeFunctionData } from 'viem';
17
17
  import { agentProfileResolverAbi } from './abis.js';
18
- import { DISTRIBUTION } from './constants.js';
18
+ import { CLIENT_KEYS, DISTRIBUTION } from './constants.js';
19
+ import { encodeClientKeys } from './client-key-binding.js';
19
20
  import { encodeDistribution } from './distribution.js';
20
21
  const ZERO_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000';
21
22
  /**
@@ -82,6 +83,19 @@ export function buildSetDistributionCall(args) {
82
83
  value: encodeDistribution(args.distribution),
83
84
  });
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
+ }
85
99
  /** Set a single address property on an agent's profile. */
86
100
  export function buildSetProfileAddressCall(args) {
87
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,WAAW,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAUvD,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,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;YACzB,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;SAChC,CAAC;KACH,CAAC;AACJ,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":"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IAAgI;AAChI,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,kBAAkB,GAAG,IAAI,CAK5F;AAED,wHAAwH;AACxH,wBAAgB,cAAc,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE;IAAE,mBAAmB,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,oBAAoB,EAAE,CAGtI;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,282 @@
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 { hashTypedData } from 'viem';
21
+ import { jcsCanonicalize } from '@agenticprimitives/types';
22
+ import { thumbprintToBytes32 } from './a2a/binding.js';
23
+ import { CLIENT_KEYS } from './constants.js';
24
+ import { InvalidProfileError } from './errors.js';
25
+ export const CLIENT_KEY_ALGS = ['ES256', 'EdDSA'];
26
+ // ─── EIP-712 ─────────────────────────────────────────────────────────────────────────────────────────
27
+ export const CLIENT_KEY_BINDING_DOMAIN_NAME = 'AgenticPrimitivesClientKey';
28
+ export const CLIENT_KEY_BINDING_DOMAIN_VERSION = '1';
29
+ export const CLIENT_KEY_BINDING_TYPES = {
30
+ ClientKeyBinding: [
31
+ { name: 'canonicalAgentId', type: 'string' },
32
+ { name: 'scope', type: 'string' },
33
+ { name: 'clientId', type: 'string' },
34
+ { name: 'jwkThumbprint', type: 'bytes32' },
35
+ { name: 'alg', type: 'string' },
36
+ { name: 'custodyEpoch', type: 'uint64' },
37
+ { name: 'notBefore', type: 'uint64' },
38
+ { name: 'notAfter', type: 'uint64' },
39
+ ],
40
+ };
41
+ /** The EIP-712 type string (for TYPEHASH parity checks). Off-chain only today: no contract consumes it. */
42
+ export const CLIENT_KEY_BINDING_TYPE_STRING = 'ClientKeyBinding(string canonicalAgentId,string scope,string clientId,bytes32 jwkThumbprint,string alg,uint64 custodyEpoch,uint64 notBefore,uint64 notAfter)';
43
+ /** The default validity a Home signs for: 90 days. Longer is allowed and visible; it is never silently extended. */
44
+ export const CLIENT_KEY_BINDING_DEFAULT_TTL_SECONDS = 90 * 24 * 3600;
45
+ export function clientKeyBindingDomain(chainId, smartAgent) {
46
+ return {
47
+ name: CLIENT_KEY_BINDING_DOMAIN_NAME,
48
+ version: CLIENT_KEY_BINDING_DOMAIN_VERSION,
49
+ chainId,
50
+ verifyingContract: smartAgent,
51
+ };
52
+ }
53
+ const CAIP10_EVM = /^eip155:(\d+):(0x[0-9a-fA-F]{40})$/;
54
+ const HTTPS_URL = /^https:\/\/[^\s/?#]+(\/[^\s?#]*)?$/;
55
+ /**
56
+ * Validate a candidate binding. Returns `[]` when well-formed, else one issue per violation. Shape only — the
57
+ * posture rule is `assertClientKeyScopeAllowed`, the epoch rule is `verifySignedClientKeyBinding`.
58
+ */
59
+ export function validateClientKeyBinding(b) {
60
+ const issues = [];
61
+ if (typeof b !== 'object' || b === null || Array.isArray(b))
62
+ return ['binding: must be an object'];
63
+ const x = b;
64
+ if (typeof x.canonicalAgentId !== 'string' || !CAIP10_EVM.test(x.canonicalAgentId))
65
+ issues.push('binding.canonicalAgentId: must be eip155:<chainId>:<address>');
66
+ if (x.scope !== 'service' && x.scope !== 'person')
67
+ issues.push('binding.scope: must be service | person');
68
+ if (typeof x.clientId !== 'string' || !HTTPS_URL.test(x.clientId))
69
+ issues.push('binding.clientId: must be an https URL');
70
+ if (typeof x.jwkThumbprint !== 'string')
71
+ issues.push('binding.jwkThumbprint: required');
72
+ else {
73
+ try {
74
+ thumbprintToBytes32(x.jwkThumbprint);
75
+ }
76
+ catch {
77
+ issues.push('binding.jwkThumbprint: must be a base64url sha256 (RFC 7638)');
78
+ }
79
+ }
80
+ if (typeof x.alg !== 'string' || !CLIENT_KEY_ALGS.includes(x.alg)) {
81
+ issues.push(`binding.alg: must be one of ${CLIENT_KEY_ALGS.join(' | ')} — the field verifies no other (ES256K is not verifiable at these doors)`);
82
+ }
83
+ for (const k of ['custodyEpoch', 'notBefore', 'notAfter']) {
84
+ if (!Number.isInteger(x[k]) || x[k] < 0)
85
+ issues.push(`binding.${k}: must be a non-negative integer`);
86
+ }
87
+ if (Number.isInteger(x.notBefore) && Number.isInteger(x.notAfter) && x.notAfter <= x.notBefore) {
88
+ issues.push('binding.notAfter: must be after notBefore (an open-ended client key is not a thing)');
89
+ }
90
+ return issues;
91
+ }
92
+ /** The EIP-712 message as signed: the thumbprint as bytes32, the integers as uint64. */
93
+ export function clientKeyBindingMessage(b) {
94
+ const issues = validateClientKeyBinding(b);
95
+ if (issues.length)
96
+ throw new InvalidProfileError(`ClientKeyBindingV1: ${issues.join('; ')}`);
97
+ return {
98
+ canonicalAgentId: b.canonicalAgentId,
99
+ scope: b.scope,
100
+ clientId: b.clientId,
101
+ jwkThumbprint: thumbprintToBytes32(b.jwkThumbprint),
102
+ alg: b.alg,
103
+ custodyEpoch: BigInt(b.custodyEpoch),
104
+ notBefore: BigInt(b.notBefore),
105
+ notAfter: BigInt(b.notAfter),
106
+ };
107
+ }
108
+ /** The 32-byte EIP-712 digest the SA signs and ERC-1271 validates. */
109
+ export function clientKeyBindingDigest(binding, chainId, smartAgent) {
110
+ return hashTypedData({
111
+ domain: clientKeyBindingDomain(chainId, smartAgent),
112
+ types: CLIENT_KEY_BINDING_TYPES,
113
+ primaryType: 'ClientKeyBinding',
114
+ message: clientKeyBindingMessage(binding),
115
+ });
116
+ }
117
+ // ─── posture ─────────────────────────────────────────────────────────────────────────────────────────
118
+ /**
119
+ * Spec 442 §7: a `scope: 'person'` binding publishes a per-person client document, which names the person to
120
+ * every company and is enumerable — allowed only when the person's naming posture is already `public`. The
121
+ * posture is the agent's `AgentDiscoveryPolicyV1.naming` (agent-resolution); passed structurally so this module
122
+ * depends on nothing. The estate's personal-agent SERVICE (`scope: 'service'`) is the client for everyone else.
123
+ */
124
+ export function clientKeyScopeRefusal(binding, posture) {
125
+ if (binding.scope === 'person' && posture.naming !== 'public') {
126
+ return `a scope:'person' client key is refused for naming posture '${posture.naming}' — the person would be the client_id at every company (spec 442 §7); present through the estate's personal-agent service instead`;
127
+ }
128
+ return null;
129
+ }
130
+ export function assertClientKeyScopeAllowed(binding, posture) {
131
+ const refusal = clientKeyScopeRefusal(binding, posture);
132
+ if (refusal)
133
+ throw new InvalidProfileError(refusal);
134
+ }
135
+ /** Validate → posture → sign. The binding names this SA on this chain or it is refused before signing. */
136
+ export async function buildSignedClientKeyBinding(input) {
137
+ const { binding, chainId, smartAgent } = input;
138
+ const issues = validateClientKeyBinding(binding);
139
+ if (issues.length)
140
+ throw new InvalidProfileError(`ClientKeyBindingV1: ${issues.join('; ')}`);
141
+ const m = CAIP10_EVM.exec(binding.canonicalAgentId);
142
+ if (Number(m[1]) !== chainId || m[2].toLowerCase() !== smartAgent.toLowerCase()) {
143
+ throw new InvalidProfileError('ClientKeyBindingV1: canonicalAgentId does not name this Smart Agent on this chain');
144
+ }
145
+ assertClientKeyScopeAllowed(binding, input.posture);
146
+ const digest = clientKeyBindingDigest(binding, chainId, smartAgent);
147
+ const signature = await input.signer(digest);
148
+ return { binding, chainId, verifyingContract: smartAgent, signature };
149
+ }
150
+ /**
151
+ * Fail-closed: shape → alg the field verifies → names this SA on this chain → expected key → posture → custody
152
+ * epoch is CURRENT → validity window → ERC-1271 over the EIP-712 digest. Any anomaly ⇒ `ok:false`.
153
+ */
154
+ export async function verifySignedClientKeyBinding(signed, opts) {
155
+ const b = signed?.binding;
156
+ if (!b || typeof signed.chainId !== 'number' || typeof signed.verifyingContract !== 'string' || typeof signed.signature !== 'string') {
157
+ return { ok: false, reason: 'bad_shape' };
158
+ }
159
+ const issues = validateClientKeyBinding(b);
160
+ if (issues.length) {
161
+ const alg = issues.find((i) => i.startsWith('binding.alg'));
162
+ return alg ? { ok: false, reason: 'alg_not_field_verifiable', detail: alg } : { ok: false, reason: 'bad_shape', detail: issues.join('; ') };
163
+ }
164
+ const m = CAIP10_EVM.exec(b.canonicalAgentId);
165
+ if (Number(m[1]) !== signed.chainId || m[2].toLowerCase() !== signed.verifyingContract.toLowerCase()) {
166
+ return { ok: false, reason: 'agent_mismatch' };
167
+ }
168
+ if (opts.expectThumbprint !== undefined && opts.expectThumbprint !== b.jwkThumbprint)
169
+ return { ok: false, reason: 'thumbprint_mismatch' };
170
+ if (opts.posture) {
171
+ const refusal = clientKeyScopeRefusal(b, opts.posture);
172
+ if (refusal)
173
+ return { ok: false, reason: 'scope_refused', detail: refusal };
174
+ }
175
+ if (!Number.isInteger(opts.currentCustodyEpoch) || opts.currentCustodyEpoch < 0)
176
+ return { ok: false, reason: 'bad_shape', detail: 'currentCustodyEpoch must be a non-negative integer' };
177
+ if (b.custodyEpoch !== opts.currentCustodyEpoch) {
178
+ return { ok: false, reason: 'stale_custody_epoch', detail: `bound under epoch ${b.custodyEpoch}; the account is at ${opts.currentCustodyEpoch}` };
179
+ }
180
+ const now = opts.now ?? Math.floor(Date.now() / 1000);
181
+ if (now < b.notBefore)
182
+ return { ok: false, reason: 'not_yet_valid' };
183
+ if (now > b.notAfter)
184
+ return { ok: false, reason: 'expired' };
185
+ let digest;
186
+ try {
187
+ digest = clientKeyBindingDigest(b, signed.chainId, signed.verifyingContract);
188
+ }
189
+ catch {
190
+ return { ok: false, reason: 'bad_shape' };
191
+ }
192
+ let valid;
193
+ try {
194
+ valid = await opts.erc1271Verifier.verifyHash({ address: signed.verifyingContract, hash: digest, signature: signed.signature });
195
+ }
196
+ catch {
197
+ return { ok: false, reason: 'signature_invalid' };
198
+ }
199
+ if (!valid)
200
+ return { ok: false, reason: 'signature_invalid' };
201
+ return { ok: true, smartAgent: signed.verifyingContract, digest };
202
+ }
203
+ export function clientKeyRecordRow(b) {
204
+ return { thumbprint: b.jwkThumbprint, alg: b.alg, scope: b.scope, clientId: b.clientId, custodyEpoch: b.custodyEpoch, notAfter: b.notAfter };
205
+ }
206
+ /** Validate a candidate record. `[]` when valid. */
207
+ export function validateClientKeysRecord(r) {
208
+ const issues = [];
209
+ if (typeof r !== 'object' || r === null || Array.isArray(r))
210
+ return ['clientKeys: must be an object'];
211
+ const x = r;
212
+ for (const k of Object.keys(x))
213
+ if (k !== 'v' && k !== 'keys')
214
+ issues.push(`clientKeys.${k}: unknown property`);
215
+ if (x.v !== 1)
216
+ issues.push('clientKeys.v: must be 1');
217
+ if (!Array.isArray(x.keys))
218
+ return [...issues, 'clientKeys.keys: must be an array'];
219
+ const seen = new Set();
220
+ x.keys.forEach((row, i) => {
221
+ const p = `clientKeys.keys[${i}]`;
222
+ if (typeof row !== 'object' || row === null || Array.isArray(row)) {
223
+ issues.push(`${p}: must be an object`);
224
+ return;
225
+ }
226
+ const y = row;
227
+ for (const k of Object.keys(y))
228
+ if (!['thumbprint', 'alg', 'scope', 'clientId', 'custodyEpoch', 'notAfter'].includes(k))
229
+ issues.push(`${p}.${k}: unknown property`);
230
+ if (typeof y.thumbprint !== 'string')
231
+ issues.push(`${p}.thumbprint: required`);
232
+ else {
233
+ try {
234
+ thumbprintToBytes32(y.thumbprint);
235
+ }
236
+ catch {
237
+ issues.push(`${p}.thumbprint: must be a base64url sha256`);
238
+ }
239
+ if (seen.has(y.thumbprint))
240
+ issues.push(`${p}.thumbprint: duplicate`);
241
+ seen.add(y.thumbprint);
242
+ }
243
+ if (typeof y.alg !== 'string' || !CLIENT_KEY_ALGS.includes(y.alg))
244
+ issues.push(`${p}.alg: must be one of ${CLIENT_KEY_ALGS.join(' | ')}`);
245
+ if (y.scope !== 'service' && y.scope !== 'person')
246
+ issues.push(`${p}.scope: must be service | person`);
247
+ if (typeof y.clientId !== 'string' || !HTTPS_URL.test(y.clientId))
248
+ issues.push(`${p}.clientId: must be an https URL`);
249
+ if (!Number.isInteger(y.custodyEpoch) || y.custodyEpoch < 0)
250
+ issues.push(`${p}.custodyEpoch: must be a non-negative integer`);
251
+ if (!Number.isInteger(y.notAfter) || y.notAfter < 0)
252
+ issues.push(`${p}.notAfter: must be a non-negative integer`);
253
+ });
254
+ return issues;
255
+ }
256
+ /** RFC 8785 canonical JSON — two equal records encode to identical bytes (as `atl:distribution`). */
257
+ export function encodeClientKeys(record) {
258
+ const issues = validateClientKeysRecord(record);
259
+ if (issues.length)
260
+ throw new InvalidProfileError(`ClientKeysRecordV1: ${issues.join('; ')}`);
261
+ return jcsCanonicalize(record);
262
+ }
263
+ /** Fail-closed: anything that is not a valid record is `null` — an unreadable record is an answer, never a guess (ADR-0013). */
264
+ export function decodeClientKeys(value) {
265
+ if (!value)
266
+ return null;
267
+ let parsed;
268
+ try {
269
+ parsed = JSON.parse(value);
270
+ }
271
+ catch {
272
+ return null;
273
+ }
274
+ return validateClientKeysRecord(parsed).length ? null : parsed;
275
+ }
276
+ /** The rows a verifier treats as LIVE now: current epoch, not past `notAfter`. Stale rows are dead, not pruned here. */
277
+ export function liveClientKeys(record, opts) {
278
+ const now = opts.now ?? Math.floor(Date.now() / 1000);
279
+ return record.keys.filter((k) => k.custodyEpoch === opts.currentCustodyEpoch && k.notAfter > now);
280
+ }
281
+ export { CLIENT_KEYS };
282
+ //# sourceMappingURL=client-key-binding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-key-binding.js","sourceRoot":"","sources":["../src/client-key-binding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,aAAa,EAA0B,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAMlD,MAAM,CAAC,MAAM,eAAe,GAA4B,CAAC,OAAO,EAAE,OAAO,CAAU,CAAC;AAkCpF,wGAAwG;AAExG,MAAM,CAAC,MAAM,8BAA8B,GAAG,4BAA4B,CAAC;AAC3E,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,CAAC;AAErD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,gBAAgB,EAAE;QAChB,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE;QACjC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;QACpC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE;QAC1C,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC/B,EAAE,IAAI,EAAE,cAA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zD,MAAM,MAAM,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAChD,IAAI,MAAM,CAAC,MAAM;QAAE,MAAM,IAAI,mBAAmB,CAAC,uBAAuB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7F,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,gIAAgI;AAChI,MAAM,UAAU,gBAAgB,CAAC,KAAgC;IAC/D,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;IAC1D,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,MAA6B,CAAC;AACzF,CAAC;AAED,wHAAwH;AACxH,MAAM,UAAU,cAAc,CAAC,MAA0B,EAAE,IAAmD;IAC5G,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IACtD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,IAAI,CAAC,mBAAmB,IAAI,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC;AACpG,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -44,6 +44,14 @@ export declare const SERVICE_ROLE: Hex;
44
44
  * itself (`buildSetDistributionCall`), never by a registry — a registry file is a PROJECTION of it.
45
45
  */
46
46
  export declare const DISTRIBUTION: Hex;
47
+ /**
48
+ * The SA-keyed CLIENT KEYS record (spec 442 §3; `client-key-binding.ts`). `getStringProperty(agent, CLIENT_KEYS)`
49
+ * → the JCS-canonical JSON of a `ClientKeysRecordV1`: the public half of every live `ClientKeyBindingV1`
50
+ * (thumbprint · alg · scope · clientId · custody epoch · notAfter). Written by the SA itself
51
+ * (`buildSetClientKeysCall`); what a JWKS / client metadata document / TAP key directory is PROJECTED from
52
+ * (ap-federation spec 443) and what a verifier checks a presented binding against. Never a signature, never a key.
53
+ */
54
+ export declare const CLIENT_KEYS: Hex;
47
55
  /**
48
56
  * The six platform keys an `AgentDistributionV1.binary` map may carry — verbatim from the ACP registry
49
57
  * `agent.schema.json` (`binaryDistribution.propertyNames.enum`). Any other key fails validation.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,EAAE,GAAoC,CAAC;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAIzD,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAG,CAAU,CAAC;AAEpD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,GAAuC,CAAC;AACjE,eAAO,MAAM,YAAY,EAAE,GAAyC,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,GAA0C,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,aAAa,oHAOhB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,EAAE,GAAoC,CAAC;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAIzD,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAG,CAAU,CAAC;AAEpD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,GAAuC,CAAC;AACjE,eAAO,MAAM,YAAY,EAAE,GAAyC,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,GAA0C,CAAC;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,GAAwC,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,aAAa,oHAOhB,CAAC"}
package/dist/constants.js CHANGED
@@ -48,6 +48,14 @@ export const SERVICE_ROLE = keccak256(toHex('atl:serviceRole'));
48
48
  * itself (`buildSetDistributionCall`), never by a registry — a registry file is a PROJECTION of it.
49
49
  */
50
50
  export const DISTRIBUTION = keccak256(toHex('atl:distribution'));
51
+ /**
52
+ * The SA-keyed CLIENT KEYS record (spec 442 §3; `client-key-binding.ts`). `getStringProperty(agent, CLIENT_KEYS)`
53
+ * → the JCS-canonical JSON of a `ClientKeysRecordV1`: the public half of every live `ClientKeyBindingV1`
54
+ * (thumbprint · alg · scope · clientId · custody epoch · notAfter). Written by the SA itself
55
+ * (`buildSetClientKeysCall`); what a JWKS / client metadata document / TAP key directory is PROJECTED from
56
+ * (ap-federation spec 443) and what a verifier checks a presented binding against. Never a signature, never a key.
57
+ */
58
+ export const CLIENT_KEYS = keccak256(toHex('atl:clientKeys'));
51
59
  /**
52
60
  * The six platform keys an `AgentDistributionV1.binary` map may carry — verbatim from the ACP registry
53
61
  * `agent.schema.json` (`binaryDistribution.propertyNames.enum`). Any other key fails validation.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAY,MAAM,MAAM,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,WAAW,GAAQ,SAAS,CAAC,KAAK,CAAC,YAAY,C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AAK,CAAC,eAAe,CAAC,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,YAAY,GAAQ,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAQ,SAAS,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAQ,SAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEnE;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,gBAAgB;CACR,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export { CAIP10_NAMESPACE_ALLOWLIST, AGENT_CARD_SCHEMA_VERSION, AUTH_ORIGIN, AGENT_TYPE, SERVICE_ROLE, DISTRIBUTION, ACP_PLATFORMS, } from './constants.js';
1
+ export { CAIP10_NAMESPACE_ALLOWLIST, AGENT_CARD_SCHEMA_VERSION, AUTH_ORIGIN, AGENT_TYPE, SERVICE_ROLE, DISTRIBUTION, CLIENT_KEYS, ACP_PLATFORMS, } from './constants.js';
2
+ export { CLIENT_KEY_ALGS, CLIENT_KEY_BINDING_DOMAIN_NAME, CLIENT_KEY_BINDING_DOMAIN_VERSION, CLIENT_KEY_BINDING_TYPES, CLIENT_KEY_BINDING_TYPE_STRING, CLIENT_KEY_BINDING_DEFAULT_TTL_SECONDS, clientKeyBindingDomain, clientKeyBindingMessage, clientKeyBindingDigest, validateClientKeyBinding, clientKeyScopeRefusal, assertClientKeyScopeAllowed, buildSignedClientKeyBinding, verifySignedClientKeyBinding, clientKeyRecordRow, validateClientKeysRecord, encodeClientKeys, decodeClientKeys, liveClientKeys, type ClientKeyAlg, type ClientKeyScope, type ClientKeyBindingV1, type SignedClientKeyBindingV1, type BuildSignedClientKeyBindingInput, type VerifyClientKeyBindingOptions, type VerifyClientKeyBindingResult, type ClientKeyRecordRowV1, type ClientKeysRecordV1, } from './client-key-binding.js';
2
3
  export { validateDistribution, encodeDistribution, decodeDistribution, } from './distribution.js';
3
4
  export { derivedTypeId, decodeDerivedTypeId, profileTypesForDerivedType, isProfileTypeConsistent, } from './derived-type.js';
4
5
  export { buildCaip10Address, parseCaip10, isValidCaip10, type Caip10Parts, } from './caip10.js';
@@ -8,5 +9,5 @@ export { InvalidProfileError, ProfileHashMismatchError, EndpointVerificationErro
8
9
  export type { ProfileType, Caip10Address, VerificationMethod, AiAgentProfile, McpServerProfile, MultisigProfile, ServiceProfile, CanonicalAgentProfileV1, AcpPlatform, AgentPackageDistributionV1, AgentBinaryTargetV1, AgentDistributionV1, ProtocolFeatureSetV1, Sha256, SignedCanonicalProfileBundleV1, AgentCard, SignedAgentCardBundleV1, AgentIdentityClientOpts, PublishProfileInput, } from './types.js';
9
10
  export { AgentIdentityClient, type WriteContext } from './client.js';
10
11
  export { agentProfileResolverAbi } from './abis.js';
11
- export { buildRegisterProfileCall, buildSetProfileMetadataCall, buildSetProfileStringCall, buildSetDistributionCall, buildSetProfileAddressCall, buildSetProfileBytes32Call, buildSetProfileActiveCall, type ContractCall, } from './calls.js';
12
+ export { buildRegisterProfileCall, buildSetProfileMetadataCall, buildSetProfileStringCall, buildSetDistributionCall, buildSetClientKeysCall, buildSetProfileAddressCall, buildSetProfileBytes32Call, buildSetProfileActiveCall, type ContractCall, } from './calls.js';
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAItB,OAAO,EACL,oBAAoB,EACpB,iCAAiC,EACjC,kCAAkC,EAElC,aAAa,EACb,0BAA0B,EAC1B,2BAA2B,EAC3B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,GACjC,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,0BAA0B,EAC1B,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,MAAM,EACN,8BAA8B,EAE9B,SAAS,EACT,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAMrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAIpD,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,0BAA0B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Aa,CAAC;AAErB,YAAY,EACV,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,WAAW,EACX,0BAA0B,EAC1B,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,MAAM,EACN,8BAA8B,EAE9B,SAAS,EACT,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAMrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAIpD,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -6,7 +6,10 @@
6
6
  // - specs/217-agent-profile.md — the contract
7
7
  // - docs/architecture/decisions/0007-agent-identity-stack-three-packages.md
8
8
  // - docs/architecture/decisions/0008-caip10-nativeid-record-predicate.md
9
- export { CAIP10_NAMESPACE_ALLOWLIST, AGENT_CARD_SCHEMA_VERSION, AUTH_ORIGIN, AGENT_TYPE, SERVICE_ROLE, DISTRIBUTION, ACP_PLATFORMS, } from './constants.js';
9
+ export { CAIP10_NAMESPACE_ALLOWLIST, AGENT_CARD_SCHEMA_VERSION, AUTH_ORIGIN, AGENT_TYPE, SERVICE_ROLE, DISTRIBUTION, CLIENT_KEYS, ACP_PLATFORMS, } from './constants.js';
10
+ // A client key the Smart Agent may PRESENT with at external doors (spec 442 §3) — a credential, never authority;
11
+ // the public half on chain as `atl:clientKeys`. The §7 posture rule and the custody-epoch rule run here.
12
+ export { CLIENT_KEY_ALGS, CLIENT_KEY_BINDING_DOMAIN_NAME, CLIENT_KEY_BINDING_DOMAIN_VERSION, CLIENT_KEY_BINDING_TYPES, CLIENT_KEY_BINDING_TYPE_STRING, CLIENT_KEY_BINDING_DEFAULT_TTL_SECONDS, clientKeyBindingDomain, clientKeyBindingMessage, clientKeyBindingDigest, validateClientKeyBinding, clientKeyScopeRefusal, assertClientKeyScopeAllowed, buildSignedClientKeyBinding, verifySignedClientKeyBinding, clientKeyRecordRow, validateClientKeysRecord, encodeClientKeys, decodeClientKeys, liveClientKeys, } from './client-key-binding.js';
10
13
  // `distribution` canonical-profile fact (spec 347 §8.5): how to obtain + run the agent's software.
11
14
  export { validateDistribution, encodeDistribution, decodeDistribution, } from './distribution.js';
12
15
  // Derived-type consistency (spec 346 §2.3 / §6.2).
@@ -27,5 +30,5 @@ export { AgentIdentityClient } from './client.js';
27
30
  export { agentProfileResolverAbi } from './abis.js';
28
31
  // Phase 4 pure call builders. Compose into AgentAccount.execute /
29
32
  // CustodyPolicy ceremonies / ERC-4337 UserOps as needed.
30
- export { buildRegisterProfileCall, buildSetProfileMetadataCall, buildSetProfileStringCall, buildSetDistributionCall, buildSetProfileAddressCall, buildSetProfileBytes32Call, buildSetProfileActiveCall, } from './calls.js';
33
+ export { buildRegisterProfileCall, buildSetProfileMetadataCall, buildSetProfileStringCall, buildSetDistributionCall, buildSetClientKeysCall, buildSetProfileAddressCall, buildSetProfileBytes32Call, buildSetProfileActiveCall, } from './calls.js';
31
34
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,OAAO;AACP,0CAA0C;AAC1C,2BAA2B;AAC3B,gDAAgD;AAChD,8EAA8E;AAC9E,2EAA2E;AAE3E,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,mGAAmG;AACnG,OAAO,EAC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B,EACtB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,GAE1B,MAAM,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticprimitives/agent-profile",
3
- "version": "1.0.0-alpha.38",
3
+ "version": "1.0.0-alpha.39",
4
4
  "description": "Agent identity SDK: AP-native Canonical Agent Profile (CanonicalAgentProfileV1) + signed profile bundle, CAIP-10 nativeId helpers, endpoint verification methods, and the A2A 1.0 Agent Card model (./a2a: JCS canonical bytes, ES256 JWS, EIP-712 Smart Agent binding, field provenance, pure validation, import, release lifecycle). External registry projections stay outside Ring 0.",
5
5
  "homepage": "https://agenticprimitives.dev",
6
6
  "bugs": {
@@ -52,9 +52,9 @@
52
52
  },
53
53
  "peerDependencies": {
54
54
  "viem": "^2.52.2",
55
- "@agenticprimitives/agent-account": "^1.0.0-alpha.38",
56
- "@agenticprimitives/connect-auth": "^1.0.0-alpha.38",
57
- "@agenticprimitives/types": "^1.0.0-alpha.38"
55
+ "@agenticprimitives/agent-account": "^1.0.0-alpha.39",
56
+ "@agenticprimitives/connect-auth": "^1.0.0-alpha.39",
57
+ "@agenticprimitives/types": "^1.0.0-alpha.39"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/node": "^22.7.0",