@agenticprimitives/delegation 1.0.0-alpha.46 → 1.0.0-alpha.48
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 +21 -7
- package/dist/authority-chain.d.ts +77 -7
- package/dist/authority-chain.d.ts.map +1 -1
- package/dist/authority-chain.js +144 -18
- package/dist/authority-chain.js.map +1 -1
- package/dist/caveats.d.ts +166 -3
- package/dist/caveats.d.ts.map +1 -1
- package/dist/caveats.js +65 -7
- package/dist/caveats.js.map +1 -1
- package/dist/evaluator.d.ts.map +1 -1
- package/dist/evaluator.js +9 -7
- package/dist/evaluator.js.map +1 -1
- package/dist/hash.d.ts +8 -0
- package/dist/hash.d.ts.map +1 -1
- package/dist/hash.js +17 -0
- package/dist/hash.js.map +1 -1
- package/dist/index.d.ts +11 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/invocation-proof.d.ts.map +1 -1
- package/dist/invocation-proof.js +2 -0
- package/dist/invocation-proof.js.map +1 -1
- package/dist/mandate-handlers.d.ts.map +1 -1
- package/dist/mandate-handlers.js +2 -0
- package/dist/mandate-handlers.js.map +1 -1
- package/dist/mandate.d.ts +106 -1
- package/dist/mandate.d.ts.map +1 -1
- package/dist/mandate.js +189 -34
- package/dist/mandate.js.map +1 -1
- package/dist/method-authorization.d.ts +6 -0
- package/dist/method-authorization.d.ts.map +1 -1
- package/dist/method-authorization.js.map +1 -1
- package/dist/onchain.d.ts +150 -1
- package/dist/onchain.d.ts.map +1 -1
- package/dist/onchain.js +94 -2
- package/dist/onchain.js.map +1 -1
- package/dist/presentation-release.d.ts +7 -0
- package/dist/presentation-release.d.ts.map +1 -1
- package/dist/presentation-release.js +49 -17
- package/dist/presentation-release.js.map +1 -1
- package/dist/quorum.d.ts +71 -3
- package/dist/quorum.d.ts.map +1 -1
- package/dist/quorum.js +112 -22
- package/dist/quorum.js.map +1 -1
- package/dist/standing.d.ts.map +1 -1
- package/dist/standing.js +10 -4
- package/dist/standing.js.map +1 -1
- package/dist/token.d.ts +23 -14
- package/dist/token.d.ts.map +1 -1
- package/dist/token.js +46 -17
- package/dist/token.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -66,8 +66,10 @@ The closest neighbors are MetaMask's Delegation Toolkit and the session-key feat
|
|
|
66
66
|
|
|
67
67
|
A person's credential is presented by her agent, never held by it. She signs one standing `credential.present` wire
|
|
68
68
|
(`PRESENTATION_CAPABILITY`) naming the audiences, predicate programs and issuer facets it covers;
|
|
69
|
-
`
|
|
70
|
-
|
|
69
|
+
`deriveFromStanding` gives the child mandate for one statement, and `createPresentationRelease` — given the credential
|
|
70
|
+
**holder's** address and the presented **chain** (both required) — judges it inside the device key's signing callback:
|
|
71
|
+
her wire is verified on every signature (signed by her, unrevoked, in window), and a statement for another venue, a
|
|
72
|
+
mandate that does not descend from her wire, or a child of a wire she has revoked signs nothing. `createEs256EvidenceMinter` and `boundEvidenceFrom` turn that
|
|
71
73
|
judgement into the bound evidence the key service requires before a P-256 device key signs: the judge attests what it
|
|
72
74
|
judged. The same minter serves an issuing runtime, whose issuance evidence names the digest, the facet and the type.
|
|
73
75
|
|
|
@@ -79,9 +81,9 @@ judged. The same minter serves an issuing runtime, whose issuance evidence names
|
|
|
79
81
|
record/op matcher), `buildDelegateBindingCaveat`, `buildQuorumCaveat`, `encodeTimestampTerms`, `encodeValueTerms`,
|
|
80
82
|
`encodeAllowedTargetsTerms`, `encodeAllowedMethodsTerms`, `encodeCallDataHashTerms`. Hashing: `hashDelegation`,
|
|
81
83
|
`hashCaveats`, `evaluateCaveats`. Browser: `DelegationClient`. Sessions: `SessionManager`, `SessionStore`. Token:
|
|
82
|
-
`mintDelegationToken`, `verifyDelegationToken` (with `
|
|
84
|
+
`mintDelegationToken`, `verifyDelegationToken` (with `requireQuorumCaveat` + `quorumProof`; an off-chain quorum signs the ACTION — `computeOffChainQuorumPayloadHash`, spec 445). On chain: `isRevoked`, `revokeDelegation`.
|
|
83
85
|
Method authorization: `authorizeMethodDelegation`, `methodSelector`. Mandates: `intentDigest`, `deriveMandate`,
|
|
84
|
-
`readMandate`, `verifyMandateForStep`, `registerSubsetHandler`, `registerDefaultSubsetHandlers`,
|
|
86
|
+
`readMandate`, `verifyMandateForStep`, `assembleAuthorityChain`, `verifyAuthorityChain`, `judgeLinkForStep`, `registerSubsetHandler`, `registerDefaultSubsetHandlers`,
|
|
85
87
|
`buildDigestBindingCaveat`, `readDigestBindings`. Presentation: `PRESENTATION_RAR_TYPE`, `presentationHandler`,
|
|
86
88
|
`buildStandingWire`, `deriveFromStanding`, `presentationIntent`, `createPresentationRelease`,
|
|
87
89
|
`parseAudienceBoundChallenge`, `createEs256EvidenceMinter`, `boundEvidenceFrom`. Types: `Delegation`, `Caveat`,
|
|
@@ -91,13 +93,25 @@ Method authorization: `authorizeMethodDelegation`, `methodSelector`. Mandates: `
|
|
|
91
93
|
**Mandates (spec 350 §2, spec 336 E4).** A mandate is a delegation with a reason: a `DigestBindingEnforcer` caveat binding it
|
|
92
94
|
to an intent digest (JCS, then keccak). `MandateRequirementV1` is RAR-shaped; subset handlers are registered per `type`
|
|
93
95
|
(RFC 9396 defines no universal "narrower than"); `deriveMandate` makes a chain (the child's `authority` is the parent's
|
|
94
|
-
hash); `verifyMandateForStep` is the per-step check, never once at admission. `src/mandate-handlers.ts` ships
|
|
95
|
-
capability and payment handlers.
|
|
96
|
+
hash); `verifyMandateForStep` is the per-step check of ONE link, never once at admission. `src/mandate-handlers.ts` ships
|
|
97
|
+
the capability and payment handlers.
|
|
98
|
+
|
|
99
|
+
**The chain is judged whole (spec 383, spec 445 §1.1 / §3.1).** `deriveMandate`'s subset check is the honest minter's early
|
|
100
|
+
refusal; the holder of a parent's delegate key can sign a child without it. So `verifyAuthorityChain({ leaf, presented,
|
|
101
|
+
step, requirementType, principal, … })` judges the same step against **every** link: the shape is the contract's (one
|
|
102
|
+
root, and it is last — `assembleAuthorityChain`, `presentedAs: 'chain'` for an ordered array bound for the chain); the
|
|
103
|
+
root delegator is `principal`, the party whose authority the step needs (`chain-root-not-principal`); each child is ⊆ its
|
|
104
|
+
parent by the type's handler (`chain-not-attenuated`); each parent's caveats admit the step, strictly — a caveat nobody
|
|
105
|
+
can judge off chain refuses a step that does not redeem (`chain-link-denies-step`); every parent is live
|
|
106
|
+
(`chain-link-dead`). Run it WITH `verifyMandateForStep`; a child judged alone has only been asked what it allows itself.
|
|
96
107
|
|
|
97
108
|
**Delegated presentation (spec 305 W2, zkID Z2).** `credential.present` bounds which verifiers, which predicate programs (by
|
|
98
109
|
digest) and which issuer facets a delegate key may cause the person's P-256 device key to sign a `Show` challenge for, through
|
|
99
110
|
the `PRESENTATION_SCOPE_ENFORCER` sentinel judged off chain. `deriveFromStanding` gives the child for one statement;
|
|
100
|
-
`createPresentationRelease` is the only road to the device signature
|
|
111
|
+
`createPresentationRelease` is the only road to the device signature. Per signature, with nothing cached, it runs
|
|
112
|
+
`verifyAuthorityChain` over the presented chain — the root granted by the credential's `holder`, signed by her, unrevoked, in
|
|
113
|
+
window; the audience, predicate program and issuer facet within EVERY link's scope; a link with no presentation scope
|
|
114
|
+
refused — then `verifyMandateForStep` on the mandate (spec 445 §3.2). It requires
|
|
101
115
|
the challenge (`<scheme>:<audience>:<nonce>`) to be bound to the audience the mandate covers, and with an `evidence` port
|
|
102
116
|
attests what it judged (digest · venue · predicate program · actor) as the key's sign context. Issuance evidence (spec 444)
|
|
103
117
|
is minted by the issuing runtime's own key with the same minter. The port of smart-agent's `SessionGrantV1` +
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address, Hex } from 'viem';
|
|
2
2
|
import { type Delegation } from './types.js';
|
|
3
3
|
import { type MethodAuthorizationChecks } from './method-authorization.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type EnforcerAddresses, type MandateStep, type SubsetHandlers, type VersionBindingV1 } from './mandate.js';
|
|
5
5
|
export interface AuthorityChainLinkV1 {
|
|
6
6
|
/** The link's delegation digest (`hashDelegation`) — the receipt's reference for it. */
|
|
7
7
|
ref: Hex;
|
|
@@ -22,9 +22,20 @@ export interface AuthorityChainV1 {
|
|
|
22
22
|
/** keccak over the link refs, leaf → root: one digest a reader can cite for the whole chain. */
|
|
23
23
|
chainDigest: Hex;
|
|
24
24
|
}
|
|
25
|
+
export type AuthorityChainFailureCode = 'chain-empty' | 'chain-parent-missing' | 'chain-broken' | 'chain-cycle' | 'chain-too-deep' | 'chain-link-dead'
|
|
26
|
+
/** Spec 445 §1.1 — a ROOT_AUTHORITY link somewhere other than the end of an ordered chain (the H-1 splice). */
|
|
27
|
+
| 'chain-root-not-terminal'
|
|
28
|
+
/** Spec 445 §3.1 — a child is not ⊆ its parent (the type's own `isSubset`), or carries no readable bound where its parent does. */
|
|
29
|
+
| 'chain-not-attenuated'
|
|
30
|
+
/** Spec 445 §3.1 — the step is outside a PARENT link: one of its caveats denies it, or no off-chain judge can answer it. */
|
|
31
|
+
| 'chain-link-denies-step'
|
|
32
|
+
/** Spec 445 §3.1 (AUTH-3) — the chain's root delegator is not the party whose authority the step needs. */
|
|
33
|
+
| 'chain-root-not-principal'
|
|
34
|
+
/** Spec 445 / generation 4 / DLG-2 — the step's call target is the chain's ROOT delegator (`SelfTargetedRedemption`). */
|
|
35
|
+
| 'self-target';
|
|
25
36
|
export type AuthorityChainFailure = {
|
|
26
37
|
ok: false;
|
|
27
|
-
code:
|
|
38
|
+
code: AuthorityChainFailureCode;
|
|
28
39
|
reason: string;
|
|
29
40
|
};
|
|
30
41
|
export type AssembleAuthorityChainResult = {
|
|
@@ -33,7 +44,26 @@ export type AssembleAuthorityChainResult = {
|
|
|
33
44
|
delegations: Delegation[];
|
|
34
45
|
} | AuthorityChainFailure;
|
|
35
46
|
export declare const AUTHORITY_CHAIN_MAX_DEPTH = 4;
|
|
36
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Assemble the chain from the leaf up through what was presented. Structural only — no chain reads.
|
|
49
|
+
*
|
|
50
|
+
* THE SHAPE (spec 445 §1.1, the off-chain half of H-1) is the one the amended
|
|
51
|
+
* `DelegationManager._validateDelegation` accepts, and no other: every link except the last names the NEXT
|
|
52
|
+
* link's hash as its `authority`; the LAST link's `authority` is `ROOT_AUTHORITY`; a root anywhere else, a
|
|
53
|
+
* chain that stops short of a root, and a cycle are refused.
|
|
54
|
+
*
|
|
55
|
+
* `presented` is read one of two ways, and the caller says which:
|
|
56
|
+
* • `'bag'` (default) — every wire a run presented, in no order. The chain is WALKED from the leaf by hash,
|
|
57
|
+
* so the result is linked hash-to-hash and ends in the first root reached, by construction; wires that are
|
|
58
|
+
* not on that walk are not part of the chain and lend it nothing. The H-1 splice presented as a bag
|
|
59
|
+
* (`[M→T root, Alice→M root]`, leaf `M→T`) assembles to a chain of ONE whose root is M — never Alice — and
|
|
60
|
+
* `delegations` is that one link.
|
|
61
|
+
* • `'chain'` — `presented` IS the ordered array as it would be handed to `redeemDelegations` (leaf first,
|
|
62
|
+
* root last). Then every element must be a link, in position: the splice is refused
|
|
63
|
+
* (`chain-root-not-terminal`), because the contract before generation 4 would run it against the LAST
|
|
64
|
+
* element's delegator. ANY CALLER THAT FORWARDS A PRESENTED ARRAY TO THE CHAIN uses this mode, or redeems
|
|
65
|
+
* the `delegations` this returns — never the array it was handed.
|
|
66
|
+
*/
|
|
37
67
|
export declare function assembleAuthorityChain(input: {
|
|
38
68
|
leaf: Delegation;
|
|
39
69
|
/** Every wire the caller presented (the leaf may be among them). */
|
|
@@ -42,17 +72,57 @@ export declare function assembleAuthorityChain(input: {
|
|
|
42
72
|
* function, so assembly and verification never disagree on what a link is called. */
|
|
43
73
|
digestOf: (d: Delegation) => Hex;
|
|
44
74
|
maxDepth?: number;
|
|
75
|
+
/** How `presented` is read — see above. Default `'bag'`. */
|
|
76
|
+
presentedAs?: 'bag' | 'chain';
|
|
45
77
|
}): AssembleAuthorityChainResult;
|
|
46
|
-
|
|
47
|
-
* is the mandate `verifyMandateForStep` judges in full; this proves the authority it claims to descend from. */
|
|
48
|
-
export declare function verifyAuthorityChain(input: {
|
|
78
|
+
export interface VerifyAuthorityChainInput {
|
|
49
79
|
leaf: Delegation;
|
|
50
80
|
presented: readonly Delegation[];
|
|
81
|
+
/** How `presented` is read (`assembleAuthorityChain`). Default `'bag'`. */
|
|
82
|
+
presentedAs?: 'bag' | 'chain';
|
|
51
83
|
enforcers: EnforcerAddresses;
|
|
52
84
|
checks: MethodAuthorizationChecks;
|
|
53
85
|
now: number;
|
|
54
86
|
maxDepth?: number;
|
|
55
|
-
|
|
87
|
+
/** Spec 445 §3.1 — THE STEP every link is judged against: the same one `verifyMandateForStep` judges the leaf against. */
|
|
88
|
+
step: MandateStep;
|
|
89
|
+
/** The RAR type the step requires — selects the handler that compares child to parent and the step to each. */
|
|
90
|
+
requirementType: string;
|
|
91
|
+
/** Spec 445 §3.1 (AUTH-3) — THE PARTY WHOSE AUTHORITY THE STEP NEEDS (the payer, the organization acted for,
|
|
92
|
+
* the credential's holder). The chain's ROOT delegator must be this address. Required: a verifier that is
|
|
93
|
+
* not told whose authority is needed can only answer "somebody signed", which is not the question. */
|
|
94
|
+
principal: Address;
|
|
95
|
+
/** The handler set to consult. Defaults to the ambient registry — pass it explicitly in a bundle. */
|
|
96
|
+
handlers?: SubsetHandlers;
|
|
97
|
+
/** Spec 410 §5 — the versions the verifier runs with; the intent digest every link is compared to is recomputed under them. */
|
|
98
|
+
currentVersions?: VersionBindingV1;
|
|
99
|
+
/** Refuse unless EVERY link decodes as `requirementType`. For a use whose scope must be stated by every
|
|
100
|
+
* grantor (a presentation: every link names its audiences), where "this link says nothing" is not "this
|
|
101
|
+
* link allows anything". Default false: a link of another shape is still judged strictly, caveat by caveat. */
|
|
102
|
+
requireEveryLinkTyped?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Assemble the chain and judge it WHOLE (spec 383, amended by spec 445 §3.1). In order, cheapest first, so a
|
|
106
|
+
* chain that is refused on its face costs no chain read:
|
|
107
|
+
*
|
|
108
|
+
* 1. SHAPE — `assembleAuthorityChain`.
|
|
109
|
+
* 2. THE ROOT IS THE PRINCIPAL — the root delegator equals `principal`, else `chain-root-not-principal`.
|
|
110
|
+
* 3. ATTENUATION — for each adjacent pair that carries the step's requirement type,
|
|
111
|
+
* `handler.isSubset(child, parent)`, else `chain-not-attenuated`. A standing parent binds no intent, so
|
|
112
|
+
* any reason is within it; a child that carries no readable bound under a parent that does is not within it.
|
|
113
|
+
* 4. THE STEP AGAINST EVERY PARENT — each parent's caveats, STRICTLY, in the same context the leaf is judged
|
|
114
|
+
* in (capability selector, target, value, intent / offer / projection / plan digests, payload classes),
|
|
115
|
+
* then the handler's limits (amount, payee; audience, predicate, issuer), else `chain-link-denies-step`.
|
|
116
|
+
* A caveat no off-chain judge can answer is a refusal — unless the step redeems on chain, where the
|
|
117
|
+
* DelegationManager runs that parent's enforcer itself.
|
|
118
|
+
* 5. LIVENESS — every parent signed by its delegator, unrevoked, in window, else `chain-link-dead`.
|
|
119
|
+
*
|
|
120
|
+
* The LEAF's own liveness, intent binding and limits are `verifyMandateForStep`'s; the two are run together
|
|
121
|
+
* (the harness composition, the presentation release). Before spec 445 only (1) and (5) existed: a parent was
|
|
122
|
+
* read with a timestamp-only context, which made every scoping caveat on it inert, and nothing compared a
|
|
123
|
+
* child to its parent after mint (audit H-7 / AUTH-1).
|
|
124
|
+
*/
|
|
125
|
+
export declare function verifyAuthorityChain(input: VerifyAuthorityChainInput): Promise<{
|
|
56
126
|
ok: true;
|
|
57
127
|
chain: AuthorityChainV1;
|
|
58
128
|
} | AuthorityChainFailure>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authority-chain.d.ts","sourceRoot":"","sources":["../src/authority-chain.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authority-chain.d.ts","sourceRoot":"","sources":["../src/authority-chain.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,O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,gBAAgB,CAAA;CAAE,GAAG,qBAAqB,CAAC,CA0DnJ"}
|
package/dist/authority-chain.js
CHANGED
|
@@ -1,12 +1,65 @@
|
|
|
1
1
|
import { keccak256, toBytes } from 'viem';
|
|
2
2
|
import { ROOT_AUTHORITY } from './types.js';
|
|
3
3
|
import { verifyLiveDelegation } from './method-authorization.js';
|
|
4
|
+
import { judgeLinkForStep, readGrant, stepIntentDigest, stepTarget, subsetHandlerFor, isSelfTargetedRedemption, } from './mandate.js';
|
|
4
5
|
const lc = (s) => s.toLowerCase();
|
|
6
|
+
const short = (h) => `${h.slice(0, 12)}…`;
|
|
7
|
+
const isRoot = (d) => lc(String(d.authority)) === lc(ROOT_AUTHORITY);
|
|
5
8
|
export const AUTHORITY_CHAIN_MAX_DEPTH = 4;
|
|
6
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Assemble the chain from the leaf up through what was presented. Structural only — no chain reads.
|
|
11
|
+
*
|
|
12
|
+
* THE SHAPE (spec 445 §1.1, the off-chain half of H-1) is the one the amended
|
|
13
|
+
* `DelegationManager._validateDelegation` accepts, and no other: every link except the last names the NEXT
|
|
14
|
+
* link's hash as its `authority`; the LAST link's `authority` is `ROOT_AUTHORITY`; a root anywhere else, a
|
|
15
|
+
* chain that stops short of a root, and a cycle are refused.
|
|
16
|
+
*
|
|
17
|
+
* `presented` is read one of two ways, and the caller says which:
|
|
18
|
+
* • `'bag'` (default) — every wire a run presented, in no order. The chain is WALKED from the leaf by hash,
|
|
19
|
+
* so the result is linked hash-to-hash and ends in the first root reached, by construction; wires that are
|
|
20
|
+
* not on that walk are not part of the chain and lend it nothing. The H-1 splice presented as a bag
|
|
21
|
+
* (`[M→T root, Alice→M root]`, leaf `M→T`) assembles to a chain of ONE whose root is M — never Alice — and
|
|
22
|
+
* `delegations` is that one link.
|
|
23
|
+
* • `'chain'` — `presented` IS the ordered array as it would be handed to `redeemDelegations` (leaf first,
|
|
24
|
+
* root last). Then every element must be a link, in position: the splice is refused
|
|
25
|
+
* (`chain-root-not-terminal`), because the contract before generation 4 would run it against the LAST
|
|
26
|
+
* element's delegator. ANY CALLER THAT FORWARDS A PRESENTED ARRAY TO THE CHAIN uses this mode, or redeems
|
|
27
|
+
* the `delegations` this returns — never the array it was handed.
|
|
28
|
+
*/
|
|
7
29
|
export function assembleAuthorityChain(input) {
|
|
8
30
|
const maxDepth = input.maxDepth ?? AUTHORITY_CHAIN_MAX_DEPTH;
|
|
9
31
|
const digestOf = input.digestOf;
|
|
32
|
+
if (input.presentedAs === 'chain') {
|
|
33
|
+
// POSITIONAL, like the contract: link i's authority is hash(link i+1); the last is root.
|
|
34
|
+
const arr = input.presented;
|
|
35
|
+
if (arr.length === 0)
|
|
36
|
+
return { ok: false, code: 'chain-empty', reason: 'an empty chain is not authority' };
|
|
37
|
+
if (lc(digestOf(arr[0])) !== lc(digestOf(input.leaf)))
|
|
38
|
+
return { ok: false, code: 'chain-broken', reason: 'the first link of an ordered chain is its leaf, and the leaf named is another wire' };
|
|
39
|
+
if (arr.length > maxDepth)
|
|
40
|
+
return { ok: false, code: 'chain-too-deep', reason: `the chain is deeper than ${maxDepth} links` };
|
|
41
|
+
const seenAt = new Set();
|
|
42
|
+
for (let i = 0; i < arr.length; i++) {
|
|
43
|
+
const d = arr[i];
|
|
44
|
+
const ref = digestOf(d);
|
|
45
|
+
const last = i === arr.length - 1;
|
|
46
|
+
if (seenAt.has(lc(ref)))
|
|
47
|
+
return { ok: false, code: 'chain-cycle', reason: `the chain cycles at ${short(ref)}` };
|
|
48
|
+
seenAt.add(lc(ref));
|
|
49
|
+
if (last) {
|
|
50
|
+
if (!isRoot(d)) {
|
|
51
|
+
return seenAt.has(lc(String(d.authority)))
|
|
52
|
+
? { ok: false, code: 'chain-cycle', reason: `the chain cycles: its last link ${short(ref)} names a link below it as its parent` }
|
|
53
|
+
: { ok: false, code: 'chain-parent-missing', reason: `the chain stops at ${short(ref)}, which names a parent ${short(String(d.authority))} that was not presented — a chain ends in a root or it is not a chain` };
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
if (isRoot(d))
|
|
58
|
+
return { ok: false, code: 'chain-root-not-terminal', reason: `link ${i + 1} of ${arr.length} (${short(ref)}) is a ROOT grant followed by another link — two grants nobody linked are not a chain (spec 445 §1.1); a root is the last link or the only one` };
|
|
59
|
+
if (lc(String(d.authority)) !== lc(digestOf(arr[i + 1])))
|
|
60
|
+
return { ok: false, code: 'chain-broken', reason: `link ${i + 1} of ${arr.length} (${short(ref)}) does not name the next link's hash as its authority` };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
10
63
|
const byRef = new Map();
|
|
11
64
|
for (const d of input.presented)
|
|
12
65
|
byRef.set(lc(digestOf(d)), d);
|
|
@@ -17,23 +70,25 @@ export function assembleAuthorityChain(input) {
|
|
|
17
70
|
for (;;) {
|
|
18
71
|
const ref = digestOf(cur);
|
|
19
72
|
if (seen.has(lc(ref)))
|
|
20
|
-
return { ok: false, code: 'chain-cycle', reason: `the chain cycles at ${ref
|
|
73
|
+
return { ok: false, code: 'chain-cycle', reason: `the chain cycles at ${short(ref)}` };
|
|
21
74
|
seen.add(lc(ref));
|
|
22
75
|
if (links.length >= maxDepth)
|
|
23
76
|
return { ok: false, code: 'chain-too-deep', reason: `the chain is deeper than ${maxDepth} links` };
|
|
24
|
-
const
|
|
25
|
-
links.push({ ref, delegator: cur.delegator, delegate: cur.delegate, parentRef:
|
|
77
|
+
const root = isRoot(cur);
|
|
78
|
+
links.push({ ref, delegator: cur.delegator, delegate: cur.delegate, parentRef: root ? null : cur.authority });
|
|
26
79
|
delegations.push(cur);
|
|
27
|
-
|
|
80
|
+
// A root ENDS the chain: nothing above it is consulted, so a root can never sit in a non-terminal position
|
|
81
|
+
// of what this returns.
|
|
82
|
+
if (root)
|
|
28
83
|
break;
|
|
29
84
|
const parent = byRef.get(lc(String(cur.authority)));
|
|
30
85
|
if (!parent) {
|
|
31
|
-
return { ok: false, code: 'chain-parent-missing', reason: `${ref
|
|
86
|
+
return { ok: false, code: 'chain-parent-missing', reason: `${short(ref)} is a child whose parent ${short(String(cur.authority))} was not presented — a child alone is not authority; the chain is verified whole or not at all` };
|
|
32
87
|
}
|
|
33
88
|
// CONTINUITY: a child is minted by the party the parent was granted TO. Anything else is two grants
|
|
34
89
|
// that happen to reference each other, not a chain of attenuation.
|
|
35
90
|
if (lc(parent.delegate) !== lc(cur.delegator)) {
|
|
36
|
-
return { ok: false, code: 'chain-broken', reason: `${ref
|
|
91
|
+
return { ok: false, code: 'chain-broken', reason: `${short(ref)} was minted by ${cur.delegator}, but its parent was granted to ${parent.delegate}` };
|
|
37
92
|
}
|
|
38
93
|
cur = parent;
|
|
39
94
|
}
|
|
@@ -49,22 +104,93 @@ export function assembleAuthorityChain(input) {
|
|
|
49
104
|
delegations,
|
|
50
105
|
};
|
|
51
106
|
}
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
107
|
+
/**
|
|
108
|
+
* Assemble the chain and judge it WHOLE (spec 383, amended by spec 445 §3.1). In order, cheapest first, so a
|
|
109
|
+
* chain that is refused on its face costs no chain read:
|
|
110
|
+
*
|
|
111
|
+
* 1. SHAPE — `assembleAuthorityChain`.
|
|
112
|
+
* 2. THE ROOT IS THE PRINCIPAL — the root delegator equals `principal`, else `chain-root-not-principal`.
|
|
113
|
+
* 3. ATTENUATION — for each adjacent pair that carries the step's requirement type,
|
|
114
|
+
* `handler.isSubset(child, parent)`, else `chain-not-attenuated`. A standing parent binds no intent, so
|
|
115
|
+
* any reason is within it; a child that carries no readable bound under a parent that does is not within it.
|
|
116
|
+
* 4. THE STEP AGAINST EVERY PARENT — each parent's caveats, STRICTLY, in the same context the leaf is judged
|
|
117
|
+
* in (capability selector, target, value, intent / offer / projection / plan digests, payload classes),
|
|
118
|
+
* then the handler's limits (amount, payee; audience, predicate, issuer), else `chain-link-denies-step`.
|
|
119
|
+
* A caveat no off-chain judge can answer is a refusal — unless the step redeems on chain, where the
|
|
120
|
+
* DelegationManager runs that parent's enforcer itself.
|
|
121
|
+
* 5. LIVENESS — every parent signed by its delegator, unrevoked, in window, else `chain-link-dead`.
|
|
122
|
+
*
|
|
123
|
+
* The LEAF's own liveness, intent binding and limits are `verifyMandateForStep`'s; the two are run together
|
|
124
|
+
* (the harness composition, the presentation release). Before spec 445 only (1) and (5) existed: a parent was
|
|
125
|
+
* read with a timestamp-only context, which made every scoping caveat on it inert, and nothing compared a
|
|
126
|
+
* child to its parent after mint (audit H-7 / AUTH-1).
|
|
127
|
+
*/
|
|
54
128
|
export async function verifyAuthorityChain(input) {
|
|
55
|
-
const assembled = assembleAuthorityChain({ leaf: input.leaf, presented: input.presented, digestOf: input.checks.delegationDigest, maxDepth: input.maxDepth });
|
|
129
|
+
const assembled = assembleAuthorityChain({ leaf: input.leaf, presented: input.presented, digestOf: input.checks.delegationDigest, maxDepth: input.maxDepth, presentedAs: input.presentedAs });
|
|
56
130
|
if (!assembled.ok)
|
|
57
131
|
return assembled;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
132
|
+
const { delegations, chain } = assembled;
|
|
133
|
+
const n = delegations.length;
|
|
134
|
+
const where = (i) => `link ${i + 1} of ${n} (${short(chain.links[i].ref)})`;
|
|
135
|
+
// 2. the root is the principal
|
|
136
|
+
if (lc(chain.accountabilityRoot) !== lc(input.principal)) {
|
|
137
|
+
return { ok: false, code: 'chain-root-not-principal', reason: `the step needs the authority of ${input.principal}, and this chain's root was granted by ${chain.accountabilityRoot} — a grant by another party is not that authority, whatever it names` };
|
|
138
|
+
}
|
|
139
|
+
// 2b. Spec 445 / DLG-2 — the manager refuses a redemption whose call target is the root delegator; so do we.
|
|
140
|
+
if (input.step.callTarget && isSelfTargetedRedemption(delegations, input.step.callTarget)) {
|
|
141
|
+
return { ok: false, code: 'self-target', reason: `the redemption would make the root delegator ${chain.accountabilityRoot} call itself — the DelegationManager refuses a self-targeted redemption (SelfTargetedRedemption)` };
|
|
142
|
+
}
|
|
143
|
+
// 3. attenuation, pair by pair
|
|
144
|
+
const h = subsetHandlerFor(input.requirementType, input.handlers);
|
|
145
|
+
if (!h)
|
|
146
|
+
return { ok: false, code: 'chain-not-attenuated', reason: `no subset handler for ${input.requirementType} — a chain nobody can bound is not attenuated` };
|
|
147
|
+
const grants = delegations.map((d) => readGrant(d, input.requirementType, input.enforcers, input.handlers));
|
|
148
|
+
if (input.requireEveryLinkTyped) {
|
|
149
|
+
const untyped = grants.findIndex((g) => g === null);
|
|
150
|
+
if (untyped >= 0)
|
|
151
|
+
return { ok: false, code: 'chain-not-attenuated', reason: `${where(untyped)} does not decode as a ${input.requirementType} grant — every link of this chain must state its own scope` };
|
|
152
|
+
}
|
|
153
|
+
const NO_REASON = `0x${'00'.repeat(32)}`;
|
|
154
|
+
for (let i = 1; i < n; i++) {
|
|
155
|
+
const parent = grants[i];
|
|
156
|
+
const child = grants[i - 1];
|
|
157
|
+
if (!parent)
|
|
158
|
+
continue; // another shape of wire: judged strictly, caveat by caveat, in (4)
|
|
159
|
+
if (!child)
|
|
160
|
+
return { ok: false, code: 'chain-not-attenuated', reason: `${where(i - 1)} carries no readable ${input.requirementType} bound, and its parent does — a child that states no bound is not within one` };
|
|
161
|
+
// A standing parent binds no intent, so the child's reason is within it. A parent that binds one must be
|
|
162
|
+
// matched exactly (`baseIsSubset`); a child with no reason under a parent with one is wider, and refused.
|
|
163
|
+
const childReq = { ...child, intentDigest: child.intentDigest ?? NO_REASON };
|
|
164
|
+
const parentReq = { ...parent, intentDigest: parent.intentDigest ?? childReq.intentDigest };
|
|
165
|
+
let within = false;
|
|
166
|
+
try {
|
|
167
|
+
within = h.isSubset(childReq, parentReq);
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
within = false;
|
|
171
|
+
} // unreadable limits bound nothing: refuse
|
|
172
|
+
if (!within)
|
|
173
|
+
return { ok: false, code: 'chain-not-attenuated', reason: `${where(i - 1)} is not within its parent ${short(chain.links[i].ref)} (${h.type}) — a delegate cannot grant onward more than it was granted` };
|
|
174
|
+
}
|
|
175
|
+
// 4. the step against every parent
|
|
176
|
+
const target = stepTarget(input.step, input.leaf);
|
|
177
|
+
const digestOfIntent = stepIntentDigest(input.step, input.currentVersions);
|
|
178
|
+
for (let i = 1; i < n; i++) {
|
|
179
|
+
const judged = judgeLinkForStep({
|
|
180
|
+
link: delegations[i], requirementType: input.requirementType, step: input.step, target, digestOfIntent,
|
|
181
|
+
enforcers: input.enforcers, now: input.now, handlers: input.handlers, mustBeMandate: false,
|
|
182
|
+
});
|
|
183
|
+
if (judged.denial)
|
|
184
|
+
return { ok: false, code: 'chain-link-denies-step', reason: `${where(i)} does not cover this step: ${judged.denial.code}: ${judged.denial.message}` };
|
|
185
|
+
}
|
|
186
|
+
// 5. liveness — the chain reads, last
|
|
187
|
+
for (let i = 1; i < n; i++) {
|
|
61
188
|
const live = await verifyLiveDelegation({
|
|
62
|
-
delegation:
|
|
189
|
+
delegation: delegations[i], expectedDelegate: delegations[i - 1].delegator, enforcers: input.enforcers, checks: input.checks, now: input.now,
|
|
63
190
|
});
|
|
64
|
-
if (!live.ok)
|
|
65
|
-
return { ok: false, code: 'chain-link-dead', reason:
|
|
66
|
-
}
|
|
191
|
+
if (!live.ok)
|
|
192
|
+
return { ok: false, code: 'chain-link-dead', reason: `${where(i)} is not live: ${live.reason}` };
|
|
67
193
|
}
|
|
68
|
-
return { ok: true, chain
|
|
194
|
+
return { ok: true, chain };
|
|
69
195
|
}
|
|
70
196
|
//# sourceMappingURL=authority-chain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authority-chain.js","sourceRoot":"","sources":["../src/authority-chain.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authority-chain.js","sourceRoot":"","sources":["../src/authority-chain.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAmB,MAAM,YAAY,CAAC;AAC7D,OA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ACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,MAAM,oBAAoB,CAAC;YACtC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAE,EAAE,gBAAgB,EAAE,WAAW,CAAC,CAAC,GAAG,CAAC,CAAE,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG;SAC/I,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,CAAC,EAAE;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;IACjH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/caveats.d.ts
CHANGED
|
@@ -205,10 +205,19 @@ export type DigestBindingKind = 'intent' | 'projection' | 'offer' | 'plan';
|
|
|
205
205
|
export declare const DIGEST_BINDING_KIND: Record<DigestBindingKind, Hex>;
|
|
206
206
|
/** Reverse map for decoders (lowercased kind hash → name). */
|
|
207
207
|
export declare const DIGEST_KIND_NAMES: ReadonlyMap<string, DigestBindingKind>;
|
|
208
|
-
|
|
208
|
+
/** Spec 445 / generation 4 / B1 (audit DLG-3) — THE USE BOUND IS IN THE SIGNED TERMS. On chain
|
|
209
|
+
* `DigestBindingEnforcer.decodeTerms` reads 64 bytes `(kind, digest)` as exactly ONE redemption and 96 bytes
|
|
210
|
+
* `(kind, digest, uint256 maxUses)` as at most `maxUses` (≥ 1); any other length reverts `BadTermsLength`, a zero
|
|
211
|
+
* count `ZeroMaxUses`. Omit `maxUses` ⇒ the 64-byte single-use form. A count is never inferred: the caller that
|
|
212
|
+
* knows how many on-chain calls the mandate covers states it. (A generation ≤ 3 enforcer reads only the first two
|
|
213
|
+
* words and bounds nothing by count — pass `maxUses` only to a generation-4 estate.) */
|
|
214
|
+
export declare function encodeDigestBindingTerms(kind: DigestBindingKind, digest: Hex, maxUses?: number): Hex;
|
|
215
|
+
/** The exact mirror of `DigestBindingEnforcer.decodeTerms`: 64 bytes ⇒ `maxUses: 1`; 96 bytes ⇒ the signed count
|
|
216
|
+
* (zero refused); any other length refused — a two-word decode would silently ignore a third word. */
|
|
209
217
|
export declare function decodeDigestBindingTerms(terms: Hex): {
|
|
210
218
|
kind: DigestBindingKind;
|
|
211
219
|
digest: Hex;
|
|
220
|
+
maxUses: number;
|
|
212
221
|
};
|
|
213
222
|
/** The `args` a redeemer supplies at redemption: the digest it is acting under AND the step's nonce
|
|
214
223
|
* (abi-encoded `(bytes32 presented, bytes32 stepNonce)`). Supplying the digest is the on-chain commitment;
|
|
@@ -218,7 +227,7 @@ export declare function decodeDigestBindingTerms(terms: Hex): {
|
|
|
218
227
|
export type DigestBindingArgsScheme = {
|
|
219
228
|
generation: 1;
|
|
220
229
|
} | {
|
|
221
|
-
generation: 2;
|
|
230
|
+
generation: 2 | 3 | 4;
|
|
222
231
|
stepNonce: Hex;
|
|
223
232
|
};
|
|
224
233
|
export declare function encodeDigestBindingArgs(digest: Hex, scheme: DigestBindingArgsScheme): Hex;
|
|
@@ -234,7 +243,161 @@ export declare function decodePayloadClassesTerms(terms: Hex): string[];
|
|
|
234
243
|
export declare function buildPayloadClassesCaveat(enforcer: Address, classIris: readonly string[]): Caveat;
|
|
235
244
|
/** One digest-binding caveat. Args are NOT pre-filled: they are the redeemer's per-step commitment
|
|
236
245
|
* (`encodeDigestBindingArgs`), set at redemption — a pre-filled value would be one nonce for every step. */
|
|
237
|
-
export declare function buildDigestBindingCaveat(enforcer: Address, kind: DigestBindingKind, digest: Hex): Caveat;
|
|
246
|
+
export declare function buildDigestBindingCaveat(enforcer: Address, kind: DigestBindingKind, digest: Hex, maxUses?: number): Caveat;
|
|
247
|
+
/** Every digest binding's signed use bound, by kind (64-byte terms ⇒ 1). Spec 445 / generation 4 / DLG-3. */
|
|
248
|
+
export declare function readDigestBindingUses(caveats: readonly Caveat[], enforcer: Address): Partial<Record<DigestBindingKind, number>>;
|
|
249
|
+
/** Hand-maintained ABI for the generation-4 `DigestBindingEnforcer` readers + errors (spec 445 / B1, DLG-3):
|
|
250
|
+
* `isUsed` takes the REDEEMER (the step nonce is recorded per redeemer); `usesOf` is the spent count. */
|
|
251
|
+
export declare const digestBindingEnforcerAbi: readonly [{
|
|
252
|
+
readonly type: "function";
|
|
253
|
+
readonly name: "isUsed";
|
|
254
|
+
readonly stateMutability: "view";
|
|
255
|
+
readonly inputs: readonly [{
|
|
256
|
+
readonly name: "delegator";
|
|
257
|
+
readonly type: "address";
|
|
258
|
+
}, {
|
|
259
|
+
readonly name: "delegationHash";
|
|
260
|
+
readonly type: "bytes32";
|
|
261
|
+
}, {
|
|
262
|
+
readonly name: "kind";
|
|
263
|
+
readonly type: "bytes32";
|
|
264
|
+
}, {
|
|
265
|
+
readonly name: "redeemer";
|
|
266
|
+
readonly type: "address";
|
|
267
|
+
}, {
|
|
268
|
+
readonly name: "stepNonce";
|
|
269
|
+
readonly type: "bytes32";
|
|
270
|
+
}];
|
|
271
|
+
readonly outputs: readonly [{
|
|
272
|
+
readonly name: "";
|
|
273
|
+
readonly type: "bool";
|
|
274
|
+
}];
|
|
275
|
+
}, {
|
|
276
|
+
readonly type: "function";
|
|
277
|
+
readonly name: "usesOf";
|
|
278
|
+
readonly stateMutability: "view";
|
|
279
|
+
readonly inputs: readonly [{
|
|
280
|
+
readonly name: "delegator";
|
|
281
|
+
readonly type: "address";
|
|
282
|
+
}, {
|
|
283
|
+
readonly name: "delegationHash";
|
|
284
|
+
readonly type: "bytes32";
|
|
285
|
+
}, {
|
|
286
|
+
readonly name: "kind";
|
|
287
|
+
readonly type: "bytes32";
|
|
288
|
+
}];
|
|
289
|
+
readonly outputs: readonly [{
|
|
290
|
+
readonly name: "";
|
|
291
|
+
readonly type: "uint256";
|
|
292
|
+
}];
|
|
293
|
+
}, {
|
|
294
|
+
readonly type: "function";
|
|
295
|
+
readonly name: "decodeTerms";
|
|
296
|
+
readonly stateMutability: "pure";
|
|
297
|
+
readonly inputs: readonly [{
|
|
298
|
+
readonly name: "terms";
|
|
299
|
+
readonly type: "bytes";
|
|
300
|
+
}];
|
|
301
|
+
readonly outputs: readonly [{
|
|
302
|
+
readonly name: "kind";
|
|
303
|
+
readonly type: "bytes32";
|
|
304
|
+
}, {
|
|
305
|
+
readonly name: "digest";
|
|
306
|
+
readonly type: "bytes32";
|
|
307
|
+
}, {
|
|
308
|
+
readonly name: "maxUses";
|
|
309
|
+
readonly type: "uint256";
|
|
310
|
+
}];
|
|
311
|
+
}, {
|
|
312
|
+
readonly type: "event";
|
|
313
|
+
readonly name: "DigestBindingRedeemed";
|
|
314
|
+
readonly anonymous: false;
|
|
315
|
+
readonly inputs: readonly [{
|
|
316
|
+
readonly name: "delegator";
|
|
317
|
+
readonly type: "address";
|
|
318
|
+
readonly indexed: true;
|
|
319
|
+
}, {
|
|
320
|
+
readonly name: "delegationHash";
|
|
321
|
+
readonly type: "bytes32";
|
|
322
|
+
readonly indexed: true;
|
|
323
|
+
}, {
|
|
324
|
+
readonly name: "kind";
|
|
325
|
+
readonly type: "bytes32";
|
|
326
|
+
readonly indexed: true;
|
|
327
|
+
}, {
|
|
328
|
+
readonly name: "presented";
|
|
329
|
+
readonly type: "bytes32";
|
|
330
|
+
readonly indexed: false;
|
|
331
|
+
}, {
|
|
332
|
+
readonly name: "stepNonce";
|
|
333
|
+
readonly type: "bytes32";
|
|
334
|
+
readonly indexed: false;
|
|
335
|
+
}, {
|
|
336
|
+
readonly name: "redeemer";
|
|
337
|
+
readonly type: "address";
|
|
338
|
+
readonly indexed: false;
|
|
339
|
+
}, {
|
|
340
|
+
readonly name: "use";
|
|
341
|
+
readonly type: "uint256";
|
|
342
|
+
readonly indexed: false;
|
|
343
|
+
}, {
|
|
344
|
+
readonly name: "maxUses";
|
|
345
|
+
readonly type: "uint256";
|
|
346
|
+
readonly indexed: false;
|
|
347
|
+
}];
|
|
348
|
+
}, {
|
|
349
|
+
readonly type: "error";
|
|
350
|
+
readonly name: "BadTermsLength";
|
|
351
|
+
readonly inputs: readonly [];
|
|
352
|
+
}, {
|
|
353
|
+
readonly type: "error";
|
|
354
|
+
readonly name: "BadArgsLength";
|
|
355
|
+
readonly inputs: readonly [];
|
|
356
|
+
}, {
|
|
357
|
+
readonly type: "error";
|
|
358
|
+
readonly name: "ZeroMaxUses";
|
|
359
|
+
readonly inputs: readonly [];
|
|
360
|
+
}, {
|
|
361
|
+
readonly type: "error";
|
|
362
|
+
readonly name: "DigestMismatch";
|
|
363
|
+
readonly inputs: readonly [{
|
|
364
|
+
readonly name: "kind";
|
|
365
|
+
readonly type: "bytes32";
|
|
366
|
+
}, {
|
|
367
|
+
readonly name: "bound";
|
|
368
|
+
readonly type: "bytes32";
|
|
369
|
+
}, {
|
|
370
|
+
readonly name: "presented";
|
|
371
|
+
readonly type: "bytes32";
|
|
372
|
+
}];
|
|
373
|
+
}, {
|
|
374
|
+
readonly type: "error";
|
|
375
|
+
readonly name: "StepNonceReused";
|
|
376
|
+
readonly inputs: readonly [{
|
|
377
|
+
readonly name: "kind";
|
|
378
|
+
readonly type: "bytes32";
|
|
379
|
+
}, {
|
|
380
|
+
readonly name: "stepNonce";
|
|
381
|
+
readonly type: "bytes32";
|
|
382
|
+
}];
|
|
383
|
+
}, {
|
|
384
|
+
readonly type: "error";
|
|
385
|
+
readonly name: "UsesExhausted";
|
|
386
|
+
readonly inputs: readonly [{
|
|
387
|
+
readonly name: "kind";
|
|
388
|
+
readonly type: "bytes32";
|
|
389
|
+
}, {
|
|
390
|
+
readonly name: "maxUses";
|
|
391
|
+
readonly type: "uint256";
|
|
392
|
+
}];
|
|
393
|
+
}, {
|
|
394
|
+
readonly type: "error";
|
|
395
|
+
readonly name: "NotDelegationManager";
|
|
396
|
+
readonly inputs: readonly [{
|
|
397
|
+
readonly name: "caller";
|
|
398
|
+
readonly type: "address";
|
|
399
|
+
}];
|
|
400
|
+
}];
|
|
238
401
|
/** Every digest binding a delegation carries, by kind. Empty ⇒ a standing capability, not a mandate. */
|
|
239
402
|
export declare function readDigestBindings(caveats: readonly Caveat[], enforcer: Address): Partial<Record<DigestBindingKind, Hex>>;
|
|
240
403
|
export declare function encodeSessionAudienceTerms(delegates: readonly Address[]): Hex;
|