@agenticprimitives/delegation 0.1.0-alpha.2 → 1.0.0-alpha.10
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 +17 -2
- package/dist/caveats.d.ts +64 -0
- package/dist/caveats.d.ts.map +1 -1
- package/dist/caveats.js +76 -2
- package/dist/caveats.js.map +1 -1
- package/dist/index.d.ts +13 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/onchain.d.ts +17 -4
- package/dist/onchain.d.ts.map +1 -1
- package/dist/onchain.js +77 -6
- package/dist/onchain.js.map +1 -1
- package/dist/session-delegation.d.ts +30 -0
- package/dist/session-delegation.d.ts.map +1 -0
- package/dist/session-delegation.js +32 -0
- package/dist/session-delegation.js.map +1 -0
- package/dist/session-manager.d.ts +0 -1
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +14 -5
- package/dist/session-manager.js.map +1 -1
- package/dist/token.d.ts +13 -1
- package/dist/token.d.ts.map +1 -1
- package/dist/token.js +231 -94
- package/dist/token.js.map +1 -1
- package/dist/types.d.ts +35 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +7 -1
- package/dist/types.js.map +1 -1
- package/dist/verify-authorization.d.ts +28 -0
- package/dist/verify-authorization.d.ts.map +1 -0
- package/dist/verify-authorization.js +73 -0
- package/dist/verify-authorization.js.map +1 -0
- package/package.json +22 -22
package/dist/types.d.ts
CHANGED
|
@@ -25,6 +25,16 @@ export interface DelegationTokenClaims {
|
|
|
25
25
|
sub: Address;
|
|
26
26
|
delegation: Delegation;
|
|
27
27
|
sessionKeyAddress: Address;
|
|
28
|
+
/**
|
|
29
|
+
* DEL-001 (audit 2026-06-09) — the session-scoped leaf delegation that BINDS the session key to the
|
|
30
|
+
* delegator. v4 binds to the DELEGATOR (the principal's canonical SA), not the delegate: its
|
|
31
|
+
* `delegator` MUST equal `delegation.delegator` and its `delegate` MUST equal `sessionKeyAddress`;
|
|
32
|
+
* the delegator SA authorized it (validated via the UniversalSignatureValidator, so any credential
|
|
33
|
+
* strategy works). Without this leaf the full `delegation` travels in cleartext and anyone observing a
|
|
34
|
+
* token re-mints it with their own session key (permanent delegator impersonation). `principal` stays
|
|
35
|
+
* `delegation.delegator` — the leaf proves the presenting session key was authorized by that principal.
|
|
36
|
+
*/
|
|
37
|
+
sessionDelegation?: Delegation;
|
|
28
38
|
jti: string;
|
|
29
39
|
iat: number;
|
|
30
40
|
exp: number;
|
|
@@ -40,6 +50,8 @@ export interface EnforcerAddressMap {
|
|
|
40
50
|
callDataHash?: Address;
|
|
41
51
|
recovery?: Address;
|
|
42
52
|
rateLimit?: Address;
|
|
53
|
+
/** Spec 272 PAY-CON-1 — the x402 PaymentEnforcer (spend + frequency cap + transfer-only). */
|
|
54
|
+
payment?: Address;
|
|
43
55
|
}
|
|
44
56
|
export interface CaveatContext {
|
|
45
57
|
timestamp: number;
|
|
@@ -87,6 +99,29 @@ export interface VerifyOpts {
|
|
|
87
99
|
* Off-chain JTI / session-token verify uses strict mode. Spec 202 §11.
|
|
88
100
|
*/
|
|
89
101
|
enforceOnChain?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* DEL-001 (ADR-0036) — explicit opt-OUT of the session-key↔delegator binding. FAIL-CLOSED BY DEFAULT:
|
|
104
|
+
* with `allowUnboundSessionToken` unset/false, `verifyDelegationToken` REQUIRES the token to carry a
|
|
105
|
+
* valid `sessionDelegation` leaf binding the presenting session key to the DELEGATOR — the principal SA
|
|
106
|
+
* (`leaf.delegator === delegation.delegator` + `leaf.delegate === sessionKeyAddress` + the delegator
|
|
107
|
+
* SA's signature, validated via the UniversalSignatureValidator / deployed-ERC-1271). This closes the
|
|
108
|
+
* observe-and-re-mint vector on EVERY verify path, including one that forgets to configure it — the
|
|
109
|
+
* whole point of the flip (a critical authz control is not a per-call soft option a route can drop).
|
|
110
|
+
*
|
|
111
|
+
* Set `true` ONLY for an explicit legacy / non-client-minted path that issues UNBOUND tokens (e.g. a
|
|
112
|
+
* trusted-relayer / persona path where the relayer — not a client — signed the token). It is the
|
|
113
|
+
* greppable, audit-worthy escape hatch; a token without a leaf is REJECTED unless this is set.
|
|
114
|
+
*/
|
|
115
|
+
allowUnboundSessionToken?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* spec 270 v4 — the deployed `UniversalSignatureValidator` address. When set, the delegation AND the
|
|
118
|
+
* `sessionDelegation` leaf signatures are validated through it (ERC-1271 deployed / ERC-6492
|
|
119
|
+
* counterfactual / ECDSA EOA) instead of a raw `isValidSignature` against a deployed SA — making the
|
|
120
|
+
* verifier connection-agnostic (every credential strategy validates via one
|
|
121
|
+
* surface) and removing the `requireDeployed` hard-reject for counterfactual SAs. Omit ⇒ legacy
|
|
122
|
+
* deployed-ERC-1271-only path (non-breaking).
|
|
123
|
+
*/
|
|
124
|
+
universalSignatureValidator?: Address;
|
|
90
125
|
}
|
|
91
126
|
/**
|
|
92
127
|
* H7-B.2 — options for `evaluateCaveats`. Mirrors the `enforceOnChain` flag
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE7D,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE7D,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AAQ7B,eAAO,MAAM,cAAc,EAAE,GACyC,CAAC;AAEvE,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,C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SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAC5C,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IACrD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,MAAM,EAAE;QACN,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG;YAAE,GAAG,EAAE,GAAG,CAAA;SAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;KACvD,CAAC;CACH"}
|
package/dist/types.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
// Shared types for @agenticprimitives/delegation.
|
|
2
|
-
|
|
2
|
+
// MUST equal DelegationManager.ROOT_AUTHORITY (the root-delegation sentinel the
|
|
3
|
+
// on-chain authority-chain check compares against). The contract uses
|
|
4
|
+
// bytes32(type(uint256).max) — the DeleGator-framework convention — NOT the zero
|
|
5
|
+
// hash. A root delegation carrying any other authority reverts `InvalidAuthority`
|
|
6
|
+
// on redeemDelegation. (Was 0x00…00, which silently broke every on-chain
|
|
7
|
+
// redemption; off-chain token paths never exercised the on-chain chain check.)
|
|
8
|
+
export const ROOT_AUTHORITY = '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff';
|
|
3
9
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAMlD,MAAM,CAAC,MAAM,cAAc,GACzB,oEAAoE,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAMlD,gFAAgF;AAChF,sEAAsE;AACtE,iFAAiF;AACjF,kFAAkF;AAClF,yEAAyE;AACzE,+EAA+E;AAC/E,MAAM,CAAC,MAAM,cAAc,GACzB,oEAAoE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Address } from '@agenticprimitives/types';
|
|
2
|
+
import type { PublicClient } from 'viem';
|
|
3
|
+
import type { Delegation } from './types';
|
|
4
|
+
export interface VerifyAuthorizationResult {
|
|
5
|
+
ok: boolean;
|
|
6
|
+
/** Empty when `ok = true`; otherwise the on-chain rejection reason. */
|
|
7
|
+
reason: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* View-only verification of a delegation chain. Returns whether the chain
|
|
11
|
+
* authorizes `sender` to redeem WITHOUT executing it.
|
|
12
|
+
*
|
|
13
|
+
* ⚠️ DANGER — chain-only. This does NOT evaluate caveats, so a `true` result is
|
|
14
|
+
* NOT permission to perform any specific (target, value, calldata). To authorize a
|
|
15
|
+
* concrete call use `verifyAuthorizationForCall` (fail-closed, evaluates every
|
|
16
|
+
* caveat) or live redemption. Treating this boolean as call authorization re-opens
|
|
17
|
+
* the exact over-trust the caveats exist to prevent.
|
|
18
|
+
*
|
|
19
|
+
* Spec 242 §6 uses this to validate bilateral-consent delegations as signed
|
|
20
|
+
* authorization predicates rather than as cross-account execution.
|
|
21
|
+
*/
|
|
22
|
+
export declare function verifyAuthorization(args: {
|
|
23
|
+
publicClient: PublicClient;
|
|
24
|
+
delegationManager: Address;
|
|
25
|
+
delegations: Delegation[];
|
|
26
|
+
sender: Address;
|
|
27
|
+
}): Promise<VerifyAuthorizationResult>;
|
|
28
|
+
//# sourceMappingURL=verify-authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-authorization.d.ts","sourceRoot":"","sources":["../src/verify-authorization.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAqC1C,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,OAAO,CAAC;IACZ,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAuBrC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// SDK helper for `DelegationManager.verifyAuthorization(...)` view-only entrypoint
|
|
2
|
+
// (spec 242 PD-9). Used by `@agenticprimitives/attestations` to construct + read
|
|
3
|
+
// authorization-predicate verifications.
|
|
4
|
+
const VERIFY_AUTHORIZATION_ABI = [
|
|
5
|
+
{
|
|
6
|
+
type: 'function',
|
|
7
|
+
name: 'verifyAuthorization',
|
|
8
|
+
stateMutability: 'view',
|
|
9
|
+
inputs: [
|
|
10
|
+
{
|
|
11
|
+
name: 'delegations',
|
|
12
|
+
type: 'tuple[]',
|
|
13
|
+
components: [
|
|
14
|
+
{ name: 'delegator', type: 'address' },
|
|
15
|
+
{ name: 'delegate', type: 'address' },
|
|
16
|
+
{ name: 'authority', type: 'bytes32' },
|
|
17
|
+
{
|
|
18
|
+
name: 'caveats',
|
|
19
|
+
type: 'tuple[]',
|
|
20
|
+
components: [
|
|
21
|
+
{ name: 'enforcer', type: 'address' },
|
|
22
|
+
{ name: 'terms', type: 'bytes' },
|
|
23
|
+
{ name: 'args', type: 'bytes' },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{ name: 'salt', type: 'uint256' },
|
|
27
|
+
{ name: 'signature', type: 'bytes' },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
{ name: 'sender', type: 'address' },
|
|
31
|
+
],
|
|
32
|
+
outputs: [
|
|
33
|
+
{ name: 'ok', type: 'bool' },
|
|
34
|
+
{ name: 'reason', type: 'string' },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* View-only verification of a delegation chain. Returns whether the chain
|
|
40
|
+
* authorizes `sender` to redeem WITHOUT executing it.
|
|
41
|
+
*
|
|
42
|
+
* ⚠️ DANGER — chain-only. This does NOT evaluate caveats, so a `true` result is
|
|
43
|
+
* NOT permission to perform any specific (target, value, calldata). To authorize a
|
|
44
|
+
* concrete call use `verifyAuthorizationForCall` (fail-closed, evaluates every
|
|
45
|
+
* caveat) or live redemption. Treating this boolean as call authorization re-opens
|
|
46
|
+
* the exact over-trust the caveats exist to prevent.
|
|
47
|
+
*
|
|
48
|
+
* Spec 242 §6 uses this to validate bilateral-consent delegations as signed
|
|
49
|
+
* authorization predicates rather than as cross-account execution.
|
|
50
|
+
*/
|
|
51
|
+
export async function verifyAuthorization(args) {
|
|
52
|
+
const onchainDelegations = args.delegations.map((d) => ({
|
|
53
|
+
delegator: d.delegator,
|
|
54
|
+
delegate: d.delegate,
|
|
55
|
+
authority: d.authority,
|
|
56
|
+
caveats: d.caveats.map((c) => ({
|
|
57
|
+
enforcer: c.enforcer,
|
|
58
|
+
terms: c.terms,
|
|
59
|
+
// `args` is OPTIONAL in the off-chain shape; on-chain expects bytes.
|
|
60
|
+
args: (c.args ?? '0x'),
|
|
61
|
+
})),
|
|
62
|
+
salt: d.salt,
|
|
63
|
+
signature: d.signature,
|
|
64
|
+
}));
|
|
65
|
+
const [ok, reason] = (await args.publicClient.readContract({
|
|
66
|
+
address: args.delegationManager,
|
|
67
|
+
abi: VERIFY_AUTHORIZATION_ABI,
|
|
68
|
+
functionName: 'verifyAuthorization',
|
|
69
|
+
args: [onchainDelegations, args.sender],
|
|
70
|
+
}));
|
|
71
|
+
return { ok, reason };
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=verify-authorization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-authorization.js","sourceRoot":"","sources":["../src/verify-authorization.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,iFAAiF;AACjF,yCAAyC;AAOzC,MAAM,wBAAwB,GAAG;IAC/B;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,qBAAqB;QAC3B,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,SAAS;gBACf,UAAU,EAAE;oBACV,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;oBACtC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;oBACrC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;oBACtC;wBACE,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,SAAS;wBACf,UAAU,EAAE;4BACV,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;4BACrC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE;4BAChC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE;yBAChC;qBACF;oBACD,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;oBACjC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE;i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ED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agenticprimitives/delegation",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "EIP-712 smart-account delegations with caveats; web
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
|
+
"description": "EIP-712 smart-account delegations with caveats; web→agent→MCP token flow; session lifecycle.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -27,32 +27,23 @@
|
|
|
27
27
|
"spec.md",
|
|
28
28
|
"README.md"
|
|
29
29
|
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "tsc -p tsconfig.build.json",
|
|
32
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
33
|
-
"test": "vitest run",
|
|
34
|
-
"test:unit": "vitest run test/unit",
|
|
35
|
-
"test:integration": "vitest run test/integration --passWithNoTests",
|
|
36
|
-
"test:watch": "vitest",
|
|
37
|
-
"clean": "rm -rf dist"
|
|
38
|
-
},
|
|
39
30
|
"publishConfig": {
|
|
40
31
|
"access": "public"
|
|
41
32
|
},
|
|
42
33
|
"dependencies": {
|
|
43
|
-
"@noble/curves": "^
|
|
44
|
-
"@noble/hashes": "^
|
|
34
|
+
"@noble/curves": "^2.2.0",
|
|
35
|
+
"@noble/hashes": "^2.2.0"
|
|
45
36
|
},
|
|
46
37
|
"peerDependencies": {
|
|
47
|
-
"
|
|
48
|
-
"@agenticprimitives/
|
|
49
|
-
"@agenticprimitives/connect-auth": "
|
|
50
|
-
"@agenticprimitives/key-custody": "
|
|
51
|
-
"@agenticprimitives/
|
|
52
|
-
"
|
|
38
|
+
"viem": "^2.52.2",
|
|
39
|
+
"@agenticprimitives/agent-account": "1.0.0-alpha.10",
|
|
40
|
+
"@agenticprimitives/connect-auth": "1.0.0-alpha.10",
|
|
41
|
+
"@agenticprimitives/key-custody": "1.0.0-alpha.10",
|
|
42
|
+
"@agenticprimitives/audit": "1.0.0-alpha.10",
|
|
43
|
+
"@agenticprimitives/types": "1.0.0-alpha.10"
|
|
53
44
|
},
|
|
54
45
|
"devDependencies": {
|
|
55
|
-
"vitest": "^
|
|
46
|
+
"vitest": "^4.1.8"
|
|
56
47
|
},
|
|
57
48
|
"keywords": [
|
|
58
49
|
"delegation",
|
|
@@ -62,5 +53,14 @@
|
|
|
62
53
|
"caveat",
|
|
63
54
|
"session",
|
|
64
55
|
"agentic"
|
|
65
|
-
]
|
|
66
|
-
|
|
56
|
+
],
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "tsc -p tsconfig.build.json",
|
|
59
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
60
|
+
"test": "vitest run",
|
|
61
|
+
"test:unit": "vitest run test/unit --passWithNoTests",
|
|
62
|
+
"test:integration": "vitest run test/integration --passWithNoTests",
|
|
63
|
+
"test:watch": "vitest",
|
|
64
|
+
"clean": "rm -rf dist"
|
|
65
|
+
}
|
|
66
|
+
}
|