@agenticprimitives/account-custody 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.
package/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  # @agenticprimitives/account-custody
2
2
 
3
- Custody-layer SDK for Smart Agent account safety and recovery.
3
+ > Part of **[Agentic Primitives](https://agenticprimitives.dev)** — the open-source trust substrate for agentic applications: identity that can sign, authority checked at act time, evidence the owner carries. [Developer kit](https://github.com/agentictrustlabs/agentic-primitives) · [All packages](https://agenticprimitives.dev/developers)
4
4
 
5
- This package owns the TypeScript surface around `CustodyPolicy`: ABI exports,
6
- `CustodyAction` argument builders, EIP-712 typed data, quorum signature packing,
7
- and custody-domain types.
5
+ **Custody is not authority.**
6
+
7
+ Most stacks blur the two: the key that lets an agent act is also the key that controls the account, so a leaked session becomes a lost identity. This package exists to keep them apart. Credential add, replace, and remove on a Smart Agent are custody-policy operations — gated by trustee quorums, guardian quorums, multi-credential self-recovery, or multi-sig — and are never modeled as delegations ([ADR-0011](../../docs/architecture/decisions/0011-credential-recovery-and-re-association.md), [spec 221](../../specs/221-credential-recovery.md)). A delegated party can act within its caveats; it can never promote itself into custody.
8
+
9
+ The payoff is recovery without identity loss. `CustodyAction.RecoverAccount` performs an atomic add-new + remove-old credential rotation under the account's custody policy. The canonical Smart Agent address never changes; every delegation it ever issued stays valid; only the credential set moves. This package is the TypeScript surface for that machinery: the `CustodyPolicy` ABI, `CustodyAction` argument builders, EIP-712 typed data, quorum signature packing, and the custody-domain types.
10
+
11
+ > Part of [agenticprimitives](../../README.md) — the trust substrate for the agent economy: one canonical Smart Agent identity with custody, delegation, naming, credentials, and audit evidence designed as one system.
8
12
 
9
13
  ## Install
10
14
 
@@ -23,6 +27,17 @@ import {
23
27
  } from '@agenticprimitives/account-custody';
24
28
  ```
25
29
 
30
+ What you get:
31
+
32
+ - `custodyPolicyAbi` — the ABI for the on-chain `CustodyPolicy` ERC-7579 module ([`packages/contracts/src/custody/CustodyPolicy.sol`](../contracts/src/custody/CustodyPolicy.sol)), kept in lockstep with the deployed bytecode.
33
+ - `CustodyAction` enum (a mirror of the on-chain enum) plus per-action `buildXxxArgs` encoders — including `buildRecoverAccountArgs` for credential rotation.
34
+ - EIP-712 typed-data shapes for `ScheduleCustodyChangeRequest` / `ApplyCustodyChangeRequest` / `CancelScheduledChangeRequest`, with `custodyDomain({ chainId, verifyingContract })` — guaranteed to hash to the same `structHash` the Solidity computes.
35
+ - Quorum signature packing (`packQuorumSigs`) and custody-domain types: `Custodian`, `Trustee`, `CustodyCouncil`, `ScheduledChange`, `CustodyMode`, `RiskTier`.
36
+
37
+ ## How it's different
38
+
39
+ The common pattern for org control and recovery is a third-party multi-sig (Safe) plus a separate recovery product (Argent-style guardians) bolted onto an account they don't define. That works until the seams matter: the multi-sig's notion of "owner" and the recovery product's notion of "guardian" are different identity models, and neither knows about the delegations the account has issued. Here custody is a native ERC-7579 module on the same Smart Agent — quorums, trustees, scheduled changes, and recovery in one policy, designed alongside the delegation layer it explicitly firewalls ([spec 213](../../specs/213-custody-layer-carve-out.md)). No third-party multi-sig dependency; we ported the signature-packing patterns worth porting and own the rest.
40
+
26
41
  ## Boundary
27
42
 
28
43
  This package speaks custody vocabulary only:
@@ -33,8 +48,7 @@ This package speaks custody vocabulary only:
33
48
  - `CustodyAction`
34
49
  - `ScheduledChange`
35
50
 
36
- It does not own delegation caveats, MCP transport, passkey ceremonies, account
37
- deployment, or key-custody providers. See `CLAUDE.md` for routing.
51
+ It does not own delegation caveats, MCP transport, passkey ceremonies, account deployment, or key-custody providers (note: `key-custody` is *key* custody — KMS backends; this is *account* custody). See [`CLAUDE.md`](CLAUDE.md) for routing and [`spec.md`](spec.md) for the contract.
38
52
 
39
53
  ## Validate
40
54
 
@@ -42,3 +56,7 @@ deployment, or key-custody providers. See `CLAUDE.md` for routing.
42
56
  pnpm --filter @agenticprimitives/account-custody typecheck
43
57
  pnpm --filter @agenticprimitives/account-custody test
44
58
  ```
59
+
60
+ ## Status
61
+
62
+ Testnet/pilot-ready. Production launch is gated on the public checklist in the root README — including third-party contract audit and governance key rotation. Track every security finding live in [`docs/audits/findings.yaml`](../../docs/audits/findings.yaml).
package/dist/actions.d.ts CHANGED
@@ -15,7 +15,10 @@ export declare enum CustodyAction {
15
15
  ChangeValueCeiling = 12,
16
16
  SetRecoveryApprovals = 13,
17
17
  RecoverAccount = 14,
18
- ChangeApprovalsRequired = 15
18
+ ChangeApprovalsRequired = 15,
19
+ /** Spec 410 §1.2 (contracts generation 3) — a PLANNED rotation: one credential in, one out, every standing
20
+ * approved-digest wire re-approved under the new custody epoch, in one applied change. T4. */
21
+ RotateCredential = 16
19
22
  }
20
23
  export declare function buildAddCustodianArgs(custodian: Address): Hex;
21
24
  export declare function buildRemoveCustodianArgs(custodian: Address): Hex;
@@ -42,15 +45,23 @@ export declare function buildApplySystemUpdateArgs(newImpl: Address): Hex;
42
45
  */
43
46
  export declare function buildChangeApprovalsRequiredArgs(tier: number, newCount: number): Hex;
44
47
  /**
45
- * Encode args for `AddPasskeyCredential(credentialIdDigest, x, y)`.
48
+ * Encode args for `AddPasskeyCredential(credentialIdDigest, x, y, rpIdHash)`.
46
49
  * Side effect on AgentAccount: also registers the PIA derived from
47
50
  * `(x, y)` as a first-class custodian.
48
51
  *
49
52
  * Wave 2C C-6 hardening: on-chain initializer rejects credentialIdDigest
50
53
  * == 0; this builder echoes that check at the wire-format boundary so
51
54
  * the demo never spends gas on a guaranteed-revert tx.
55
+ *
56
+ * H7-C.1 / CON-WEBAUTHN-001 (encoded shape updated 2026-06-01): the
57
+ * on-chain `CustodyPolicy.AddPasskeyCredential` decoder reads 4 fields
58
+ * `(bytes32, uint256, uint256, bytes32)` and forwards `rpIdHash` to
59
+ * `AgentAccount.addPasskey(...)`. `addPasskey` reverts on `rpIdHash ==
60
+ * bytes32(0)` (`InvalidRpIdHash`), so the SDK MUST require a non-zero
61
+ * rpIdHash here. Encoding only 3 fields produced silent-reverts in the
62
+ * inner userOp (Act 3 'AddPasskey Bob on Org' live debug).
52
63
  */
53
- export declare function buildAddPasskeyCredentialArgs(credentialIdDigest: Hex, x: bigint, y: bigint): Hex;
64
+ export declare function buildAddPasskeyCredentialArgs(credentialIdDigest: Hex, x: bigint, y: bigint, rpIdHash: Hex): Hex;
54
65
  /** Encode args for `RemovePasskeyCredential(credentialIdDigest)`. */
55
66
  export declare function buildRemovePasskeyCredentialArgs(credentialIdDigest: Hex): Hex;
56
67
  /**
@@ -67,6 +78,11 @@ export interface RecoveryPasskeyAdd {
67
78
  credentialIdDigest: Hex;
68
79
  x: bigint;
69
80
  y: bigint;
81
+ /** H7-C.1 / CON-WEBAUTHN-001: rpIdHash binds the passkey to its RP. Required
82
+ * by the on-chain `AgentAccountRecoveryPasskeyAdd` struct (IAgentAccount.sol).
83
+ * The recovery handler `CustodyPolicy._applyRecoverAccount` forwards this to
84
+ * `AgentAccount.addPasskey(...)` which reverts `InvalidRpIdHash()` on zero. */
85
+ rpIdHash: Hex;
70
86
  }
71
87
  /**
72
88
  * Encode args for `RecoverAccount(args)` — atomic add/remove of owners
@@ -87,4 +103,35 @@ export declare function buildRecoverAccountArgs(args: {
87
103
  addPasskeys?: readonly RecoveryPasskeyAdd[];
88
104
  removePasskeyCredentialIdDigests?: readonly Hex[];
89
105
  }): Hex;
106
+ /**
107
+ * Encode args for `RotateCredential(args)` — spec 410 §1.2, contracts generation 3. Exactly one credential
108
+ * is added (`addOwner` XOR `addPasskey`) and exactly one retired (`removeOwner` XOR
109
+ * `removePasskeyCredentialIdDigest`); `reapprove` lists the delegation digests the module re-approves AFTER
110
+ * the retirement through `AgentAccount.approveDigest`, so each key is derived on chain under the new epoch.
111
+ *
112
+ * This is the ONLY custody action that carries a re-approval list. `buildRecoverAccountArgs` has no such
113
+ * field: recovery re-approves nothing and ends with `revokeAllApprovedDigests` (THESIS-1a).
114
+ *
115
+ * Solidity struct (packages/contracts/src/IAgentAccount.sol):
116
+ * struct AgentAccountRotateCredentialArgs {
117
+ * address addOwner;
118
+ * AgentAccountRecoveryPasskeyAdd addPasskey; // (bytes32 credentialIdDigest, uint256 x, uint256 y, bytes32 rpIdHash)
119
+ * address removeOwner;
120
+ * bytes32 removePasskeyCredentialIdDigest;
121
+ * bytes32[] reapprove;
122
+ * }
123
+ */
124
+ export declare function buildRotateCredentialArgs(args: {
125
+ add: {
126
+ owner: Address;
127
+ } | {
128
+ passkey: RecoveryPasskeyAdd;
129
+ };
130
+ remove: {
131
+ owner: Address;
132
+ } | {
133
+ passkeyCredentialIdDigest: Hex;
134
+ };
135
+ reapprove: readonly Hex[];
136
+ }): Hex;
90
137
  //# sourceMappingURL=actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAQA,OAAO,EAAuB,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAEnE,oBAAY,aAAa;IACvB,YAAY,IAAI;IAChB,eAAe,IAAI;IACnB,oBAAoB,IAAI;IACxB,uBAAuB,IAAI;IAC3B,UAAU,IAAI;IACd,aAAa,IAAI;IACjB,iBAAiB,IAAI;IACrB,iBAAiB,IAAI;IACrB,uBAAuB,IAAI;IAC3B,eAAe,IAAI;IACnB,mBAAmB,KAAK;IACxB,mBAAmB,KAAK;IACxB,kBAAkB,KAAK;IACvB,oBAAoB,KAAK;IACzB,cAAc,KAAK;IACnB,uBAAuB,KAAK;CAC7B;AAuCD,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,GAAG,GAAG,CAG7D;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,OAAO,GAAG,GAAG,CAGhE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAGzD;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,GAAG,CAG5D;AAED,wBAAgB,0BAA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
  CustodyAction[CustodyAction["RecoverAccount"] = 14] = "RecoverAccount";
26
26
  CustodyAction[CustodyAction["ChangeApprovalsRequired"] = 15] = "ChangeApprovalsRequired";
27
+ /** Spec 410 §1.2 (contracts generation 3) — a PLANNED rotation: one credential in, one out, every standing
28
+ * approved-digest wire re-approved under the new custody epoch, in one applied change. T4. */
29
+ CustodyAction[CustodyAction["RotateCredential"] = 16] = "RotateCredential";
27
30
  })(CustodyAction || (CustodyAction = {}));
28
31
  // ─── Range / shape validators ────────────────────────────────────────────
29
32
  const ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
@@ -108,22 +111,34 @@ export function buildChangeApprovalsRequiredArgs(tier, newCount) {
108
111
  return encodeAbiParameters([{ type: 'uint8' }, { type: 'uint8' }], [tier, newCount]);
109
112
  }
110
113
  /**
111
- * Encode args for `AddPasskeyCredential(credentialIdDigest, x, y)`.
114
+ * Encode args for `AddPasskeyCredential(credentialIdDigest, x, y, rpIdHash)`.
112
115
  * Side effect on AgentAccount: also registers the PIA derived from
113
116
  * `(x, y)` as a first-class custodian.
114
117
  *
115
118
  * Wave 2C C-6 hardening: on-chain initializer rejects credentialIdDigest
116
119
  * == 0; this builder echoes that check at the wire-format boundary so
117
120
  * the demo never spends gas on a guaranteed-revert tx.
121
+ *
122
+ * H7-C.1 / CON-WEBAUTHN-001 (encoded shape updated 2026-06-01): the
123
+ * on-chain `CustodyPolicy.AddPasskeyCredential` decoder reads 4 fields
124
+ * `(bytes32, uint256, uint256, bytes32)` and forwards `rpIdHash` to
125
+ * `AgentAccount.addPasskey(...)`. `addPasskey` reverts on `rpIdHash ==
126
+ * bytes32(0)` (`InvalidRpIdHash`), so the SDK MUST require a non-zero
127
+ * rpIdHash here. Encoding only 3 fields produced silent-reverts in the
128
+ * inner userOp (Act 3 'AddPasskey Bob on Org' live debug).
118
129
  */
119
- export function buildAddPasskeyCredentialArgs(credentialIdDigest, x, y) {
130
+ export function buildAddPasskeyCredentialArgs(credentialIdDigest, x, y, rpIdHash) {
120
131
  assertBytes32('AddPasskeyCredential.credentialIdDigest', credentialIdDigest);
121
132
  if (credentialIdDigest === ('0x' + '00'.repeat(32))) {
122
133
  throw new RangeError('[custody] AddPasskeyCredential.credentialIdDigest: must be non-zero (audit C-6)');
123
134
  }
124
135
  assertUint256('AddPasskeyCredential.x', x, 1n);
125
136
  assertUint256('AddPasskeyCredential.y', y, 1n);
126
- return encodeAbiParameters([{ type: 'bytes32' }, { type: 'uint256' }, { type: 'uint256' }], [credentialIdDigest, x, y]);
137
+ assertBytes32('AddPasskeyCredential.rpIdHash', rpIdHash);
138
+ if (rpIdHash === ('0x' + '00'.repeat(32))) {
139
+ throw new RangeError('[custody] AddPasskeyCredential.rpIdHash: must be non-zero (AgentAccount.addPasskey reverts on zero rpIdHash — H7-C.1)');
140
+ }
141
+ return encodeAbiParameters([{ type: 'bytes32' }, { type: 'uint256' }, { type: 'uint256' }, { type: 'bytes32' }], [credentialIdDigest, x, y, rpIdHash]);
127
142
  }
128
143
  /** Encode args for `RemovePasskeyCredential(credentialIdDigest)`. */
129
144
  export function buildRemovePasskeyCredentialArgs(credentialIdDigest) {
@@ -171,6 +186,10 @@ export function buildRecoverAccountArgs(args) {
171
186
  }
172
187
  assertUint256('RecoverAccount.addPasskeys.x', p.x, 1n);
173
188
  assertUint256('RecoverAccount.addPasskeys.y', p.y, 1n);
189
+ assertBytes32('RecoverAccount.addPasskeys.rpIdHash', p.rpIdHash);
190
+ if (p.rpIdHash === ('0x' + '00'.repeat(32))) {
191
+ throw new RangeError('[custody] RecoverAccount.addPasskeys: rpIdHash must be non-zero (H7-C.1 — AgentAccount.addPasskey reverts on zero)');
192
+ }
174
193
  }
175
194
  for (const d of removePasskeyCredentialIdDigests) {
176
195
  assertBytes32('RecoverAccount.removePasskeyCredentialIdDigests', d);
@@ -194,6 +213,10 @@ export function buildRecoverAccountArgs(args) {
194
213
  { name: 'credentialIdDigest', type: 'bytes32' },
195
214
  { name: 'x', type: 'uint256' },
196
215
  { name: 'y', type: 'uint256' },
216
+ // H7-C.1 / CON-WEBAUTHN-001: AgentAccountRecoveryPasskeyAdd struct
217
+ // gained rpIdHash. Off-chain encoder was missing it (drift bug
218
+ // fixed 2026-06-01, same class as PRs #91, #92, #95).
219
+ { name: 'rpIdHash', type: 'bytes32' },
197
220
  ],
198
221
  },
199
222
  { name: 'removePasskeyCredentialIdDigests', type: 'bytes32[]' },
@@ -206,4 +229,74 @@ export function buildRecoverAccountArgs(args) {
206
229
  removePasskeyCredentialIdDigests: removePasskeyCredentialIdDigests,
207
230
  }]);
208
231
  }
232
+ /**
233
+ * Encode args for `RotateCredential(args)` — spec 410 §1.2, contracts generation 3. Exactly one credential
234
+ * is added (`addOwner` XOR `addPasskey`) and exactly one retired (`removeOwner` XOR
235
+ * `removePasskeyCredentialIdDigest`); `reapprove` lists the delegation digests the module re-approves AFTER
236
+ * the retirement through `AgentAccount.approveDigest`, so each key is derived on chain under the new epoch.
237
+ *
238
+ * This is the ONLY custody action that carries a re-approval list. `buildRecoverAccountArgs` has no such
239
+ * field: recovery re-approves nothing and ends with `revokeAllApprovedDigests` (THESIS-1a).
240
+ *
241
+ * Solidity struct (packages/contracts/src/IAgentAccount.sol):
242
+ * struct AgentAccountRotateCredentialArgs {
243
+ * address addOwner;
244
+ * AgentAccountRecoveryPasskeyAdd addPasskey; // (bytes32 credentialIdDigest, uint256 x, uint256 y, bytes32 rpIdHash)
245
+ * address removeOwner;
246
+ * bytes32 removePasskeyCredentialIdDigest;
247
+ * bytes32[] reapprove;
248
+ * }
249
+ */
250
+ export function buildRotateCredentialArgs(args) {
251
+ const ZERO32 = ('0x' + '00'.repeat(32));
252
+ const ZERO_ADDR = ('0x' + '00'.repeat(20));
253
+ let addOwner = ZERO_ADDR;
254
+ let addPasskey = { credentialIdDigest: ZERO32, x: 0n, y: 0n, rpIdHash: ZERO32 };
255
+ if ('owner' in args.add) {
256
+ assertAddress('RotateCredential.add.owner', args.add.owner);
257
+ if (args.add.owner === ZERO_ADDR)
258
+ throw new RangeError('[custody] RotateCredential.add.owner: must be non-zero');
259
+ addOwner = args.add.owner;
260
+ }
261
+ else {
262
+ const p = args.add.passkey;
263
+ assertBytes32('RotateCredential.add.passkey.credentialIdDigest', p.credentialIdDigest);
264
+ if (p.credentialIdDigest === ZERO32)
265
+ throw new RangeError('[custody] RotateCredential.add.passkey: credentialIdDigest must be non-zero (audit C-6)');
266
+ assertUint256('RotateCredential.add.passkey.x', p.x, 1n);
267
+ assertUint256('RotateCredential.add.passkey.y', p.y, 1n);
268
+ assertBytes32('RotateCredential.add.passkey.rpIdHash', p.rpIdHash);
269
+ if (p.rpIdHash === ZERO32)
270
+ throw new RangeError('[custody] RotateCredential.add.passkey: rpIdHash must be non-zero (H7-C.1)');
271
+ addPasskey = p;
272
+ }
273
+ let removeOwner = ZERO_ADDR;
274
+ let removePasskeyCredentialIdDigest = ZERO32;
275
+ if ('owner' in args.remove) {
276
+ assertAddress('RotateCredential.remove.owner', args.remove.owner);
277
+ if (args.remove.owner === ZERO_ADDR)
278
+ throw new RangeError('[custody] RotateCredential.remove.owner: must be non-zero');
279
+ removeOwner = args.remove.owner;
280
+ }
281
+ else {
282
+ assertBytes32('RotateCredential.remove.passkeyCredentialIdDigest', args.remove.passkeyCredentialIdDigest);
283
+ if (args.remove.passkeyCredentialIdDigest === ZERO32)
284
+ throw new RangeError('[custody] RotateCredential.remove.passkeyCredentialIdDigest: must be non-zero');
285
+ removePasskeyCredentialIdDigest = args.remove.passkeyCredentialIdDigest;
286
+ }
287
+ for (const d of args.reapprove)
288
+ assertBytes32('RotateCredential.reapprove', d);
289
+ return encodeAbiParameters([{
290
+ type: 'tuple',
291
+ components: [
292
+ { name: 'addOwner', type: 'address' },
293
+ { name: 'addPasskey', type: 'tuple', components: [
294
+ { name: 'credentialIdDigest', type: 'bytes32' }, { name: 'x', type: 'uint256' }, { name: 'y', type: 'uint256' }, { name: 'rpIdHash', type: 'bytes32' },
295
+ ] },
296
+ { name: 'removeOwner', type: 'address' },
297
+ { name: 'removePasskeyCredentialIdDigest', type: 'bytes32' },
298
+ { name: 'reapprove', type: 'bytes32[]' },
299
+ ],
300
+ }], [{ addOwner, addPasskey, removeOwner, removePasskeyCredentialIdDigest, reapprove: [...args.reapprove] }]);
301
+ }
209
302
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,0EAA0E;AAC1E,2EAA2E;AAC3E,EAAE;AACF,sEAAsE;AACtE,kEAAkE;AAClE,2BAA2B;AAE3B,OAAO,EAAE,mBAAmB,EAA0B,MAAM,MAAM,CAAC;AAEnE,MAAM,CAAN,IAAY,aAiBX;AAjBD,WAAY,aAAa;IACvB,iEAAgB,CAAA;IAChB,uEAAmB,CAAA;IACnB,iFAAwB,CAAA;IACxB,uFAA2B,CAAA;IAC3B,6DAAc,CAAA;IACd,mEAAiB,CAAA;IACjB,2EAAqB,CAAA;IACrB,2EAAqB,CAAA;IACrB,uFAA2B,CAAA;IAC3B,uEAAmB,CAAA;IACnB,gFAAwB,CAAA;IACxB,gFAAwB,CAAA;IACxB,8EAAuB,CAAA;IACvB,kFAAyB,CAAA;IACzB,sEAAmB,CAAA;IACnB,wFAA4B,CAAA;AAC9B,CAAC,EAjBW,aAAa,KAAb,aAAa,QAiBxB;AAED,4EAA4E;AAE5E,MAAM,UAAU,GAAG,qBAAqB,CAAC;AACzC,MAAM,UAAU,GAAG,qBAAqB,CAAC;AACzC,MAAM,QAAQ,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AACnC,MAAM,MAAM,GAAG,GAAG,CAAC;AAEnB,SAAS,aAAa,CAAC,KAAa,EAAE,CAAU;IAC9C,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,UAAU,CAAC,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 -0,0 +1,91 @@
1
+ import { type Address, type Hex } from 'viem';
2
+ import { CustodyAction } from './actions.js';
3
+ /** The same shape `@agenticprimitives/agent-account` executes (`ContractCall`); declared structurally so this package
4
+ * keeps its vocabulary firewall (spec 213) and no dependency on the account SDK. */
5
+ export interface CustodyCall {
6
+ to: Address;
7
+ value: bigint;
8
+ data: Hex;
9
+ }
10
+ /** ERC-7579 executor module type id — `AgentAccount.MODULE_TYPE_EXECUTOR`. */
11
+ export declare const MODULE_TYPE_EXECUTOR = 2n;
12
+ /** Tier indices as the contract's arrays use them (index = tier; index 0 unused). Spec 207 §5. */
13
+ export declare const TIER: {
14
+ readonly read: 1;
15
+ readonly write: 2;
16
+ readonly value: 3;
17
+ readonly admin: 4;
18
+ readonly critical: 5;
19
+ readonly recovery: 6;
20
+ };
21
+ export interface CustodyPolicyInstallInput {
22
+ /** 1 hybrid (the Home's person default) · 2 threshold · 3 org. Mode 0 means "no policy" and is never installed. */
23
+ mode: 1 | 2 | 3;
24
+ /** Smart Agent addresses (verified by ERC-1271 in the quorum), never raw keys. */
25
+ trustees: readonly Address[];
26
+ /** T6 trustee quorum; must be ≤ trustees.length (CP-2). Defaults to a majority: floor(N/2) + 1. */
27
+ recoveryApprovals?: number;
28
+ /** approvalsRequired by tier, index = tier. Unset tiers take the contract's defaults (CP-1 floor). */
29
+ approvalsByTier?: Partial<Record<1 | 2 | 3 | 4 | 5, number>>;
30
+ /** safety delays in seconds by tier, index = tier. T6 MUST be > 0 — refused here, as the contract would at schedule time. */
31
+ delaysByTier?: Partial<Record<1 | 2 | 3 | 4 | 5 | 6, number>>;
32
+ /** T3 high-value ceiling in wei. */
33
+ t3HighValueCeiling?: bigint;
34
+ /** Turns on `v = 1` approved-hash quorum slots for this account; zero turns them off. */
35
+ approvedHashRegistry?: Address;
36
+ }
37
+ /** The Home's HYBRID defaults for a person (spec 422 §4.2): her own credential changes keep needing one of her own
38
+ * credentials (T4 = 1), and the delays match the factory's floors (T4 1h · T5 24h · T6 48h). */
39
+ export declare const HOME_HYBRID_DEFAULTS: {
40
+ readonly approvalsByTier: {
41
+ readonly 4: 1;
42
+ readonly 5: 1;
43
+ };
44
+ readonly delaysByTier: {
45
+ readonly 4: 3600;
46
+ readonly 5: 86400;
47
+ readonly 6: 172800;
48
+ };
49
+ readonly t3HighValueCeiling: 10000000000000000n;
50
+ };
51
+ export declare const majorityOf: (n: number) => number;
52
+ /** `abi.encode(uint8 mode, uint8 recThr, address[] trustees, uint8[7] thresholds, uint32[7] delays, uint256 t3, address reg)`. */
53
+ export declare function buildCustodyPolicyInstallData(input: CustodyPolicyInstallInput): Hex;
54
+ /** `execute(self, installModule(EXECUTOR, custodyPolicy, data))` — the ONE self-call that names a person's trustees.
55
+ * Signed by a credential that signs for her today; after it lands the account is custody-governed. */
56
+ export declare function installCustodyPolicyCall(account: Address, custodyPolicy: Address, installData: Hex): CustodyCall;
57
+ export declare function scheduleCustodyChangeCall(custodyPolicy: Address, input: {
58
+ account: Address;
59
+ action: CustodyAction;
60
+ args: Hex;
61
+ quorumSigs: Hex;
62
+ }): CustodyCall;
63
+ export declare function applyCustodyChangeCall(custodyPolicy: Address, input: {
64
+ account: Address;
65
+ changeId: bigint;
66
+ quorumSigs: Hex;
67
+ }): CustodyCall;
68
+ export declare function cancelScheduledChangeCall(custodyPolicy: Address, input: {
69
+ account: Address;
70
+ changeId: bigint;
71
+ quorumSigs: Hex;
72
+ }): CustodyCall;
73
+ export interface CustodyDigestInput {
74
+ chainId: number;
75
+ custodyPolicy: Address;
76
+ account: Address;
77
+ action: CustodyAction;
78
+ args: Hex;
79
+ changeId: bigint;
80
+ }
81
+ /** The digest a quorum signs to SCHEDULE: `changeId` is `scheduledChangeCount(account) + 1` at signing time. */
82
+ export declare function scheduleCustodyChangeDigest(i: CustodyDigestInput): Hex;
83
+ export declare function applyCustodyChangeDigest(i: CustodyDigestInput & {
84
+ eta: bigint;
85
+ }): Hex;
86
+ export declare function cancelScheduledChangeDigest(i: CustodyDigestInput & {
87
+ eta: bigint;
88
+ }): Hex;
89
+ /** A tier's safety delay, read from the chain, in words a person reads ("48 hours"). */
90
+ export declare function delayWords(seconds: number): string;
91
+ //# sourceMappingURL=governance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governance.d.ts","sourceRoot":"","sources":["../src/governance.ts"],"names":[],"mappings":"AAQA,OAAO,EAAqE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAEjH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C;qFACqF;AACrF,MAAM,WAAW,WAAW;IAAG,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE;AAEtE,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAMvC,kGAAkG;AAClG,eAAO,MAAM,IAAI;;;;;;;CAA+E,CAAC;AAEjG,MAAM,WAAW,yBAAyB;IACxC,mHAAmH;IACnH,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,kFAAkF;IAClF,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAC7B,mGAAmG;IACnG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sGAAsG;IACtG,eAAe,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7D,6HAA6H;IAC7H,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9D,oCAAoC;IACpC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,yFAAyF;IACzF,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;iGACi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AkB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,GAAG,CAErF;AACD,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,kBAAkB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,GAAG,CAExF;AAED,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKlD"}
@@ -0,0 +1,94 @@
1
+ // Spec 422 §4.2 / §4.3 — the custody-governance calls a HOME makes for a person: install the CustodyPolicy on a
2
+ // deployed mode-0 account (naming trustees), schedule / apply / cancel a custody change, and the EIP-712 digests the
3
+ // quorum signs. Pure builders over viem; nothing here talks to a chain.
4
+ //
5
+ // WHY AN INSTALL BUILDER WITH DEFAULTS: `CustodyPolicy.onInstall` stores delays VERBATIM and enforces no minimum
6
+ // (the factory's floors apply only at deploy). A post-deploy install that left T6 at 0 would succeed and leave
7
+ // `RecoverAccount` unschedulable (`TimelockRequiredForTier(6)`); one that left T4 at 0 would make every credential
8
+ // change immediate. The Home's hybrid install sets them explicitly — proven in `test/Spec422Recovery.t.sol`.
9
+ import { encodeAbiParameters, encodeFunctionData, hashTypedData, keccak256 } from 'viem';
10
+ import { custodyPolicyAbi } from './abi.js';
11
+ import { custodyDomain, ScheduleCustodyChangeRequest, ApplyCustodyChangeRequest, CancelScheduledChangeRequest } from './eip712.js';
12
+ /** ERC-7579 executor module type id — `AgentAccount.MODULE_TYPE_EXECUTOR`. */
13
+ export const MODULE_TYPE_EXECUTOR = 2n;
14
+ const INSTALL_MODULE_ABI = [
15
+ { type: 'function', name: 'installModule', stateMutability: 'nonpayable', inputs: [{ name: 'moduleTypeId', type: 'uint256' }, { name: 'module', type: 'address' }, { name: 'initData', type: 'bytes' }], outputs: [] },
16
+ ];
17
+ /** Tier indices as the contract's arrays use them (index = tier; index 0 unused). Spec 207 §5. */
18
+ export const TIER = { read: 1, write: 2, value: 3, admin: 4, critical: 5, recovery: 6 };
19
+ /** The Home's HYBRID defaults for a person (spec 422 §4.2): her own credential changes keep needing one of her own
20
+ * credentials (T4 = 1), and the delays match the factory's floors (T4 1h · T5 24h · T6 48h). */
21
+ export const HOME_HYBRID_DEFAULTS = {
22
+ approvalsByTier: { 4: 1, 5: 1 },
23
+ delaysByTier: { 4: 3600, 5: 86_400, 6: 172_800 },
24
+ t3HighValueCeiling: 10000000000000000n, // 0.01 ether, the factory's value
25
+ };
26
+ export const majorityOf = (n) => (n === 0 ? 0 : Math.floor(n / 2) + 1);
27
+ /** `abi.encode(uint8 mode, uint8 recThr, address[] trustees, uint8[7] thresholds, uint32[7] delays, uint256 t3, address reg)`. */
28
+ export function buildCustodyPolicyInstallData(input) {
29
+ if (![1, 2, 3].includes(input.mode))
30
+ throw new Error(`custody mode must be 1, 2 or 3 (got ${input.mode})`);
31
+ const trustees = [...new Set(input.trustees.map((t) => t.toLowerCase()))];
32
+ if (trustees.length !== input.trustees.length)
33
+ throw new Error('duplicate trustee');
34
+ if (trustees.some((t) => /^0x0{40}$/.test(t)))
35
+ throw new Error('a trustee must be an address');
36
+ const rec = input.recoveryApprovals ?? majorityOf(trustees.length);
37
+ if (rec > trustees.length)
38
+ throw new Error(`recovery approvals (${rec}) exceed the trustee count (${trustees.length})`);
39
+ if (trustees.length > 0 && rec === 0)
40
+ throw new Error('recovery approvals must be at least 1 when trustees are named');
41
+ const approvals = { ...HOME_HYBRID_DEFAULTS.approvalsByTier, ...(input.approvalsByTier ?? {}) };
42
+ const delays = { ...HOME_HYBRID_DEFAULTS.delaysByTier, ...(input.delaysByTier ?? {}) };
43
+ if (!(delays[6] > 0))
44
+ throw new Error('the recovery (T6) safety delay must be set — onInstall stores it verbatim and a zero makes RecoverAccount unschedulable');
45
+ if (!(delays[5] > 0))
46
+ throw new Error('the critical (T5) safety delay must be set');
47
+ const thresholds = [0, 0, 0, 0, 0, 0, 0];
48
+ const timelocks = [0, 0, 0, 0, 0, 0, 0];
49
+ for (const [k, v] of Object.entries(approvals))
50
+ thresholds[Number(k)] = Number(v);
51
+ for (const [k, v] of Object.entries(delays))
52
+ timelocks[Number(k)] = Number(v);
53
+ return encodeAbiParameters([{ type: 'uint8' }, { type: 'uint8' }, { type: 'address[]' }, { type: 'uint8[7]' }, { type: 'uint32[7]' }, { type: 'uint256' }, { type: 'address' }], [input.mode, rec, trustees, thresholds, timelocks, input.t3HighValueCeiling ?? HOME_HYBRID_DEFAULTS.t3HighValueCeiling, input.approvedHashRegistry ?? '0x0000000000000000000000000000000000000000']);
54
+ }
55
+ /** `execute(self, installModule(EXECUTOR, custodyPolicy, data))` — the ONE self-call that names a person's trustees.
56
+ * Signed by a credential that signs for her today; after it lands the account is custody-governed. */
57
+ export function installCustodyPolicyCall(account, custodyPolicy, installData) {
58
+ return { to: account, value: 0n, data: encodeFunctionData({ abi: INSTALL_MODULE_ABI, functionName: 'installModule', args: [MODULE_TYPE_EXECUTOR, custodyPolicy, installData] }) };
59
+ }
60
+ export function scheduleCustodyChangeCall(custodyPolicy, input) {
61
+ return { to: custodyPolicy, value: 0n, data: encodeFunctionData({ abi: custodyPolicyAbi, functionName: 'scheduleCustodyChange', args: [input.account, input.action, input.args, input.quorumSigs] }) };
62
+ }
63
+ export function applyCustodyChangeCall(custodyPolicy, input) {
64
+ return { to: custodyPolicy, value: 0n, data: encodeFunctionData({ abi: custodyPolicyAbi, functionName: 'applyCustodyChange', args: [input.account, input.changeId, input.quorumSigs] }) };
65
+ }
66
+ export function cancelScheduledChangeCall(custodyPolicy, input) {
67
+ return { to: custodyPolicy, value: 0n, data: encodeFunctionData({ abi: custodyPolicyAbi, functionName: 'cancelScheduledChange', args: [input.account, input.changeId, input.quorumSigs] }) };
68
+ }
69
+ /** The digest a quorum signs to SCHEDULE: `changeId` is `scheduledChangeCount(account) + 1` at signing time. */
70
+ export function scheduleCustodyChangeDigest(i) {
71
+ return hashTypedData({ domain: custodyDomain({ chainId: i.chainId, verifyingContract: i.custodyPolicy }), types: ScheduleCustodyChangeRequest, primaryType: 'ScheduleCustodyChangeRequest', message: { account: i.account, action: i.action, argsHash: keccak256(i.args), changeId: i.changeId } });
72
+ }
73
+ export function applyCustodyChangeDigest(i) {
74
+ return hashTypedData({ domain: custodyDomain({ chainId: i.chainId, verifyingContract: i.custodyPolicy }), types: ApplyCustodyChangeRequest, primaryType: 'ApplyCustodyChangeRequest', message: { account: i.account, action: i.action, argsHash: keccak256(i.args), changeId: i.changeId, eta: i.eta } });
75
+ }
76
+ export function cancelScheduledChangeDigest(i) {
77
+ return hashTypedData({ domain: custodyDomain({ chainId: i.chainId, verifyingContract: i.custodyPolicy }), types: CancelScheduledChangeRequest, primaryType: 'CancelScheduledChangeRequest', message: { account: i.account, action: i.action, argsHash: keccak256(i.args), changeId: i.changeId, eta: i.eta } });
78
+ }
79
+ /** A tier's safety delay, read from the chain, in words a person reads ("48 hours"). */
80
+ export function delayWords(seconds) {
81
+ if (seconds <= 0)
82
+ return 'no delay';
83
+ if (seconds % 86_400 === 0) {
84
+ const d = seconds / 86_400;
85
+ return `${d} day${d === 1 ? '' : 's'}`;
86
+ }
87
+ if (seconds % 3600 === 0) {
88
+ const h = seconds / 3600;
89
+ return `${h} hour${h === 1 ? '' : 's'}`;
90
+ }
91
+ const m = Math.round(seconds / 60);
92
+ return `${m} minute${m === 1 ? '' : 's'}`;
93
+ }
94
+ //# sourceMappingURL=governance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governance.js","sourceRoot":"","sources":["../src/governance.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,qHAAqH;AACrH,wEAAwE;AACxE,EAAE;AACF,iHAAiH;AACjH,+GAA+G;AAC/G,mHAAmH;AACnH,6GAA6G;AAC7G,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,SAAS,EAA0B,MAAM,MAAM,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,4BAA4B,EAAE,yBAAyB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ildRemoveCustodianArgs, buildAddTrusteeArgs, buildRemoveTrusteeArgs, buildChangeCustodyModeArgs, buildChangeValueCeilingArgs, buildSetRecoveryApprovalsArgs, buildApplySystemUpdateArgs, buildChangeApprovalsRequiredArgs, buildAddPasskeyCredentialArgs, buildRemovePasskeyCredentialArgs, buildRotateAllCustodiansArgs, buildRecoverAccountArgs, type RecoveryPasskeyAdd, } from './actions.js';
2
+ export { CustodyAction, buildAddCustodianArgs, buildRemoveCustodianArgs, buildAddTrusteeArgs, buildRemoveTrusteeArgs, buildChangeCustodyModeArgs, buildChangeValueCeilingArgs, buildSetRecoveryApprovalsArgs, buildApplySystemUpdateArgs, buildChangeApprovalsRequiredArgs, buildAddPasskeyCredentialArgs, buildRemovePasskeyCredentialArgs, buildRotateAllCustodiansArgs, buildRecoverAccountArgs, buildRotateCredentialArgs, type RecoveryPasskeyAdd, } from './actions.js';
3
3
  export { CUSTODY_DOMAIN_NAME, CUSTODY_DOMAIN_VERSION, custodyDomain, ScheduleCustodyChangeRequest, ApplyCustodyChangeRequest, CancelScheduledChangeRequest, type ScheduleCustodyChangeMessage, type ApplyCustodyChangeMessage, type CancelScheduledChangeMessage, } from './eip712.js';
4
4
  export { type Custodian, type Trustee, type CustodyCouncil, type ScheduledChange, type CustodyMode, type RiskTier, CUSTODY_MODE_BY_INDEX, } from './types.js';
5
- export { type EcdsaSlot, type ContractSigSlot, type ApprovedHashSlot, type PasskeySlot, type QuorumSlot, type WebAuthnAssertion, packQuorumSigs, encodePasskeyTailBody, passkeyIdentity, } from './quorum-slots.js';
5
+ export { type EcdsaSlot, type ContractSigSlot, type ApprovedHashSlot, type PasskeySlot, type QuorumSlot, type WebAuthnAssertion, packQuorumSigs, encodePasskeyTailBody, passkeyIdentity, SELF_PASSKEY_TRUSTEE, } from './quorum-slots.js';
6
+ export { type CustodyCall, type CustodyPolicyInstallInput, type CustodyDigestInput, MODULE_TYPE_EXECUTOR, TIER, HOME_HYBRID_DEFAULTS, majorityOf, buildCustodyPolicyInstallData, installCustodyPolicyCall, scheduleCustodyChangeCall, applyCustodyChangeCall, cancelScheduledChangeCall, scheduleCustodyChangeDigest, applyCustodyChangeDigest, cancelScheduledChangeDigest, delayWords, } from './governance.js';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,EAC1B,gCAAgC,EAChC,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,EAC5B,uBAAuB,EACvB,KAAK,kBAAkB,GACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,EAC5B,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,GAClC,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,cAAc,EACd,qBAAqB,EACrB,eAAe,GAChB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,EAC1B,gCAAgC,EAChC,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,kBAAkB,GACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,EAC5B,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,GAClC,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,IAAI,EACJ,oBAAoB,EACpB,UAAU,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,UAAU,GACX,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -8,8 +8,11 @@
8
8
  // Delegation / Steward / Caveat concepts belong in @agenticprimitives/delegation.
9
9
  // See spec 212 § 2.2 + spec 213 for the vocabulary firewall.
10
10
  export { custodyPolicyAbi } from './abi.js';
11
- export { CustodyAction, buildAddCustodianArgs, buildRemoveCustodianArgs, buildAddTrusteeArgs, buildRemoveTrusteeArgs, buildChangeCustodyModeArgs, buildChangeValueCeilingArgs, buildSetRecoveryApprovalsArgs, buildApplySystemUpdateArgs, buildChangeApprovalsRequiredArgs, buildAddPasskeyCredentialArgs, buildRemovePasskeyCredentialArgs, buildRotateAllCustodiansArgs, buildRecoverAccountArgs, } from './actions.js';
11
+ export { CustodyAction, buildAddCustodianArgs, buildRemoveCustodianArgs, buildAddTrusteeArgs, buildRemoveTrusteeArgs, buildChangeCustodyModeArgs, buildChangeValueCeilingArgs, buildSetRecoveryApprovalsArgs, buildApplySystemUpdateArgs, buildChangeApprovalsRequiredArgs, buildAddPasskeyCredentialArgs, buildRemovePasskeyCredentialArgs, buildRotateAllCustodiansArgs, buildRecoverAccountArgs, buildRotateCredentialArgs, } from './actions.js';
12
12
  export { CUSTODY_DOMAIN_NAME, CUSTODY_DOMAIN_VERSION, custodyDomain, ScheduleCustodyChangeRequest, ApplyCustodyChangeRequest, CancelScheduledChangeRequest, } from './eip712.js';
13
13
  export { CUSTODY_MODE_BY_INDEX, } from './types.js';
14
- export { packQuorumSigs, encodePasskeyTailBody, passkeyIdentity, } from './quorum-slots.js';
14
+ export { packQuorumSigs, encodePasskeyTailBody, passkeyIdentity, SELF_PASSKEY_TRUSTEE, } from './quorum-slots.js';
15
+ // Spec 422 §4 — the governance calls a Home makes for a person: install the policy post-deploy (naming trustees),
16
+ // schedule / apply / cancel a change, and the digests a quorum signs.
17
+ export { MODULE_TYPE_EXECUTOR, TIER, HOME_HYBRID_DEFAULTS, majorityOf, buildCustodyPolicyInstallData, installCustodyPolicyCall, scheduleCustodyChangeCall, applyCustodyChangeCall, cancelScheduledChangeCall, scheduleCustodyChangeDigest, applyCustodyChangeDigest, cancelScheduledChangeDigest, delayWords, } from './governance.js';
15
18
  //# 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,yDAAyD;AACzD,EAAE;AACF,uEAAuE;AACvE,oEAAoE;AACpE,8EAA8E;AAC9E,EAAE;AACF,wEAAwE;AACxE,kFAAkF;AAClF,6DAA6D;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,EAC1B,gCAAgC,EAChC,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,EAC5B,uBAAuB,GAExB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,GAI7B,MAAM,aAAa,CAAC;AAErB,OAAO,EAOL,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAOL,cAAc,EACd,qBAAqB,EACrB,eAAe,GAChB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,uEAAuE;AACvE,oEAAoE;AACpE,8EAA8E;AAC9E,EAAE;AACF,wEAAwE;AACxE,kFAAkF;AAClF,6DAA6D;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,EAC1B,gCAAgC,EAChC,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,GAE1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,GAI7B,MAAM,aAAa,CAAC;AAErB,OAAO,EAOL,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAOL,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAE3B,kHAAkH;AAClH,sEAAsE;AACtE,OAAO,EAIL,oBAAoB,EACpB,IAAI,EACJ,oBAAoB,EACpB,UAAU,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,UAAU,GACX,MAAM,iBAAiB,CAAC"}
@@ -28,21 +28,44 @@ export type ApprovedHashSlot = {
28
28
  };
29
29
  export type PasskeySlot = {
30
30
  type: 'passkey';
31
- /** Passkey-Identity-Address: keccak256(abi.encode(x, y)) cast to address. */
31
+ /** ACCOUNT-SCOPED Passkey-Identity-Address (spec 302 W2):
32
+ * keccak256(abi.encode(x, y, account)) cast to address, where `account` is
33
+ * the AgentAccount whose custody this signature claims (the on-chain
34
+ * verifier re-derives with the same scope). Use `passkeyIdentity(x, y, account)`. */
32
35
  pia: Address;
33
36
  /** P-256 public key. Re-derived and asserted equal to `pia` inside SignatureSlotRecovery. */
34
37
  x: bigint;
35
38
  y: bigint;
39
+ /** H7-C.1 / CON-WEBAUTHN-001: rpIdHash binds the assertion to the RP the
40
+ * authenticator was registered against. Required by the on-chain decoder
41
+ * at `SignatureSlotRecovery.recoverFromSlot` (line 172, 4-field tuple) —
42
+ * prior to 2026-06-01 this was missing from the encoder, producing a
43
+ * 3-field blob the decoder couldn't parse → empty revert. */
44
+ rpIdHash: Hex;
36
45
  /** Decoded WebAuthn assertion produced by the browser ceremony. */
37
46
  assertion: WebAuthnAssertion;
38
47
  };
39
48
  export type QuorumSlot = EcdsaSlot | ContractSigSlot | ApprovedHashSlot | PasskeySlot;
40
49
  /**
41
50
  * Encode a v=2 passkey slot's tail body as `abi.encode(uint256 x,
42
- * uint256 y, WebAuthnLib.Assertion assertion)` — the shape
43
- * `SignatureSlotRecovery.recoverFromSlot` decodes for v=2 slots.
51
+ * uint256 y, bytes32 rpIdHash, WebAuthnLib.Assertion assertion)` — the
52
+ * shape `SignatureSlotRecovery.recoverFromSlot` decodes (line 172-173)
53
+ * for v=2 slots.
54
+ *
55
+ * H7-C.1 / CON-WEBAUTHN-001 (encoder updated 2026-06-01): the on-chain
56
+ * decoder added `bytes32 rpIdHash` between `(x, y)` and the assertion,
57
+ * but this off-chain encoder was left at 3 fields. `abi.decode` of a
58
+ * 3-field blob into a 4-field tuple underflows → EMPTY revert from
59
+ * the EntryPoint (no UserOperationRevertReason emitted). Live-debug
60
+ * symptom (Act 3 'AddPasskey Bob on Org' with Alice signing via
61
+ * passkey): user sees the opaque 'inner userOp reverted (no
62
+ * UserOperationEvent…)' chain. SIWE/EOA path used v=27/28 slots
63
+ * which don't hit this decoder — that's why it worked.
64
+ *
65
+ * Same drift class as PRs #91 (direct-deploy ABI) and #92
66
+ * (AddPasskeyCredential args).
44
67
  */
45
- export declare function encodePasskeyTailBody(x: bigint, y: bigint, assertion: WebAuthnAssertion): Hex;
68
+ export declare function encodePasskeyTailBody(x: bigint, y: bigint, rpIdHash: Hex, assertion: WebAuthnAssertion): Hex;
46
69
  /**
47
70
  * Pack a sorted set of slots into the bytes blob CustodyPolicy expects.
48
71
  * Slot encoding follows Safe's convention; dynamic tails (v=0 + v=2)
@@ -53,9 +76,26 @@ export declare function encodePasskeyTailBody(x: bigint, y: bigint, assertion: W
53
76
  */
54
77
  export declare function packQuorumSigs(slots: readonly QuorumSlot[]): Hex;
55
78
  /**
56
- * Derive a Passkey-Identity-Address from a P-256 public key. Mirrors
57
- * `AgentAccount.passkeyIdentity` exactly so off-chain code can compute
79
+ * Derive the ACCOUNT-SCOPED Passkey-Identity-Address for a P-256 public key.
80
+ * Mirrors `AgentAccount.passkeyIdentity` exactly so off-chain code can compute
58
81
  * the same address without a chain call.
82
+ *
83
+ * Spec 302 W2: the PIA is `keccak256(abi.encode(x, y, account))` — the same
84
+ * physical passkey yields a DIFFERENT custodian address on every account it
85
+ * custodies, killing the public cross-account join key the global derivation
86
+ * created (one log scan clustered a person's SA with every org/treasury SA
87
+ * their root passkey controls). Consequence: the PIA CANNOT be computed
88
+ * before the account address exists — for the deploy-time "self-passkey is a
89
+ * trustee" bootstrap, pass {@link SELF_PASSKEY_TRUSTEE} in `trustees[]` and
90
+ * the factory resolves it post-deploy.
91
+ */
92
+ export declare function passkeyIdentity(x: bigint, y: bigint, account: Address): Address;
93
+ /**
94
+ * Spec 302 W2 — `AgentAccountFactory.SELF_PASSKEY_TRUSTEE`: the trustee-slot
95
+ * sentinel meaning "the initial passkey's PIA on the account being deployed".
96
+ * `address(uint160(uint256(keccak256("ap.trustee.self-initial-passkey"))))`.
97
+ * The CREATE2 salt commits to the sentinel (deterministic pre-deploy); the
98
+ * factory substitutes the real per-account PIA when installing CustodyPolicy.
59
99
  */
60
- export declare function passkeyIdentity(x: bigint, y: bigint): Address;
100
+ export declare const SELF_PASSKEY_TRUSTEE: Address;
61
101
  //# sourceMappingURL=quorum-slots.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quorum-slots.d.ts","sourceRoot":"","sources":["../src/quorum-slots.ts"],"names":[],"mappings":"AAmBA,OAAO,EAML,KAAK,OAAO,EACZ,KAAK,GAAG,EACT,MAAM,MAAM,CAAC;AAEd,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,EAAE,GAAG,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,kBAAkB,EAAE,GAAG,CAAC;CACzB;AAED,MAAM,MAAM,SAAS,GAAG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E,SAAS,UAAU,EAAE,GAAG,GAAG,CAiDhE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAO/E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,OAAsD,CAAC"}
@@ -33,15 +33,30 @@ const ASSERTION_COMPONENTS = [
33
33
  ];
34
34
  /**
35
35
  * Encode a v=2 passkey slot's tail body as `abi.encode(uint256 x,
36
- * uint256 y, WebAuthnLib.Assertion assertion)` — the shape
37
- * `SignatureSlotRecovery.recoverFromSlot` decodes for v=2 slots.
36
+ * uint256 y, bytes32 rpIdHash, WebAuthnLib.Assertion assertion)` — the
37
+ * shape `SignatureSlotRecovery.recoverFromSlot` decodes (line 172-173)
38
+ * for v=2 slots.
39
+ *
40
+ * H7-C.1 / CON-WEBAUTHN-001 (encoder updated 2026-06-01): the on-chain
41
+ * decoder added `bytes32 rpIdHash` between `(x, y)` and the assertion,
42
+ * but this off-chain encoder was left at 3 fields. `abi.decode` of a
43
+ * 3-field blob into a 4-field tuple underflows → EMPTY revert from
44
+ * the EntryPoint (no UserOperationRevertReason emitted). Live-debug
45
+ * symptom (Act 3 'AddPasskey Bob on Org' with Alice signing via
46
+ * passkey): user sees the opaque 'inner userOp reverted (no
47
+ * UserOperationEvent…)' chain. SIWE/EOA path used v=27/28 slots
48
+ * which don't hit this decoder — that's why it worked.
49
+ *
50
+ * Same drift class as PRs #91 (direct-deploy ABI) and #92
51
+ * (AddPasskeyCredential args).
38
52
  */
39
- export function encodePasskeyTailBody(x, y, assertion) {
53
+ export function encodePasskeyTailBody(x, y, rpIdHash, assertion) {
40
54
  return encodeAbiParameters([
41
55
  { type: 'uint256' },
42
56
  { type: 'uint256' },
57
+ { type: 'bytes32' },
43
58
  { type: 'tuple', components: ASSERTION_COMPONENTS },
44
- ], [x, y, assertion]);
59
+ ], [x, y, rpIdHash, assertion]);
45
60
  }
46
61
  /**
47
62
  * Pack a sorted set of slots into the bytes blob CustodyPolicy expects.
@@ -89,7 +104,7 @@ export function packQuorumSigs(slots) {
89
104
  const r = padHex(slot.pia, { size: 32 });
90
105
  const s = padHex(toHex(BigInt(runningOffset)), { size: 32 });
91
106
  slotFragments.push(concat([r, s, '0x02']));
92
- const blob = encodePasskeyTailBody(slot.x, slot.y, slot.assertion);
107
+ const blob = encodePasskeyTailBody(slot.x, slot.y, slot.rpIdHash, slot.assertion);
93
108
  const blobBytes = (blob.length - 2) / 2;
94
109
  tailFragments.push(concat([padHex(toHex(BigInt(blobBytes)), { size: 32 }), blob]));
95
110
  runningOffset += 32 + blobBytes;
@@ -98,13 +113,30 @@ export function packQuorumSigs(slots) {
98
113
  return concat([...slotFragments, ...tailFragments]);
99
114
  }
100
115
  /**
101
- * Derive a Passkey-Identity-Address from a P-256 public key. Mirrors
102
- * `AgentAccount.passkeyIdentity` exactly so off-chain code can compute
116
+ * Derive the ACCOUNT-SCOPED Passkey-Identity-Address for a P-256 public key.
117
+ * Mirrors `AgentAccount.passkeyIdentity` exactly so off-chain code can compute
103
118
  * the same address without a chain call.
119
+ *
120
+ * Spec 302 W2: the PIA is `keccak256(abi.encode(x, y, account))` — the same
121
+ * physical passkey yields a DIFFERENT custodian address on every account it
122
+ * custodies, killing the public cross-account join key the global derivation
123
+ * created (one log scan clustered a person's SA with every org/treasury SA
124
+ * their root passkey controls). Consequence: the PIA CANNOT be computed
125
+ * before the account address exists — for the deploy-time "self-passkey is a
126
+ * trustee" bootstrap, pass {@link SELF_PASSKEY_TRUSTEE} in `trustees[]` and
127
+ * the factory resolves it post-deploy.
104
128
  */
105
- export function passkeyIdentity(x, y) {
106
- const packed = encodeAbiParameters([{ type: 'uint256' }, { type: 'uint256' }], [x, y]);
129
+ export function passkeyIdentity(x, y, account) {
130
+ const packed = encodeAbiParameters([{ type: 'uint256' }, { type: 'uint256' }, { type: 'address' }], [x, y, account]);
107
131
  const hash = keccak256(packed);
108
132
  return (`0x${hash.slice(-40)}`);
109
133
  }
134
+ /**
135
+ * Spec 302 W2 — `AgentAccountFactory.SELF_PASSKEY_TRUSTEE`: the trustee-slot
136
+ * sentinel meaning "the initial passkey's PIA on the account being deployed".
137
+ * `address(uint160(uint256(keccak256("ap.trustee.self-initial-passkey"))))`.
138
+ * The CREATE2 salt commits to the sentinel (deterministic pre-deploy); the
139
+ * factory substitutes the real per-account PIA when installing CustodyPolicy.
140
+ */
141
+ export const SELF_PASSKEY_TRUSTEE = '0x2c75f6553caa0512418a595f36ffe4b751ed7a54';
110
142
  //# sourceMappingURL=quorum-slots.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"quorum-slots.js","sourceRoot":"","sources":["../src/quorum-slots.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,yEAAyE;AACzE,iEAAiE;AACjE,qEAAqE;AACrE,qCAAqC;AACrC,EAAE;AACF,2BAA2B;AAC3B,iEAAiE;AACjE,8EAA8E;AAC9E,4EAA4E;AAC5E,oFAAoF;AACpF,iFAAiF;AACjF,EAAE;AACF,wEAAwE;AACxE,2CAA2C;AAE3C,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,SAAS,EACT,MAAM,EACN,KAAK,GAGN,MAAM,MAAM,CAAC;AA8Cd,SAAS,UAAU,CAAC,IAAgB;IAClC,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC;IAC7C,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC;AAED,MAAM,oBAAoB,GAAG;IAC3B,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,OAAO,EAAE;IAC5C,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC1C,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE;IAC3C,EAAE,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GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YACxC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;YACnF,aAAa,IAAI,EAAE,GAAG,SAAS,CAAC;QAClC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,CAAC,GAAG,aAAa,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAAC,CAAS,EAAE,CAAS,EAAE,OAAgB;IACpE,MAAM,MAAM,GAAG,mBAAmB,CAChC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAC/D,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAChB,CAAC;IACF,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAY,CAAC;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAY,4CAA4C,CAAC"}
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "@agenticprimitives/account-custody",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.40",
4
4
  "description": "Custody-layer SDK: CustodyPolicy ABI, CustodyAction enum + arg builders, EIP-712 typed-data helpers, and Custodian/Trustee/CustodyCouncil types. Speaks custody-domain vocabulary only — no delegation / steward / caveat concepts (those belong in @agenticprimitives/delegation).",
5
+ "homepage": "https://agenticprimitives.dev",
6
+ "bugs": {
7
+ "url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
8
+ },
9
+ "author": {
10
+ "name": "Agentic Trust Labs",
11
+ "url": "https://agenticprimitives.dev"
12
+ },
5
13
  "license": "MIT",
6
14
  "repository": {
7
15
  "type": "git",
8
16
  "url": "git+https://github.com/agentictrustlabs/agenticprimitives.git",
9
17
  "directory": "packages/account-custody"
10
18
  },
11
- "homepage": "https://github.com/agentictrustlabs/agenticprimitives/tree/master/packages/account-custody",
12
- "bugs": {
13
- "url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
14
- },
15
19
  "type": "module",
16
20
  "main": "./dist/index.js",
17
21
  "types": "./dist/index.d.ts",
@@ -31,19 +35,24 @@
31
35
  "access": "public"
32
36
  },
33
37
  "peerDependencies": {
34
- "viem": "^2.50.0",
35
- "@agenticprimitives/types": "1.0.0-alpha.4"
38
+ "viem": "^2.52.2",
39
+ "@agenticprimitives/types": "^1.0.0-alpha.40"
36
40
  },
37
41
  "devDependencies": {
38
42
  "@types/node": "^22.7.0",
39
- "vitest": "^2.1.0"
43
+ "vitest": "^4.1.11"
40
44
  },
41
45
  "keywords": [
42
46
  "custody",
43
47
  "multi-sig",
44
48
  "trustee",
45
49
  "recovery",
46
- "agentic"
50
+ "agentic",
51
+ "agentic-primitives",
52
+ "agenticprimitives",
53
+ "ai-agents",
54
+ "agent-authority",
55
+ "agentic-trust"
47
56
  ],
48
57
  "scripts": {
49
58
  "build": "tsc -p tsconfig.build.json",