@proof-holdings/delegation-verifier 0.1.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,oEAAoE;AACpE,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,CAAC;AAE1C,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,YAAY,CAAC;IACnB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEjF,MAAM,WAAW,aAAa;IAC5B,+EAA+E;IAC/E,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,yEAAyE;IACzE,QAAQ,EAAE,aAAa,CAAC;IACxB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAClC,mDAAmD;IACnD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,0CAA0C;IAC1C,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,oFAAoF;IACpF,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,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b,MAAM,EAAE,aAAa,CAAC;IACtB,oGAAoG;IACpG,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG,mBAAmB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Public types of the Proof of Delegation reference verifier.
3
+ *
4
+ * The library verifies a delegation token — an attestation that the domain in `principal`
5
+ * authorized the artifact in `delegate` for a set of capability scopes. It attests NOTHING
6
+ * about the artifact's quality, safety or the business behind it, and it is not a statement
7
+ * that anyone "verified" the server.
8
+ *
9
+ * Two design rules separate this from an SDK, and both are load-bearing:
10
+ *
11
+ * 1. There is NO default trust list. `trustedIssuers` is supplied by the caller on every
12
+ * call — a verifier that trusts an issuer because the library shipped with its name
13
+ * hard-coded is a client for that issuer, not a verifier.
14
+ * 2. `delegate` is REQUIRED. The token is a bearer artifact: anyone can copy a genuine
15
+ * token into their own package. The comparison that defeats that is against the artifact
16
+ * identity the CALLER resolved independently — never against what the card says about
17
+ * itself.
18
+ */
19
+ const UNCONFIRMED_REASONS = new Set([
20
+ 'status_unavailable',
21
+ 'jwks_unavailable',
22
+ 'status_uri_untrusted',
23
+ ]);
24
+ /**
25
+ * Whether a `FailureReason` means "checked, and it's bad" (`invalid`) or "could not check"
26
+ * (`unconfirmed`). The three status-channel reasons that mean the revocation check itself
27
+ * failed are `unconfirmed`; every other reason is a completed check with a negative verdict,
28
+ * including a call-shape error — `verifyDelegation` always receives a well-formed
29
+ * `VerifyOptions` in practice, so those are `invalid` for exhaustiveness, not because they
30
+ * occur.
31
+ */
32
+ export function classifyFailureReason(reason) {
33
+ return UNCONFIRMED_REASONS.has(reason) ? 'unconfirmed' : 'invalid';
34
+ }
35
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA8GH,MAAM,mBAAmB,GAA+B,IAAI,GAAG,CAAC;IAC9D,oBAAoB;IACpB,kBAAkB;IAClB,sBAAsB;CACvB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAqB;IACzD,OAAO,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;AACrE,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `verifyDelegation` — the chain: signature → principal → delegate → status.
3
+ *
4
+ * Order is deliberate. Everything that can be decided WITHOUT the network is decided first, so
5
+ * a token from an untrusted issuer, a token about someone else's artifact and an expired token
6
+ * all cost zero outbound requests. Only a token that has already survived those checks is
7
+ * worth asking the issuer about.
8
+ */
9
+ import type { VerificationResult, VerifyOptions } from './types.js';
10
+ export declare function verifyDelegation(token: string, options: VerifyOptions): Promise<VerificationResult>;
11
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,KAAK,EAIV,kBAAkB,EAClB,aAAa,EACd,MAAM,YAAY,CAAC;AAgDpB,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAyNzG"}
package/dist/verify.js ADDED
@@ -0,0 +1,240 @@
1
+ /**
2
+ * `verifyDelegation` — the chain: signature → principal → delegate → status.
3
+ *
4
+ * Order is deliberate. Everything that can be decided WITHOUT the network is decided first, so
5
+ * a token from an untrusted issuer, a token about someone else's artifact and an expired token
6
+ * all cost zero outbound requests. Only a token that has already survived those checks is
7
+ * worth asking the issuer about.
8
+ */
9
+ import { canonicalizeDelegate, DelegateIdentifierError } from './delegate.js';
10
+ import { getVerificationKeys, isSupportedAlgorithm, verifySignature } from './jwks.js';
11
+ import { parseJwt } from './jwt.js';
12
+ import { checkDelegationStatus } from './status.js';
13
+ import { classifyFailureReason } from './types.js';
14
+ /** Delegation token schema versions this verifier understands (major-compatible). */
15
+ const SUPPORTED_SCHEMA_MAJOR = '1';
16
+ const DEFAULT_CLOCK_TOLERANCE_SECONDS = 5;
17
+ const DEFAULT_TIMEOUT_MS = 5_000;
18
+ function fail(reason, message) {
19
+ return { valid: false, reason, outcome: classifyFailureReason(reason), message };
20
+ }
21
+ function findTrustedIssuer(issuers, iss) {
22
+ if (typeof iss !== 'string' || iss.length === 0)
23
+ return undefined;
24
+ return issuers.find((candidate) => candidate.issuer === iss);
25
+ }
26
+ function isHttpsUrl(value) {
27
+ if (typeof value !== 'string')
28
+ return false;
29
+ try {
30
+ return new URL(value).protocol === 'https:';
31
+ }
32
+ catch {
33
+ return false;
34
+ }
35
+ }
36
+ /**
37
+ * A trust entry must be usable AND safe. Every URL it contributes is checked for https, not
38
+ * just the JWKS: `statusEndpoint` receives the whole delegation token in a POST body, and both
39
+ * it and `statusListOrigins` widen the set of origins a token may point the verifier at.
40
+ */
41
+ function isValidIssuerEntry(entry) {
42
+ if (typeof entry !== 'object' || entry === null)
43
+ return false;
44
+ const candidate = entry;
45
+ if (typeof candidate.issuer !== 'string' || candidate.issuer.length === 0)
46
+ return false;
47
+ if (!isHttpsUrl(candidate.jwksUri))
48
+ return false;
49
+ if (candidate.statusEndpoint !== undefined && !isHttpsUrl(candidate.statusEndpoint))
50
+ return false;
51
+ if (candidate.statusListOrigins !== undefined) {
52
+ if (!Array.isArray(candidate.statusListOrigins))
53
+ return false;
54
+ if (!candidate.statusListOrigins.every(isHttpsUrl))
55
+ return false;
56
+ }
57
+ return true;
58
+ }
59
+ function normalizePrincipal(value) {
60
+ return value.trim().toLowerCase();
61
+ }
62
+ export async function verifyDelegation(token, options) {
63
+ // ---------------------------------------------------------------- call-shape checks
64
+ if (!options || typeof options !== 'object') {
65
+ return fail('invalid_options', 'options are required');
66
+ }
67
+ if (!options.delegate) {
68
+ return fail('invalid_options', 'delegate is required: the verifier compares the token against the artifact identity YOU resolved, never against what the card says about itself');
69
+ }
70
+ let expectedDelegate;
71
+ try {
72
+ expectedDelegate = canonicalizeDelegate(options.delegate);
73
+ }
74
+ catch (error) {
75
+ return fail('invalid_options', error instanceof DelegateIdentifierError ? error.message : 'delegate could not be canonicalized');
76
+ }
77
+ // Compared as exact strings, deliberately NOT through the issuer-side scope canonicalizer:
78
+ // scope grammar is the issuer's, and running another issuer's `mcp:tools/call` through
79
+ // proof.holdings' kebab-case rules would make the requirement unaskable rather than merely
80
+ // over-constrained.
81
+ let requiredScopes = [];
82
+ if (options.requiredScopes !== undefined) {
83
+ if (!Array.isArray(options.requiredScopes) || options.requiredScopes.some((entry) => typeof entry !== 'string')) {
84
+ return fail('invalid_options', 'requiredScopes must be an array of strings');
85
+ }
86
+ requiredScopes = options.requiredScopes.map((entry) => entry.trim()).filter((entry) => entry.length > 0);
87
+ }
88
+ // Validated like every other option rather than trusted: this is the pin that closes the
89
+ // sibling attack, and a non-string reaching `normalizePrincipal` would throw out of a
90
+ // function whose whole contract is to RETURN a discriminated result — worst on the untyped
91
+ // consumers this package is aimed at.
92
+ if (options.expectedPrincipal !== undefined) {
93
+ if (typeof options.expectedPrincipal !== 'string' || options.expectedPrincipal.trim().length === 0) {
94
+ return fail('invalid_options', 'expectedPrincipal must be a non-empty string when supplied');
95
+ }
96
+ }
97
+ const issuers = Array.isArray(options.trustedIssuers) ? options.trustedIssuers.filter(isValidIssuerEntry) : [];
98
+ if (issuers.length === 0) {
99
+ return fail('no_trust_policy', 'trustedIssuers is empty: this verifier has no built-in trust list, so the caller must name the issuers it accepts (each with an https jwksUri)');
100
+ }
101
+ const fetchImpl = options.fetch ?? ((input, init) => fetch(input, init));
102
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
103
+ const clockToleranceSeconds = options.clockToleranceSeconds ?? DEFAULT_CLOCK_TOLERANCE_SECONDS;
104
+ const now = options.now ?? new Date();
105
+ const nowSeconds = Math.floor(now.getTime() / 1000);
106
+ // ---------------------------------------------------------------- structural parse
107
+ const parsed = parseJwt(token);
108
+ if (!parsed)
109
+ return fail('malformed_token', 'token is not a decodable three-part JWT');
110
+ const issuer = findTrustedIssuer(issuers, parsed.payload.iss);
111
+ if (!issuer) {
112
+ return fail('untrusted_issuer', `token issuer ${JSON.stringify(parsed.payload.iss)} is not in the supplied trust policy`);
113
+ }
114
+ const alg = parsed.header.alg;
115
+ if (!isSupportedAlgorithm(alg)) {
116
+ // The algorithm is chosen by the verifier, not by the token — `none` and HMAC forgeries
117
+ // die here, before any key is fetched.
118
+ return fail('unsupported_algorithm', `token algorithm ${JSON.stringify(alg)} is not accepted`);
119
+ }
120
+ // ---------------------------------------------------------------- claims (pre-network)
121
+ const claims = parsed.payload;
122
+ if (claims.token_type !== 'delegation') {
123
+ return fail('not_a_delegation', `token_type must be "delegation", got ${JSON.stringify(claims.token_type)}`);
124
+ }
125
+ const schemaVersion = claims.delegation_schema_version;
126
+ if (typeof schemaVersion !== 'string' || schemaVersion.split('.')[0] !== SUPPORTED_SCHEMA_MAJOR) {
127
+ return fail('unsupported_schema', `delegation_schema_version ${JSON.stringify(schemaVersion)} is not supported (this verifier understands ${SUPPORTED_SCHEMA_MAJOR}.x)`);
128
+ }
129
+ const { sub, principal, delegate, control_proof: controlProof, scope, iat, exp } = claims;
130
+ if (typeof sub !== 'string' ||
131
+ sub.length === 0 ||
132
+ typeof principal !== 'string' ||
133
+ principal.length === 0 ||
134
+ typeof delegate !== 'string' ||
135
+ delegate.length === 0 ||
136
+ typeof controlProof !== 'string' ||
137
+ controlProof.length === 0 ||
138
+ !Array.isArray(scope) ||
139
+ scope.length === 0 ||
140
+ scope.some((entry) => typeof entry !== 'string') ||
141
+ typeof iat !== 'number' ||
142
+ typeof exp !== 'number') {
143
+ return fail('malformed_claims', 'token is missing one of sub / principal / delegate / control_proof / scope / iat / exp');
144
+ }
145
+ if (nowSeconds > exp + clockToleranceSeconds) {
146
+ return fail('expired', 'delegation expired');
147
+ }
148
+ if (nowSeconds + clockToleranceSeconds < iat) {
149
+ return fail('not_yet_valid', 'delegation is not valid yet (iat is in the future)');
150
+ }
151
+ if (options.expectedPrincipal !== undefined) {
152
+ if (normalizePrincipal(principal) !== normalizePrincipal(options.expectedPrincipal)) {
153
+ return fail('principal_mismatch', `delegation was issued by ${JSON.stringify(principal)}, not ${JSON.stringify(options.expectedPrincipal)}`);
154
+ }
155
+ }
156
+ // Requirement (a) of the design: the token is a bearer artifact, so this comparison — against
157
+ // an identity the CALLER resolved — is what stops a genuine token being copied into another
158
+ // package's card.
159
+ if (delegate !== expectedDelegate) {
160
+ return fail('delegate_mismatch', `delegation attests ${JSON.stringify(delegate)}, but the artifact you resolved is ${JSON.stringify(expectedDelegate)}`);
161
+ }
162
+ const grantedScopes = scope;
163
+ const grantedTrimmed = grantedScopes.map((entry) => entry.trim());
164
+ const missing = requiredScopes.filter((required) => !grantedTrimmed.includes(required));
165
+ if (missing.length > 0) {
166
+ return fail('scope_not_granted', `delegation does not grant: ${missing.join(', ')}`);
167
+ }
168
+ // ---------------------------------------------------------------- signature
169
+ let keys;
170
+ try {
171
+ keys = await getVerificationKeys({
172
+ jwksUri: issuer.jwksUri,
173
+ kid: typeof parsed.header.kid === 'string' ? parsed.header.kid : undefined,
174
+ alg,
175
+ fetch: fetchImpl,
176
+ timeoutMs,
177
+ });
178
+ }
179
+ catch (error) {
180
+ // "I could not check" is not "the token is bad" — it gets its own reason.
181
+ return fail('jwks_unavailable', error instanceof Error ? error.message : 'JWKS could not be fetched');
182
+ }
183
+ if (keys.length === 0) {
184
+ return fail('unknown_key', 'no key in the issuer JWKS matches this token');
185
+ }
186
+ let signatureOk = false;
187
+ for (const key of keys) {
188
+ if (await verifySignature(key, alg, parsed.signingInput, parsed.signature)) {
189
+ signatureOk = true;
190
+ break;
191
+ }
192
+ }
193
+ if (!signatureOk)
194
+ return fail('bad_signature', 'token signature is invalid');
195
+ const delegation = {
196
+ issuer: issuer.issuer,
197
+ principal,
198
+ delegate,
199
+ scope: grantedScopes,
200
+ controlProof,
201
+ delegationId: sub,
202
+ issuedAt: new Date(iat * 1000),
203
+ expiresAt: new Date(exp * 1000),
204
+ };
205
+ // See `VerificationSuccess.principalChecked`: an issuer binds `delegate` to nothing, so a
206
+ // delegation naming someone else's artifact is a normal thing for any domain to mint. The
207
+ // caller is told whether that half of the question was asked.
208
+ const principalChecked = options.expectedPrincipal !== undefined;
209
+ // ---------------------------------------------------------------- status
210
+ if (options.statusCheck === 'skip') {
211
+ return { valid: true, statusChecked: false, principalChecked, delegation };
212
+ }
213
+ const status = await checkDelegationStatus({
214
+ token,
215
+ claims,
216
+ issuer,
217
+ fetch: fetchImpl,
218
+ timeoutMs,
219
+ now,
220
+ clockToleranceSeconds,
221
+ });
222
+ switch (status.state) {
223
+ case 'valid':
224
+ return { valid: true, statusChecked: true, principalChecked, delegation };
225
+ case 'revoked':
226
+ return fail('revoked', status.message);
227
+ case 'suspended':
228
+ return fail('suspended', status.message);
229
+ case 'expired':
230
+ return fail('expired', status.message);
231
+ case 'unknown':
232
+ return fail('unknown_delegation', status.message);
233
+ case 'untrusted_uri':
234
+ return fail('status_uri_untrusted', status.message);
235
+ case 'unavailable':
236
+ // Fail CLOSED: an unchecked revocation channel is not evidence of validity.
237
+ return fail('status_unavailable', status.message);
238
+ }
239
+ }
240
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,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": "@proof-holdings/delegation-verifier",
3
+ "version": "0.1.0",
4
+ "description": "Issuer-agnostic verifier for Proof of Delegation tokens — checks that a domain authorized an agent artifact, against a trust policy you supply",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "proof.holdings <hello@proof.holdings> (https://proof.holdings)",
8
+ "homepage": "https://proof.holdings",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/ProofHoldings/delegation-verifier.git"
12
+ },
13
+ "bugs": {
14
+ "email": "hello@proof.holdings",
15
+ "url": "https://proof.holdings/support"
16
+ },
17
+ "keywords": [
18
+ "proof-of-delegation",
19
+ "delegation",
20
+ "attestation",
21
+ "mcp",
22
+ "a2a",
23
+ "agent-card",
24
+ "jwt",
25
+ "verification"
26
+ ],
27
+ "main": "dist/index.js",
28
+ "types": "dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ }
34
+ },
35
+ "scripts": {
36
+ "build": "tsc",
37
+ "typecheck": "tsc --noEmit",
38
+ "test": "vitest run",
39
+ "test:watch": "vitest",
40
+ "prepublishOnly": "npm run build && npm test"
41
+ },
42
+ "dependencies": {},
43
+ "devDependencies": {
44
+ "@types/node": "^20.11.0",
45
+ "typescript": "^5.5.0",
46
+ "vitest": "^3.0.0"
47
+ },
48
+ "engines": {
49
+ "node": ">=18.0.0"
50
+ },
51
+ "files": [
52
+ "dist",
53
+ "README.md",
54
+ "LICENSE"
55
+ ],
56
+ "publishConfig": {
57
+ "access": "public"
58
+ }
59
+ }