@kya-os/mcp-i-cloudflare 1.12.1 → 1.12.3

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.
@@ -9,8 +9,12 @@
9
9
  * consent service is untouched.
10
10
  *
11
11
  * - `GET /consent?sid=kya-…` reads the anchor via `INTERNAL_PICKUP_INFO`. An unknown
12
- * sid → 404 page; an expired sid → a "link expired" page; otherwise a minimal
13
- * approve form (the consent-only scope list + a CSRF-protected POST).
12
+ * sid → 404 page; an expired sid → a "link expired" page; otherwise the SAME
13
+ * branded `@kya-os/consent` Lit shell `consent.service.ts` renders for the
14
+ * OAuth path, driven by the project's own `consentConfig`. The anchor sid
15
+ * travels to the approve POST as the shell's `session-id` attribute (see
16
+ * `resolveApproveSid`), since the Lit component has no way to append a query
17
+ * string to its hardcoded `/consent/approve` fetch target.
14
18
  * - `POST /consent/approve?sid=kya-…` mints a delegation VC-JWT using the SAME
15
19
  * `@kya-os/mcp` primitives `consent.service.ts` uses (`wrapDelegationAsVC` →
16
20
  * `createUnsignedVCJWT` → sign → `completeVCJWT`) — calling them directly here, NOT
@@ -23,6 +27,23 @@
23
27
  import type { HonoContext } from "../runtime/oauth-handler";
24
28
  import type { CloudflareEnv } from "../types";
25
29
  import type { HttpChallengeConfig } from "../config";
30
+ /**
31
+ * Resolve the anchor sid for `POST /consent/approve`. The `@kya-os/consent` Lit
32
+ * component (`mcp-consent.ts` `handleApprove()`) always fetches the hardcoded
33
+ * `${serverUrl}/consent/approve` — it has no way to append a query string — so
34
+ * the sid instead travels in the POST body as `session_id` (its own field name,
35
+ * populated from the `session-id` shell attribute {@link renderAnchorConsentShell}
36
+ * sets to the anchor sid). Falls back to the query for the legacy raw-HTML
37
+ * form's `action="/consent/approve?sid=…"` target, which some external PEPs may
38
+ * still construct directly.
39
+ *
40
+ * Peeks the body via `clone()` so the ORIGINAL request stream is never consumed
41
+ * here — `readBodyFields` still performs the one real body read, downstream in
42
+ * `handleAnchorConsentApprove`. `register.ts` calls this BEFORE routing so a
43
+ * flag-off or non-anchor `/consent/approve` POST falls through to `next()` with
44
+ * its body untouched (only a clone was ever read).
45
+ */
46
+ export declare function resolveApproveSid(c: HonoContext): Promise<string | undefined>;
26
47
  /**
27
48
  * Render the anchor consent surface for `GET /consent?sid=kya-…`.
28
49
  */
@@ -1 +1 @@
1
- {"version":3,"file":"consent-anchor-bridge.d.ts","sourceRoot":"","sources":["../../src/delegation-http/consent-anchor-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAWH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AA6arD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,CAAC,EAAE,WAAW,EACd,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GAClC,OAAO,CAAC,QAAQ,CAAC,CAiBnB;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,CAAC,EAAE,WAAW,EACd,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GACjC,OAAO,CAAC,QAAQ,CAAC,CAyEnB"}
1
+ {"version":3,"file":"consent-anchor-bridge.d.ts","sourceRoot":"","sources":["../../src/delegation-http/consent-anchor-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAkBH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAqVrD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CACrC,CAAC,EAAE,WAAW,GACb,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAyB7B;AA2QD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,CAAC,EAAE,WAAW,EACd,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GAClC,OAAO,CAAC,QAAQ,CAAC,CA4DnB;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,CAAC,EAAE,WAAW,EACd,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GACjC,OAAO,CAAC,QAAQ,CAAC,CAkNnB"}
@@ -9,8 +9,12 @@
9
9
  * consent service is untouched.
10
10
  *
11
11
  * - `GET /consent?sid=kya-…` reads the anchor via `INTERNAL_PICKUP_INFO`. An unknown
12
- * sid → 404 page; an expired sid → a "link expired" page; otherwise a minimal
13
- * approve form (the consent-only scope list + a CSRF-protected POST).
12
+ * sid → 404 page; an expired sid → a "link expired" page; otherwise the SAME
13
+ * branded `@kya-os/consent` Lit shell `consent.service.ts` renders for the
14
+ * OAuth path, driven by the project's own `consentConfig`. The anchor sid
15
+ * travels to the approve POST as the shell's `session-id` attribute (see
16
+ * `resolveApproveSid`), since the Lit component has no way to append a query
17
+ * string to its hardcoded `/consent/approve` fetch target.
14
18
  * - `POST /consent/approve?sid=kya-…` mints a delegation VC-JWT using the SAME
15
19
  * `@kya-os/mcp` primitives `consent.service.ts` uses (`wrapDelegationAsVC` →
16
20
  * `createUnsignedVCJWT` → sign → `completeVCJWT`) — calling them directly here, NOT
@@ -21,11 +25,16 @@
21
25
  * @module @kya-os/mcp-i-cloudflare/delegation-http/consent-anchor-bridge
22
26
  */
23
27
  import { wrapDelegationAsVC, createUnsignedVCJWT, completeVCJWT, base64urlEncodeFromBytes, generateDidKeyFromBase64, didKeyFragment, } from "@kya-os/mcp";
28
+ import { generateConsentShell, resolveCapabilitiesForScopes, } from "@kya-os/consent";
24
29
  import { WebCryptoProvider } from "../providers/crypto";
25
30
  import { getConfiguredIdentity } from "../providers/storage";
26
31
  import { escapeHtml } from "../services/consent-templates/base/escape";
32
+ import { createCredentialAuthHandler } from "../services/credential-auth.handler";
33
+ import { ConsentConfigService, } from "../services/consent-config.service";
27
34
  import { getAnchorStub } from "./anchor-routing";
28
35
  import { INTERNAL_PICKUP_INFO, INTERNAL_PICKUP_APPROVE } from "./constants";
36
+ import { isAnchorSid } from "./sid";
37
+ import { resolveAnchorCredentialProvider, resolveCredentialIdentity, notifyDelegation, } from "./credential-consent";
29
38
  /** Internal origin for durable-object stub fetches — the DO routes by pathname only. */
30
39
  const DO_INTERNAL_ORIGIN = "https://do.internal";
31
40
  /**
@@ -51,6 +60,21 @@ function htmlResponse(html, status) {
51
60
  },
52
61
  });
53
62
  }
63
+ /**
64
+ * A JSON response with the mandated `Cache-Control: no-store`. Mirrors
65
+ * {@link htmlResponse} — used by `POST /consent/approve` (a JSON API consumed
66
+ * by the `@kya-os/consent` Lit component's `fetch()`, never a browser
67
+ * navigation), unlike `GET /consent`, which still renders the HTML shell.
68
+ */
69
+ function jsonResponse(body, status) {
70
+ return new Response(JSON.stringify(body), {
71
+ status,
72
+ headers: {
73
+ "Content-Type": "application/json",
74
+ "Cache-Control": "no-store",
75
+ },
76
+ });
77
+ }
54
78
  /** Minimal self-contained HTML page shell (no external bundle dependency). */
55
79
  function page(title, bodyInner) {
56
80
  return `<!DOCTYPE html>
@@ -86,33 +110,200 @@ function approvalFailedPage(message, status = 410) {
86
110
  <p>${escapeHtml(message)}</p>
87
111
  </main>`), status);
88
112
  }
89
- /** Success page after a delegation is parked on the anchor. */
90
- function successPage() {
91
- return htmlResponse(page("Authorization complete", `<main class="kya-consent-success">
92
- <h1>Authorization complete</h1>
93
- <p>You have authorized the request. You can close this window and return to the application.</p>
94
- </main>`), 200);
113
+ /**
114
+ * JSON 404 body for `POST /consent/approve` on an unknown anchor sid — the
115
+ * JSON-API twin of {@link notFoundPage} (which stays HTML-only for the `GET
116
+ * /consent` page render).
117
+ */
118
+ function notFoundJson() {
119
+ return jsonResponse({
120
+ error: "We could not find this authorization request. It may have already completed or been cancelled.",
121
+ }, 404);
122
+ }
123
+ /**
124
+ * Generic JSON approval-failed body for `POST /consent/approve` (e.g. the
125
+ * anchor expired between GET and POST). The JSON-API twin of
126
+ * {@link approvalFailedPage}, which stays HTML-only for the `GET /consent`
127
+ * page render's own error cases.
128
+ */
129
+ function approvalFailedJson(message, status = 410) {
130
+ return jsonResponse({ error: message }, status);
131
+ }
132
+ /**
133
+ * Success body after a delegation is parked on the anchor: `@kya-os/consent`'s
134
+ * `handleApprove()` reads `result.delegation_id` (and, absent a
135
+ * `redirectUrl`, renders its own success screen from it) — the anchor path
136
+ * mints in a single POST with no clickwrap redirect, so `redirectUrl` is
137
+ * deliberately omitted.
138
+ */
139
+ function successJson(delegationId) {
140
+ return jsonResponse({ success: true, delegation_id: delegationId }, 200);
141
+ }
142
+ /**
143
+ * Resolve capability groups for the shell: prefer the operator-authored
144
+ * `consentConfig.capabilities`; otherwise derive from the anchor's required
145
+ * scopes via the `@kya-os/consent` default registry. Mirrors
146
+ * `consent.service.ts`'s own fallback so the humanized capability layout
147
+ * renders even when the dashboard hasn't pushed capability metadata yet.
148
+ */
149
+ function resolveAnchorCapabilities(consentConfig, scopes) {
150
+ if (consentConfig.capabilities && consentConfig.capabilities.length > 0) {
151
+ return consentConfig.capabilities;
152
+ }
153
+ if (scopes.length === 0)
154
+ return undefined;
155
+ const derived = resolveCapabilitiesForScopes(scopes);
156
+ if (derived.length === 0)
157
+ return undefined;
158
+ return [{ id: "default", label: "Permissions", capabilities: derived }];
159
+ }
160
+ /**
161
+ * Render the branded `@kya-os/consent` Lit shell for the anchor path — the SAME
162
+ * screen `consent.service.ts` renders for the OAuth / consent-only flow
163
+ * (`TemplateRenderer.renderCSR` / `renderCredentialPageCSR`), driven by the
164
+ * project's own `consentConfig` (branding, terms, credentials copy, and
165
+ * capabilities) fetched via `ConsentConfigService`.
166
+ *
167
+ * `sessionId` carries the anchor `sid`: the Lit component's `handleApprove()`
168
+ * always POSTs to a hardcoded `${serverUrl}/consent/approve` with no way to
169
+ * append a query string, so the sid instead travels in the approve POST body as
170
+ * the component's own `session_id` field. `register.ts`'s approve route
171
+ * recovers it from there via `resolveApproveSid` when the query is empty.
172
+ */
173
+ function renderAnchorConsentShell(params) {
174
+ const { consentConfig, info, sid, csrfToken, serverUrl, projectId, credential, } = params;
175
+ // Credential branch: source labels from the REAL merchant-configured fields —
176
+ // `provider.config.consentOverrides` (per-provider overrides:
177
+ // `identityFieldLabel` / `passwordFieldLabel`, populated by
178
+ // `credential-consent.ts`'s `buildCredentialConfig`) and the project's own
179
+ // `consentConfig.credentials` block (placeholders / remember-me / forgot-
180
+ // password, which have no per-provider equivalent at all) — falling back to
181
+ // the shell's hardcoded defaults last. `CredentialProviderConfig` has no
182
+ // top-level `usernameLabel`/`usernamePlaceholder`/etc fields (reading them was
183
+ // an `as any` bug that always silently fell to the hardcoded defaults); typing
184
+ // `cpc` for real lets the compiler catch that class of mistake again.
185
+ const cpc = credential?.provider.config;
186
+ const cpcOverrides = cpc?.consentOverrides;
187
+ const shellConfig = {
188
+ branding: consentConfig.branding,
189
+ terms: consentConfig.terms,
190
+ customFields: consentConfig.customFields,
191
+ ui: consentConfig.ui,
192
+ expirationDays: consentConfig.expirationDays,
193
+ credentials: credential
194
+ ? {
195
+ usernameLabel: cpcOverrides?.identityFieldLabel ||
196
+ consentConfig.credentials?.usernameLabel ||
197
+ "Username",
198
+ usernamePlaceholder: consentConfig.credentials?.usernamePlaceholder ||
199
+ "Enter your username",
200
+ passwordLabel: cpcOverrides?.passwordFieldLabel ||
201
+ consentConfig.credentials?.passwordLabel ||
202
+ "Password",
203
+ passwordPlaceholder: consentConfig.credentials?.passwordPlaceholder ||
204
+ "Enter your password",
205
+ showRememberMe: consentConfig.credentials?.showRememberMe ?? true,
206
+ showForgotPassword: consentConfig.credentials?.showForgotPassword ?? false,
207
+ forgotPasswordUrl: consentConfig.credentials?.forgotPasswordUrl,
208
+ }
209
+ : consentConfig.credentials,
210
+ };
211
+ const shellOptions = {
212
+ config: shellConfig,
213
+ tool: "",
214
+ scopes: info.requiredScopes,
215
+ agentDid: info.agentDid || "",
216
+ sessionId: sid,
217
+ projectId,
218
+ serverUrl,
219
+ // Browser-tab title only (the in-page heading is `shellConfig.ui.title`,
220
+ // shared across screens) — surface the provider's display name here for the
221
+ // credential branch instead of dropping it entirely.
222
+ pageTitle: credential
223
+ ? `Sign in to ${credential.provider.displayName}`
224
+ : "Permission Request",
225
+ csrfToken,
226
+ capabilities: resolveAnchorCapabilities(consentConfig, info.requiredScopes),
227
+ agentMetadata: consentConfig.agentMetadata,
228
+ consentTheme: consentConfig.theme,
229
+ headlineVerb: consentConfig.headlineVerb,
230
+ revocationPath: consentConfig.revocationPath,
231
+ inactivityDays: consentConfig.inactivityDays,
232
+ ...(credential
233
+ ? {
234
+ authMode: "credentials",
235
+ provider: credential.provider.providerId,
236
+ authorizationType: "password",
237
+ }
238
+ : {}),
239
+ };
240
+ return generateConsentShell(shellOptions);
241
+ }
242
+ /**
243
+ * Resolve the worker's own origin for the shell's `serverUrl` — the same-origin
244
+ * target the `@kya-os/consent` Lit component POSTs its approve request to.
245
+ * Prefers the explicit `MCP_SERVER_URL` env var (matches `consent.service.ts`'s
246
+ * own resolution), falling back to the incoming request's origin.
247
+ */
248
+ function resolveServerUrl(env, c) {
249
+ const configured = env.MCP_SERVER_URL;
250
+ if (configured && configured !== "null" && configured.startsWith("http")) {
251
+ return configured;
252
+ }
253
+ const raw = c.req?.raw;
254
+ if (raw) {
255
+ try {
256
+ return new URL(raw.url).origin;
257
+ }
258
+ catch {
259
+ // Fall through to empty string (relative fetch — resolves against the
260
+ // page's own origin in a real browser).
261
+ }
262
+ }
263
+ return "";
95
264
  }
96
265
  /**
97
- * Render the minimal anchor approve form. Reuses the consent-only scope-list shape
98
- * (escaped scope items) and posts to `/consent/approve?sid=…` with a CSRF token.
266
+ * Resolve the anchor sid for `POST /consent/approve`. The `@kya-os/consent` Lit
267
+ * component (`mcp-consent.ts` `handleApprove()`) always fetches the hardcoded
268
+ * `${serverUrl}/consent/approve` — it has no way to append a query string — so
269
+ * the sid instead travels in the POST body as `session_id` (its own field name,
270
+ * populated from the `session-id` shell attribute {@link renderAnchorConsentShell}
271
+ * sets to the anchor sid). Falls back to the query for the legacy raw-HTML
272
+ * form's `action="/consent/approve?sid=…"` target, which some external PEPs may
273
+ * still construct directly.
274
+ *
275
+ * Peeks the body via `clone()` so the ORIGINAL request stream is never consumed
276
+ * here — `readBodyFields` still performs the one real body read, downstream in
277
+ * `handleAnchorConsentApprove`. `register.ts` calls this BEFORE routing so a
278
+ * flag-off or non-anchor `/consent/approve` POST falls through to `next()` with
279
+ * its body untouched (only a clone was ever read).
99
280
  */
100
- function approveFormPage(sid, info, csrfToken) {
101
- const scopeItems = info.requiredScopes.length > 0
102
- ? info.requiredScopes
103
- .map((s) => `<li class="kya-scope-item">${escapeHtml(s)}</li>`)
104
- .join("")
105
- : `<li class="kya-scope-item">No specific permissions required.</li>`;
106
- return page("Permission Request", `<main class="kya-consent">
107
- <h1>Authorize delegation</h1>
108
- <p class="kya-permissions-header">This request needs the following permissions:</p>
109
- <ul class="kya-permissions-list">${scopeItems}</ul>
110
- <form method="POST" action="/consent/approve?sid=${encodeURIComponent(sid)}">
111
- <input type="hidden" name="sid" value="${escapeHtml(sid)}">
112
- <input type="hidden" name="csrf_token" value="${escapeHtml(csrfToken)}">
113
- <button type="submit" class="kya-consent-allow">Allow</button>
114
- </form>
115
- </main>`);
281
+ export async function resolveApproveSid(c) {
282
+ const query = c.req.query("sid");
283
+ if (isAnchorSid(query))
284
+ return query;
285
+ const raw = c.req?.raw;
286
+ if (!raw)
287
+ return undefined;
288
+ try {
289
+ const contentType = raw.headers.get("Content-Type") || "";
290
+ const clone = raw.clone();
291
+ let candidate;
292
+ if (contentType.includes("application/json")) {
293
+ const body = (await clone.json());
294
+ candidate = body.sid ?? body.session_id;
295
+ }
296
+ else {
297
+ const form = await clone.formData();
298
+ candidate = form.get("sid") ?? form.get("session_id");
299
+ }
300
+ return typeof candidate === "string" && isAnchorSid(candidate)
301
+ ? candidate
302
+ : undefined;
303
+ }
304
+ catch {
305
+ return undefined;
306
+ }
116
307
  }
117
308
  // ── CSRF (mirrors consent.service's HMAC token format, bound to the anchor sid) ──
118
309
  /** Base64url-encode bytes without padding. */
@@ -316,7 +507,13 @@ async function mintDelegationVcJwt(env, sid, info, expiresInS) {
316
507
  const signingInput = withCrossResourceClaims(unsigned, info, sid);
317
508
  const signatureBytes = await cryptoProvider.sign(new TextEncoder().encode(signingInput), signingPrivateKey);
318
509
  const signature = base64urlEncodeFromBytes(signatureBytes);
319
- return completeVCJWT(signingInput, signature);
510
+ // Return the resolved subject alongside the JWT so the notify report sends the
511
+ // SAME DID the VC carries (never an empty `agent_did`, which mismatches the VC
512
+ // and fails checkpoint's notify schema).
513
+ return {
514
+ vcJwt: completeVCJWT(signingInput, signature),
515
+ subjectDid: agentDid,
516
+ };
320
517
  }
321
518
  // ── Public handlers ──────────────────────────────────────────────────────────
322
519
  /**
@@ -335,19 +532,56 @@ export async function handleAnchorConsentGet(c, sid, env, _cfg) {
335
532
  }
336
533
  const info = (await infoResponse.json());
337
534
  const csrfToken = await mintCsrfToken(env, sid);
338
- return htmlResponse(approveFormPage(sid, info, csrfToken), 200);
535
+ const projectId = env.AGENTSHIELD_PROJECT_ID || "";
536
+ const consentConfig = await new ConsentConfigService(env).getConsentConfig(projectId);
537
+ const serverUrl = resolveServerUrl(env, c);
538
+ // When the project protects these scopes with a credential provider (merchant
539
+ // sign-in), render the branded sign-in form instead of the bare "Allow" form —
540
+ // so the shopper authenticates before authorizing and the minted delegation is
541
+ // bound to their identity. Falls back to consent-only when there is no such
542
+ // provider (resolution failed, or no checkpoint link), preserving today's
543
+ // behavior exactly.
544
+ const resolution = await resolveAnchorCredentialProvider(env, info.requiredScopes);
545
+ if (resolution.status === "credential") {
546
+ return htmlResponse(renderAnchorConsentShell({
547
+ consentConfig,
548
+ info,
549
+ sid,
550
+ csrfToken,
551
+ serverUrl,
552
+ projectId,
553
+ credential: { provider: resolution.provider },
554
+ }), 200);
555
+ }
556
+ // "none" and "unavailable" both render the consent-only form. On "unavailable"
557
+ // the approve POST re-resolves and FAILS CLOSED, so a form shown during a
558
+ // transient error can never lead to an anonymous mint for a credential project.
559
+ return htmlResponse(renderAnchorConsentShell({
560
+ consentConfig,
561
+ info,
562
+ sid,
563
+ csrfToken,
564
+ serverUrl,
565
+ projectId,
566
+ }), 200);
339
567
  }
340
568
  /**
341
569
  * Handle anchor approval for `POST /consent/approve?sid=kya-…`. Mints a VC-JWT and
342
570
  * parks it on the anchor; an expired/unknown anchor makes the approval FAIL.
343
571
  */
344
572
  export async function handleAnchorConsentApprove(c, sid, env, cfg) {
573
+ // Read the POST body EXACTLY ONCE. The CSRF token and the credential fields
574
+ // both live in it; reading it twice (a second clone after CSRF) is unreliable
575
+ // across runtimes — the second read can throw and silently yield empty
576
+ // credentials, failing every sign-in. Extract everything from this one parse.
577
+ const bodyFields = await readBodyFields(c);
345
578
  // CSRF, unless test mode relaxes it for miniflare POSTs.
346
579
  if (!isTestConsentMode(env)) {
347
- const csrfToken = await readCsrfTokenFromBody(c);
348
- const valid = await validateCsrfToken(env, sid, csrfToken);
580
+ const valid = await validateCsrfToken(env, sid, bodyFields.csrf_token);
349
581
  if (!valid) {
350
- return htmlResponse(page("Authorization failed", `<main class="kya-consent-failed"><h1>Authorization failed</h1><p>Invalid or missing security token. Please reload and try again.</p></main>`), 403);
582
+ return jsonResponse({
583
+ error: "Invalid or missing security token. Please reload and try again.",
584
+ }, 403);
351
585
  }
352
586
  }
353
587
  // Read the anchor first: if it is already gone, fail BEFORE minting anything.
@@ -355,24 +589,83 @@ export async function handleAnchorConsentApprove(c, sid, env, cfg) {
355
589
  sid,
356
590
  });
357
591
  if (infoResponse.status === 404)
358
- return notFoundPage();
592
+ return notFoundJson();
359
593
  if (infoResponse.status === 410) {
360
- return approvalFailedPage("This authorization request has expired. Nothing was authorized.");
594
+ return approvalFailedJson("This authorization request has expired. Nothing was authorized.");
361
595
  }
362
596
  if (!infoResponse.ok) {
363
- return approvalFailedPage("This authorization request could not be loaded. Please start over.", 502);
597
+ return approvalFailedJson("This authorization request could not be loaded. Please start over.", 502);
364
598
  }
365
599
  const info = (await infoResponse.json());
600
+ // Credential path: when a credential provider protects these scopes, the
601
+ // shopper must sign in before we mint. Authenticate against the provider's own
602
+ // endpoint, then resolve the checkpoint user DID — both BEFORE minting, so a
603
+ // bad password parks nothing. `null` provider → consent-only (unchanged).
604
+ const resolution = await resolveAnchorCredentialProvider(env, info.requiredScopes);
605
+ // Fail CLOSED when the sign-in requirement could not be determined (a
606
+ // checkpoint /providers error or ambiguous config). Falling through to a
607
+ // consent-only mint here would skip merchant sign-in for a credential-
608
+ // protected project on a transient error — the exact bypass we must prevent.
609
+ if (resolution.status === "unavailable") {
610
+ return approvalFailedJson("We could not verify the sign-in requirement for this request. Please try again.", 503);
611
+ }
612
+ const provider = resolution.status === "credential" ? resolution.provider : null;
613
+ let authorizedUser = null;
614
+ if (provider) {
615
+ // The @kya-os/consent Lit component always submits fixed `username` /
616
+ // `password` field names (see mcp-consent.ts `renderCredentials()`),
617
+ // regardless of the provider's own `requestBodyTemplate` placeholder names
618
+ // (e.g. `{{email}}`). Strip every meta field the shell's own
619
+ // `handleApprove()` can emit (session/routing metadata, never a credential)
620
+ // so a future provider `requestBodyTemplate` placeholder can never collide
621
+ // with it. This is NOT the same set `consent.service.ts`'s
622
+ // `handleCredentialApproval` destructures: that method also serves MCP
623
+ // inline-tool-call and OAuth-linked-clickwrap requests this anchor path
624
+ // never receives (`inline_mode`, `approved`), and has no `sid` (an
625
+ // anchor-only concept some external PEPs may still post in the body rather
626
+ // than the query). Pass everything else through as credentials;
627
+ // `credential-auth.handler.ts`'s own alias resolution
628
+ // (`resolveCredentialField`) maps `username`/`email`/`identifier`/… onto
629
+ // whatever the template actually needs.
630
+ const { sid: _sid, csrf_token: _csrfToken, tool: _tool, scopes: _scopes, agent_did: _agentDid, session_id: _sessionId, project_id: _projectId, provider: _providerField, provider_type: _providerType, auth_mode: _authMode, termsAccepted: _termsAccepted, credential_provider_type: _credentialProviderType, credential_provider: _credentialProvider, oauth_provider_type: _oauthProviderType, user_did: _userDid, credential_user_email: _credentialUserEmail, credential_provider_user_id: _credentialProviderUserId, ...credentials } = bodyFields;
631
+ const handler = createCredentialAuthHandler({
632
+ fetch: (...args) => globalThis.fetch(...args),
633
+ logger: (msg, data) => console.debug(`[kya-http] ${msg}`, data),
634
+ });
635
+ const authResult = await handler.authenticate(provider.config, credentials);
636
+ if (!authResult.success) {
637
+ return jsonResponse({
638
+ error: authResult.error ||
639
+ "Those credentials were not accepted. Please try again.",
640
+ }, 401);
641
+ }
642
+ const identity = await resolveCredentialIdentity(env, {
643
+ projectId: env.AGENTSHIELD_PROJECT_ID || "",
644
+ provider: provider.providerId,
645
+ userId: authResult.userId || "unknown",
646
+ userEmail: authResult.userEmail,
647
+ userDisplayName: authResult.userDisplayName,
648
+ });
649
+ if (!identity.success || !identity.userDid) {
650
+ return approvalFailedJson("We signed you in but could not resolve your identity. Please start over.", 500);
651
+ }
652
+ authorizedUser = {
653
+ userDid: identity.userDid,
654
+ userId: authResult.userId,
655
+ userEmail: authResult.userEmail,
656
+ };
657
+ }
366
658
  let vcJwt;
659
+ let subjectDid;
367
660
  try {
368
- vcJwt = await mintDelegationVcJwt(env, sid, info, cfg.delegationExpiresInS);
661
+ ({ vcJwt, subjectDid } = await mintDelegationVcJwt(env, sid, info, cfg.delegationExpiresInS));
369
662
  }
370
663
  catch (error) {
371
664
  // A mint failure (keygen/sign) must surface as a styled no-store error page, not
372
665
  // an unhandled throw that escapes to a bare 500 — and must park nothing (we fail
373
666
  // before the INTERNAL_PICKUP_APPROVE call below).
374
667
  console.warn(`[kya-http] delegation mint failed (sid=${sid}):`, error instanceof Error ? error.message : String(error));
375
- return approvalFailedPage("We could not complete the authorization. Please start over.", 500);
668
+ return approvalFailedJson("We could not complete the authorization. Please start over.", 500);
376
669
  }
377
670
  const approveResponse = await callAnchor(env, sid, INTERNAL_PICKUP_APPROVE, {
378
671
  sid,
@@ -382,37 +675,70 @@ export async function handleAnchorConsentApprove(c, sid, env, cfg) {
382
675
  // Consent on an EXPIRED (410) or unknown (404) anchor MUST fail and mint nothing
383
676
  // reachable — the minted JWT is never returned to the caller in that case.
384
677
  if (approveResponse.status === 410) {
385
- return approvalFailedPage("This authorization request expired before it could be completed. Nothing was authorized.");
678
+ return approvalFailedJson("This authorization request expired before it could be completed. Nothing was authorized.");
386
679
  }
387
680
  if (approveResponse.status === 404)
388
- return notFoundPage();
681
+ return notFoundJson();
389
682
  if (!approveResponse.ok) {
390
- return approvalFailedPage("We could not complete the authorization. Please start over.", 502);
683
+ return approvalFailedJson("We could not complete the authorization. Please start over.", 502);
391
684
  }
392
- return successPage();
685
+ // Report the minted delegation to checkpoint so it appears in the dashboard,
686
+ // attributed to the signed-in customer. Only the credential path has a
687
+ // `user_did` (the notify schema requires one), so a consent-only anchor
688
+ // reports nothing — there is no user to attribute it to.
689
+ if (authorizedUser && provider) {
690
+ // FIRE-AND-FORGET: dispatch the report but NEVER await it — the VC is already
691
+ // parked and the shopper's approval must not hang on a slow/hung checkpoint.
692
+ // `waitUntil` (when the runtime provides it) lets the report finish after the
693
+ // success page is returned; `notifyDelegation` swallows its own errors.
694
+ const report = notifyDelegation(env, {
695
+ sid,
696
+ agentDid: subjectDid,
697
+ userDid: authorizedUser.userDid,
698
+ userId: authorizedUser.userId,
699
+ userIdentifier: authorizedUser.userEmail,
700
+ scopes: info.requiredScopes,
701
+ provider: provider.providerId,
702
+ // Record the same expiry the VC was minted with, matching the OAuth path.
703
+ expiresAt: new Date(Date.now() + cfg.delegationExpiresInS * 1000).toISOString(),
704
+ });
705
+ const execCtx = c.executionCtx;
706
+ execCtx?.waitUntil?.(report);
707
+ }
708
+ return successJson(`urn:uuid:${sid}`);
393
709
  }
394
710
  /**
395
- * Read the `csrf_token` form field from the POST body via the underlying native
396
- * Request (`c.req.raw`). The sid travels in the query, so consuming the body here
397
- * never interferes with route-order interception. Returns undefined on parse failure.
711
+ * Read every string field from the POST body ONCE via the underlying native
712
+ * Request (`c.req.raw`), for both the CSRF token and the credential fields. Reads
713
+ * `raw` directly (no clone) because it is consumed a single time — a second read
714
+ * of the same body is unreliable across runtimes. The sid travels in the query,
715
+ * so consuming the body here never interferes with route-order interception.
716
+ * Returns an empty object on parse failure.
398
717
  */
399
- async function readCsrfTokenFromBody(c) {
718
+ async function readBodyFields(c) {
719
+ const out = {};
400
720
  const raw = c.req?.raw;
401
721
  if (!raw)
402
- return undefined;
722
+ return out;
403
723
  try {
404
724
  const contentType = raw.headers.get("Content-Type") || "";
405
725
  if (contentType.includes("application/json")) {
406
- const body = (await raw.clone().json());
407
- const token = body?.csrf_token;
408
- return typeof token === "string" ? token : undefined;
726
+ const body = (await raw.json());
727
+ for (const [key, value] of Object.entries(body)) {
728
+ if (typeof value === "string")
729
+ out[key] = value;
730
+ }
731
+ return out;
409
732
  }
410
- const form = await raw.clone().formData();
411
- const token = form.get("csrf_token");
412
- return typeof token === "string" ? token : undefined;
733
+ const form = await raw.formData();
734
+ form.forEach((value, key) => {
735
+ if (typeof value === "string")
736
+ out[key] = value;
737
+ });
738
+ return out;
413
739
  }
414
740
  catch {
415
- return undefined;
741
+ return out;
416
742
  }
417
743
  }
418
744
  //# sourceMappingURL=consent-anchor-bridge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"consent-anchor-bridge.js","sourceRoot":"","sources":["../../src/delegation-http/consent-anchor-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,kB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* Credential-backed consent for the §8.1 anchor path.
3
+ *
4
+ * The anchor consent bridge (`consent-anchor-bridge.ts`) was consent-only: it
5
+ * rendered an "Allow" form, minted an anonymous delegation, and reported
6
+ * nothing to checkpoint. When a project's tool protection requires a credential
7
+ * provider (merchant sign-in), the branded consent an agent is redirected to
8
+ * must instead authenticate the shopper and mint a delegation bound to their
9
+ * identity — the same outcome the NATIVE MCP consent (`consent.service.ts`)
10
+ * produces, reached here for the HTTP-challenge transport.
11
+ *
12
+ * This module holds the runtime-agnostic pieces that don't belong inline in the
13
+ * bridge:
14
+ * - {@link resolveCredentialIdentity} — customer → `user_did` via checkpoint's
15
+ * `/api/v1/bouncer/identity/resolve` (lifted verbatim from
16
+ * `consent.service.ts`, which needs nothing but `env`).
17
+ * - {@link notifyDelegation} — fire-and-forget report to checkpoint's
18
+ * `/api/v1/bouncer/delegations/notify` so the minted delegation appears in
19
+ * the dashboard, attributed to the signed-in customer. This call is the ONLY
20
+ * path that populates dashboard visibility, and its schema REQUIRES a
21
+ * `user_did` — which is exactly why the anchor path could never show up
22
+ * while it was consent-only.
23
+ * - {@link sidToDelegationUuid} — the anchor sid (`kya-…`) is not a UUID, but
24
+ * the notify schema demands `delegation_id` be one; this maps a sid to a
25
+ * stable UUID so repeated notifies for the same anchor stay idempotent.
26
+ *
27
+ * @module @kya-os/mcp-i-cloudflare/delegation-http/credential-consent
28
+ */
29
+ import type { CredentialProviderConfig } from "@kya-os/contracts/config";
30
+ import type { CloudflareEnv } from "../types";
31
+ /** A resolved credential provider the anchor consent should authenticate with. */
32
+ export interface ResolvedCredentialProvider {
33
+ /** The provider id (dashboard key), used for identity resolution + notify. */
34
+ providerId: string;
35
+ /** Human-readable name for the consent page heading. */
36
+ displayName: string;
37
+ /** The provider config the credential auth handler consumes. */
38
+ config: CredentialProviderConfig;
39
+ }
40
+ /**
41
+ * The result of resolving whether the anchored scopes need credential auth.
42
+ *
43
+ * `unavailable` is deliberately distinct from `none`: it means we could NOT
44
+ * determine the requirement (the checkpoint `/providers` fetch failed, or its
45
+ * answer was ambiguous/malformed). The approve handler MUST fail closed on
46
+ * `unavailable` rather than mint an anonymous delegation — otherwise a transient
47
+ * error would silently skip merchant sign-in for a credential-protected project.
48
+ */
49
+ export type AnchorCredentialResolution = {
50
+ status: "credential";
51
+ provider: ResolvedCredentialProvider;
52
+ } | {
53
+ status: "none";
54
+ } | {
55
+ status: "unavailable";
56
+ };
57
+ /**
58
+ * Resolve whether the project has a credential (merchant sign-in) provider the
59
+ * anchor consent should authenticate against, by fetching checkpoint's
60
+ * `/api/v1/bouncer/projects/{projectId}/providers` (the CRED-001 endpoint that
61
+ * returns full credential configs — authEndpoint / requestBodyTemplate /
62
+ * responseFields / successCheck — the same source the native consent uses).
63
+ *
64
+ * Returns `none` (→ consent-only) when the deployment has no checkpoint link or
65
+ * the project has no credential provider; `unavailable` (→ fail closed on mint)
66
+ * when the requirement could not be determined (fetch error / ambiguous config);
67
+ * `credential` with the provider otherwise. NEVER throws.
68
+ *
69
+ * v1 selection: prefer the project's `configuredProvider` when it is a credential
70
+ * provider; otherwise the single configured credential provider. When several
71
+ * credential providers exist with no default, resolution is `unavailable` (fail
72
+ * closed) rather than a silent anonymous mint — per-scope provider mapping is a
73
+ * documented follow-up.
74
+ */
75
+ export declare function resolveAnchorCredentialProvider(env: CloudflareEnv, _scopes: string[]): Promise<AnchorCredentialResolution>;
76
+ /** Params for {@link resolveCredentialIdentity}. */
77
+ export interface ResolveCredentialIdentityParams {
78
+ projectId: string;
79
+ /** Credential provider id (e.g. the merchant provider). */
80
+ provider: string;
81
+ /** The customer id the provider's login returned. */
82
+ userId: string;
83
+ userEmail?: string;
84
+ userDisplayName?: string;
85
+ }
86
+ /**
87
+ * Resolve a signed-in customer to a checkpoint `user_did` via
88
+ * `/api/v1/bouncer/identity/resolve`. Mirrors
89
+ * `ConsentService.resolveCredentialIdentity` — it depends only on `env`
90
+ * (`AGENTSHIELD_API_URL` + `AGENTSHIELD_API_KEY`), never session/audit state, so
91
+ * it lives here as a free function the bridge can call directly. Returns
92
+ * `{ success: false }` (never throws) on any failure so the caller fails closed.
93
+ */
94
+ export declare function resolveCredentialIdentity(env: CloudflareEnv, params: ResolveCredentialIdentityParams): Promise<{
95
+ success: boolean;
96
+ userDid?: string;
97
+ }>;
98
+ /**
99
+ * Map an anchor sid (`kya-` + 16–64 hex) to a stable RFC-4122 v4-shaped UUID.
100
+ *
101
+ * The notify schema pins `delegation_id` to a UUID, but a sid is not one. We
102
+ * derive it from the SHA-256 of the WHOLE sid so a repeated notify for the same
103
+ * anchor is idempotent (same sid → same id) while distinct sids stay distinct —
104
+ * hashing the full value avoids the collisions that truncating/repeating the raw
105
+ * hex would cause (sids longer than 32 hex would drop entropy; padded short sids
106
+ * could alias). The version nibble is forced to `4` and the variant nibble into
107
+ * the `8–b` range so the result passes strict UUID validators. This id
108
+ * identifies the dashboard row; it is intentionally NOT the VC's own
109
+ * `urn:uuid:${sid}` id.
110
+ */
111
+ export declare function sidToDelegationUuid(sid: string): string;
112
+ /** Params for {@link notifyDelegation}. */
113
+ export interface NotifyDelegationParams {
114
+ /** The anchor sid the delegation was minted for. */
115
+ sid: string;
116
+ /** Subject (agent) DID the delegation was granted to. */
117
+ agentDid: string;
118
+ /** Human-readable agent name for the dashboard, if known. */
119
+ agentName?: string;
120
+ /** REQUIRED by the notify schema: the authorizing customer's DID. */
121
+ userDid: string;
122
+ /** Provider-native customer id. */
123
+ userId?: string;
124
+ /** Human-readable customer identifier (email) for dashboard display. */
125
+ userIdentifier?: string;
126
+ /** Granted scopes (at least one). */
127
+ scopes: string[];
128
+ /** Credential provider id. */
129
+ provider: string;
130
+ /** ISO-8601 expiry, if the delegation expires. */
131
+ expiresAt?: string;
132
+ /** Extra audit metadata merged into the report. */
133
+ metadata?: Record<string, unknown>;
134
+ }
135
+ /**
136
+ * Report a minted delegation to checkpoint so it appears in the dashboard,
137
+ * attributed to the signed-in customer. Fire-and-forget and best-effort: it
138
+ * NEVER throws and never blocks the consent response — a checkpoint hiccup must
139
+ * not fail an approval the user already granted. Matches the payload the OAuth
140
+ * path sends (`oauth-handler.ts`) against checkpoint's `notifyDelegationSchema`.
141
+ *
142
+ * No-ops (returns without a request) when the deployment has no
143
+ * `AGENTSHIELD_API_KEY` or `AGENTSHIELD_PROJECT_ID` — a self-hosted anchor with
144
+ * no checkpoint link has nothing to report to.
145
+ */
146
+ export declare function notifyDelegation(env: CloudflareEnv, params: NotifyDelegationParams): Promise<void>;
147
+ //# sourceMappingURL=credential-consent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-consent.d.ts","sourceRoot":"","sources":["../../src/delegation-http/credential-consent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,kFAAkF;AAClF,MAAM,WAAW,0BAA0B;IACzC,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,MAAM,EAAE,wBAAwB,CAAC;CAClC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,0BAA0B,GAClC;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,0BAA0B,CAAA;CAAE,GAC9D;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,CAAC;AA8M9B;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,+BAA+B,CACnD,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,MAAM,EAAE,GAChB,OAAO,CAAC,0BAA0B,CAAC,CAwFrC;AAED,oDAAoD;AACpD,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,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, snake) {
4
+ const value = entry[camel] ?? entry[snake];
5
+ return typeof value === "string" ? value : undefined;
6
+ }
7
+ function readRecord(entry, camel, snake) {
8
+ const value = entry[camel] ?? entry[snake];
9
+ return value && typeof value === "object" ? value : undefined;
10
+ }
11
+ /** Whether an entry is a credential provider by its `type` discriminator. */
12
+ function isCredentialTyped(entry) {
13
+ return (!!entry &&
14
+ (entry.type === "password" || entry.type === "credential") &&
15
+ entry.configured !== false);
16
+ }
17
+ /**
18
+ * Map a raw `successCheck` to the contract shape, reading `expectedValue` in
19
+ * either casing. Returns `undefined` for an absent, empty, or incomplete object
20
+ * (missing `path` or `expectedValue`) so a half-configured check is dropped
21
+ * rather than left to reject every successful login.
22
+ */
23
+ function buildSuccessCheck(raw) {
24
+ if (!raw)
25
+ return undefined;
26
+ const path = typeof raw.path === "string" ? raw.path : undefined;
27
+ const expectedValue = raw.expectedValue ?? raw.expected_value;
28
+ if (!path || expectedValue === undefined)
29
+ return undefined;
30
+ if (typeof expectedValue !== "string" &&
31
+ typeof expectedValue !== "boolean" &&
32
+ typeof expectedValue !== "number") {
33
+ return undefined;
34
+ }
35
+ return { path, expectedValue };
36
+ }
37
+ /**
38
+ * Map a raw `consentOverrides` object to the contract shape (casing-tolerant,
39
+ * same reasoning as the rest of this file — the `/providers` source
40
+ * `consent.service.ts`'s own `mapCredentialProviderFields` reads can return
41
+ * either casing). Returns `undefined` when every override field is absent so
42
+ * an empty `{}` doesn't shadow the anchor bridge's own hardcoded defaults.
43
+ */
44
+ function buildConsentOverrides(raw) {
45
+ if (!raw)
46
+ return undefined;
47
+ const branding = readRecord(raw, "branding", "branding");
48
+ const formTitle = readString(raw, "formTitle", "form_title");
49
+ const formDescription = readString(raw, "formDescription", "form_description");
50
+ const identityFieldLabel = readString(raw, "identityFieldLabel", "identity_field_label");
51
+ const identityFieldType = readString(raw, "identityFieldType", "identity_field_type");
52
+ const passwordFieldLabel = readString(raw, "passwordFieldLabel", "password_field_label");
53
+ const submitButtonText = readString(raw, "submitButtonText", "submit_button_text");
54
+ if (!branding &&
55
+ !formTitle &&
56
+ !formDescription &&
57
+ !identityFieldLabel &&
58
+ !identityFieldType &&
59
+ !passwordFieldLabel &&
60
+ !submitButtonText) {
61
+ return undefined;
62
+ }
63
+ return {
64
+ ...(branding ? { branding } : {}),
65
+ ...(formTitle ? { formTitle } : {}),
66
+ ...(formDescription ? { formDescription } : {}),
67
+ ...(identityFieldLabel ? { identityFieldLabel } : {}),
68
+ ...(identityFieldType ? { identityFieldType } : {}),
69
+ ...(passwordFieldLabel ? { passwordFieldLabel } : {}),
70
+ ...(submitButtonText ? { submitButtonText } : {}),
71
+ };
72
+ }
73
+ /**
74
+ * Build a {@link CredentialProviderConfig} from a raw entry, reading every field
75
+ * in either casing (including the nested `responseFields`). Returns `null` when a
76
+ * required field is absent — a credential-typed entry that yields `null` must
77
+ * fail CLOSED at the call site, never fall through to an anonymous mint.
78
+ */
79
+ function buildCredentialConfig(entry) {
80
+ const authEndpoint = readString(entry, "authEndpoint", "auth_endpoint");
81
+ const requestBodyTemplate = readRecord(entry, "requestBodyTemplate", "request_body_template");
82
+ const rawResponseFields = readRecord(entry, "responseFields", "response_fields");
83
+ if (!authEndpoint || !requestBodyTemplate || !rawResponseFields)
84
+ return null;
85
+ const sessionToken = readString(rawResponseFields, "sessionToken", "session_token");
86
+ if (!sessionToken)
87
+ return null;
88
+ const responseFields = {
89
+ sessionToken,
90
+ userId: readString(rawResponseFields, "userId", "user_id"),
91
+ userEmail: readString(rawResponseFields, "userEmail", "user_email"),
92
+ userDisplayName: readString(rawResponseFields, "userDisplayName", "user_display_name"),
93
+ expiresIn: readString(rawResponseFields, "expiresIn", "expires_in"),
94
+ };
95
+ // Map the nested successCheck fields BOTH ways (`expectedValue` /
96
+ // `expected_value`) and drop an empty/incomplete object entirely — leaving a
97
+ // snake_case `expected_value` unmapped would make the auth handler read
98
+ // `expectedValue` as undefined and reject a successful login as a failed check.
99
+ const successCheck = buildSuccessCheck(readRecord(entry, "successCheck", "success_check"));
100
+ const headers = readRecord(entry, "headers", "headers");
101
+ const tokenUsage = readString(entry, "tokenUsage", "token_usage");
102
+ const tokenHeader = readString(entry, "tokenHeader", "token_header");
103
+ const cookieFormat = readString(entry, "cookieFormat", "cookie_format");
104
+ // Merchant-configured sign-in copy (identityFieldLabel / passwordFieldLabel /
105
+ // formTitle / submitButtonText / …) — the anchor consent shell reads this to
106
+ // show the merchant's own labels instead of hardcoded defaults.
107
+ const consentOverrides = buildConsentOverrides(readRecord(entry, "consentOverrides", "consent_overrides"));
108
+ return {
109
+ // The handler ignores `type`, but the contract's discriminant is "credential".
110
+ type: "credential",
111
+ displayName: readString(entry, "displayName", "display_name"),
112
+ authEndpoint,
113
+ requestBodyTemplate,
114
+ responseFields,
115
+ ...(successCheck ? { successCheck } : {}),
116
+ ...(headers ? { headers } : {}),
117
+ ...(tokenUsage ? { tokenUsage } : {}),
118
+ ...(tokenHeader ? { tokenHeader } : {}),
119
+ ...(cookieFormat ? { cookieFormat } : {}),
120
+ ...(consentOverrides ? { consentOverrides } : {}),
121
+ };
122
+ }
123
+ /**
124
+ * Resolve whether the project has a credential (merchant sign-in) provider the
125
+ * anchor consent should authenticate against, by fetching checkpoint's
126
+ * `/api/v1/bouncer/projects/{projectId}/providers` (the CRED-001 endpoint that
127
+ * returns full credential configs — authEndpoint / requestBodyTemplate /
128
+ * responseFields / successCheck — the same source the native consent uses).
129
+ *
130
+ * Returns `none` (→ consent-only) when the deployment has no checkpoint link or
131
+ * the project has no credential provider; `unavailable` (→ fail closed on mint)
132
+ * when the requirement could not be determined (fetch error / ambiguous config);
133
+ * `credential` with the provider otherwise. NEVER throws.
134
+ *
135
+ * v1 selection: prefer the project's `configuredProvider` when it is a credential
136
+ * provider; otherwise the single configured credential provider. When several
137
+ * credential providers exist with no default, resolution is `unavailable` (fail
138
+ * closed) rather than a silent anonymous mint — per-scope provider mapping is a
139
+ * documented follow-up.
140
+ */
141
+ export async function resolveAnchorCredentialProvider(env, _scopes) {
142
+ const apiKey = env.AGENTSHIELD_API_KEY;
143
+ const projectId = env.AGENTSHIELD_PROJECT_ID;
144
+ // No checkpoint link → nothing to authenticate against → legitimately
145
+ // consent-only (this is not an error condition).
146
+ if (!apiKey || !projectId)
147
+ return { status: "none" };
148
+ const agentShieldUrl = env.AGENTSHIELD_API_URL || DEFAULT_AGENTSHIELD_URL;
149
+ let providersMap;
150
+ let configuredProvider;
151
+ try {
152
+ const response = await fetch(`${agentShieldUrl}/api/v1/bouncer/projects/${encodeURIComponent(projectId)}/providers`, {
153
+ method: "GET",
154
+ headers: {
155
+ Authorization: `Bearer ${apiKey}`,
156
+ "Content-Type": "application/json",
157
+ },
158
+ });
159
+ // A non-2xx from checkpoint means we cannot confirm the auth requirement —
160
+ // fail closed rather than fall through to an anonymous mint.
161
+ if (!response.ok)
162
+ return { status: "unavailable" };
163
+ const body = (await response.json());
164
+ // A 200 with an UNEXPECTED shape (no `success`, or a missing/non-object
165
+ // `providers` map) is NOT the same as "no credential provider" — we cannot
166
+ // trust it to say the project is consent-only, so fail closed rather than
167
+ // read it as an empty map and mint anonymously.
168
+ if (body.success !== true ||
169
+ !body.data ||
170
+ typeof body.data.providers !== "object" ||
171
+ body.data.providers === null) {
172
+ return { status: "unavailable" };
173
+ }
174
+ providersMap = body.data.providers;
175
+ configuredProvider =
176
+ body.data.configuredProvider ?? body.data.configured_provider ?? null;
177
+ }
178
+ catch {
179
+ // Network/parse failure — same fail-closed reasoning as a non-2xx.
180
+ return { status: "unavailable" };
181
+ }
182
+ // Detect credential providers by their `type` discriminator (reliably present),
183
+ // NOT by whether a camelCase authEndpoint parsed — a snake_case entry must not
184
+ // silently look non-credential and drop to an anonymous mint.
185
+ const credentialIds = Object.keys(providersMap).filter((id) => isCredentialTyped(providersMap[id]));
186
+ // No credential provider configured → the project is genuinely consent-only.
187
+ if (credentialIds.length === 0)
188
+ return { status: "none" };
189
+ // Prefer the project's default provider when it is itself a credential provider;
190
+ // else fall back to the single configured credential provider.
191
+ const chosenId = configuredProvider && isCredentialTyped(providersMap[configuredProvider])
192
+ ? configuredProvider
193
+ : credentialIds.length === 1
194
+ ? credentialIds[0]
195
+ : null;
196
+ // Credential providers exist but we cannot pick one (several, no default) —
197
+ // fail closed rather than mint anonymously.
198
+ if (!chosenId)
199
+ return { status: "unavailable" };
200
+ const config = buildCredentialConfig(providersMap[chosenId]);
201
+ // A credential-TYPED provider we cannot fully parse (missing/odd-cased fields)
202
+ // must fail closed — never fall through to a consent-only anonymous mint.
203
+ if (!config)
204
+ return { status: "unavailable" };
205
+ return {
206
+ status: "credential",
207
+ provider: {
208
+ providerId: chosenId,
209
+ displayName: config.displayName || chosenId,
210
+ config,
211
+ },
212
+ };
213
+ }
214
+ /**
215
+ * Resolve a signed-in customer to a checkpoint `user_did` via
216
+ * `/api/v1/bouncer/identity/resolve`. Mirrors
217
+ * `ConsentService.resolveCredentialIdentity` — it depends only on `env`
218
+ * (`AGENTSHIELD_API_URL` + `AGENTSHIELD_API_KEY`), never session/audit state, so
219
+ * it lives here as a free function the bridge can call directly. Returns
220
+ * `{ success: false }` (never throws) on any failure so the caller fails closed.
221
+ */
222
+ export async function resolveCredentialIdentity(env, params) {
223
+ const agentShieldUrl = env.AGENTSHIELD_API_URL || DEFAULT_AGENTSHIELD_URL;
224
+ const apiKey = env.AGENTSHIELD_API_KEY;
225
+ if (!apiKey)
226
+ return { success: false };
227
+ try {
228
+ const response = await fetch(`${agentShieldUrl}/api/v1/bouncer/identity/resolve`, {
229
+ method: "POST",
230
+ headers: {
231
+ "X-API-Key": apiKey,
232
+ "Content-Type": "application/json",
233
+ },
234
+ body: JSON.stringify({
235
+ project_id: params.projectId,
236
+ credential_result: {
237
+ provider: params.provider,
238
+ user_id: params.userId,
239
+ email: params.userEmail,
240
+ name: params.userDisplayName,
241
+ },
242
+ }),
243
+ });
244
+ if (!response.ok)
245
+ return { success: false };
246
+ const data = (await response.json());
247
+ const userDid = data?.data?.user_did;
248
+ return userDid ? { success: true, userDid } : { success: false };
249
+ }
250
+ catch {
251
+ return { success: false };
252
+ }
253
+ }
254
+ /**
255
+ * Map an anchor sid (`kya-` + 16–64 hex) to a stable RFC-4122 v4-shaped UUID.
256
+ *
257
+ * The notify schema pins `delegation_id` to a UUID, but a sid is not one. We
258
+ * derive it from the SHA-256 of the WHOLE sid so a repeated notify for the same
259
+ * anchor is idempotent (same sid → same id) while distinct sids stay distinct —
260
+ * hashing the full value avoids the collisions that truncating/repeating the raw
261
+ * hex would cause (sids longer than 32 hex would drop entropy; padded short sids
262
+ * could alias). The version nibble is forced to `4` and the variant nibble into
263
+ * the `8–b` range so the result passes strict UUID validators. This id
264
+ * identifies the dashboard row; it is intentionally NOT the VC's own
265
+ * `urn:uuid:${sid}` id.
266
+ */
267
+ export function sidToDelegationUuid(sid) {
268
+ // sha256Hex is a synchronous FIPS-180-4 digest (asserted against
269
+ // crypto.subtle) — lets this stay a pure sync helper.
270
+ const h = sha256Hex(sid).slice(0, 32).split("");
271
+ h[12] = "4"; // version 4
272
+ // Variant 10xx: keep entropy from the hash nibble, forcing the top two bits.
273
+ h[16] = ((parseInt(h[16], 16) & 0x3) | 0x8).toString(16);
274
+ const s = h.join("");
275
+ return `${s.slice(0, 8)}-${s.slice(8, 12)}-${s.slice(12, 16)}-${s.slice(16, 20)}-${s.slice(20, 32)}`;
276
+ }
277
+ /**
278
+ * Report a minted delegation to checkpoint so it appears in the dashboard,
279
+ * attributed to the signed-in customer. Fire-and-forget and best-effort: it
280
+ * NEVER throws and never blocks the consent response — a checkpoint hiccup must
281
+ * not fail an approval the user already granted. Matches the payload the OAuth
282
+ * path sends (`oauth-handler.ts`) against checkpoint's `notifyDelegationSchema`.
283
+ *
284
+ * No-ops (returns without a request) when the deployment has no
285
+ * `AGENTSHIELD_API_KEY` or `AGENTSHIELD_PROJECT_ID` — a self-hosted anchor with
286
+ * no checkpoint link has nothing to report to.
287
+ */
288
+ export async function notifyDelegation(env, params) {
289
+ const apiKey = env.AGENTSHIELD_API_KEY;
290
+ const projectId = env.AGENTSHIELD_PROJECT_ID;
291
+ if (!apiKey || !projectId)
292
+ return;
293
+ const agentShieldUrl = env.AGENTSHIELD_API_URL || DEFAULT_AGENTSHIELD_URL;
294
+ try {
295
+ const response = await fetch(`${agentShieldUrl}/api/v1/bouncer/delegations/notify`, {
296
+ method: "POST",
297
+ headers: {
298
+ "X-API-Key": apiKey,
299
+ "Content-Type": "application/json",
300
+ },
301
+ body: JSON.stringify({
302
+ delegation_id: sidToDelegationUuid(params.sid),
303
+ agent_did: params.agentDid,
304
+ agent_name: params.agentName || undefined,
305
+ user_did: params.userDid,
306
+ user_id: params.userId || undefined,
307
+ user_identifier: params.userIdentifier || undefined,
308
+ scopes: params.scopes,
309
+ provider: params.provider,
310
+ project_id: projectId,
311
+ created_at: new Date().toISOString(),
312
+ expires_at: params.expiresAt || undefined,
313
+ metadata: {
314
+ source: "mcp-i-anchor-consent",
315
+ sid: params.sid,
316
+ ...params.metadata,
317
+ },
318
+ }),
319
+ });
320
+ if (!response.ok) {
321
+ console.warn(`[kya-http] delegation notify failed (non-blocking): ${response.status} sid=${params.sid}`);
322
+ }
323
+ }
324
+ catch (error) {
325
+ console.warn(`[kya-http] delegation notify failed (non-blocking): ${error instanceof Error ? error.message : String(error)} sid=${params.sid}`);
326
+ }
327
+ }
328
+ //# sourceMappingURL=credential-consent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-consent.js","sourceRoot":"","sources":["../../src/delegation-http/credential-consent.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAmCnC,SAAS,UAAU,CACjB,KAAuB,EACvB,KAAa,EACb,KAAa;IAEb,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,CA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K,EAAE,IAAI,EAAQ,MAAM,MAAM,CAAC;AAMvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAEnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAkBnE,iFAAiF;AACjF,MAAM,WAAW,uBAAuB;IACtC,8EAA8E;IAC9E,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACpE;AA2BD;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,oBAAoB,EAC7B,IAAI,CAAC,EAAE,uBAAuB,GAC7B,IAAI,CAmDN"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/delegation-http/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAQ,MAAM,MAAM,CAAC;AAMvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAEnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAmBnE,iFAAiF;AACjF,MAAM,WAAW,uBAAuB;IACtC,8EAA8E;IAC9E,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACpE;AA2BD;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,oBAAoB,EAC7B,IAAI,CAAC,EAAE,uBAAuB,GAC7B,IAAI,CAwDN"}
@@ -14,7 +14,7 @@ import { resolveHttpChallengeConfig } from "../config";
14
14
  import { PICKUP_ROUTE, CONSENT_ROUTE, ANCHOR_REGISTRATION_ROUTE, } from "./constants";
15
15
  import { isAnchorSid } from "./sid";
16
16
  import { handlePickupGet } from "./pickup-routes";
17
- import { handleAnchorConsentGet, handleAnchorConsentApprove, } from "./consent-anchor-bridge";
17
+ import { handleAnchorConsentGet, handleAnchorConsentApprove, resolveApproveSid, } from "./consent-anchor-bridge";
18
18
  import { getAnchorStub } from "./anchor-routing";
19
19
  import { handleAnchorRegistration, isAnchorRegistrationEnabled, } from "./anchor-registration";
20
20
  /**
@@ -61,13 +61,19 @@ export function registerDelegationHttpRoutes(app, options, deps) {
61
61
  return next();
62
62
  return handleAnchorConsentGet(c, sid, env, cfg);
63
63
  });
64
- // Anchor approval POST. The consent surface posts to `/consent/approve?sid=kya-…`
65
- // (sid in the query, so interception never consumes the request body).
64
+ // Anchor approval POST. The legacy raw-HTML form posted to
65
+ // `/consent/approve?sid=kya-…` (sid in the query). The `@kya-os/consent` Lit
66
+ // component instead POSTs to a hardcoded `/consent/approve` with the sid
67
+ // carried in the body as `session_id` — `resolveApproveSid` checks the query
68
+ // FIRST and only peeks a *clone* of the body when it's absent, so a flag-off
69
+ // or non-anchor request's original body stream is never consumed here.
66
70
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
71
  app.post(`${CONSENT_ROUTE}/approve`, async (c, next) => {
68
72
  const { env, cfg } = resolveRequest(c, options);
69
- const sid = c.req.query("sid");
70
- if (!cfg || !isAnchorSid(sid))
73
+ if (!cfg)
74
+ return next();
75
+ const sid = await resolveApproveSid(c);
76
+ if (!isAnchorSid(sid))
71
77
  return next();
72
78
  return handleAnchorConsentApprove(c, sid, env, cfg);
73
79
  });
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/delegation-http/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAOvD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO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CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/mcp-i-cloudflare",
3
- "version": "1.12.1",
3
+ "version": "1.12.3",
4
4
  "description": "Cloudflare Workers adapter for MCP-I framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,9 +29,9 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@kya-os/consent": "^0.1.41",
32
- "@kya-os/contracts": "^1.9.0",
32
+ "@kya-os/contracts": "^1.9.2",
33
33
  "@kya-os/mcp": "^1.10.1",
34
- "@kya-os/mcp-i-core": "^1.8.1",
34
+ "@kya-os/mcp-i-core": "^1.8.3",
35
35
  "@kya-os/mcp-i-runtime": "^1.0.0",
36
36
  "@kya-os/provider-registry": "^0.1.7",
37
37
  "@modelcontextprotocol/sdk": "^1.25.2",