@helixid/widget 0.1.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,12 +8,11 @@ Two entry points, deliberately separated:
8
8
 
9
9
  | Import | Runs | Contains |
10
10
  |---|---|---|
11
- | `@helixid/widget/server` | SP backend only | `resolveConsentScopes()` — talks to the SP's internal MCP server |
11
+ | `@helixid/widget/server` | SP backend only | `resolveConsentScopes()` — reads the agent's scopes from the HelixID API with the SP's credentials |
12
12
  | `@helixid/widget` | Browser-safe | types, `DEFAULT_DURABILITY_OPTIONS`, `createConsentController()` |
13
13
 
14
- The server module must never be bundled into the browser. The SP's MCP server
15
- is internal infrastructure; exposing tool introspection to an untrusted client
16
- would mean CORS plus a surface nobody wants public.
14
+ The server module must never be bundled into the browser: it runs with the
15
+ SP's API credentials.
17
16
 
18
17
  **Visual rendering is not shipped here.** This package provides the types and
19
18
  the selection logic; drawing the consent screen is normal frontend work owned
@@ -24,85 +23,90 @@ by the SP.
24
23
  ## Part A — `resolveConsentScopes()`
25
24
 
26
25
  ```ts
26
+ import { HelixClient } from '@helixid/sdk-js';
27
27
  import { resolveConsentScopes } from '@helixid/widget/server';
28
28
 
29
29
  const scopeOptions = await resolveConsentScopes({
30
- mcpServerUrl: process.env.HELIX_MCP_SERVER_URL, // optional
31
- curatedFallback: [
30
+ serviceDid,
31
+ agentDid,
32
+ serviceScopes: [
32
33
  { scope: 'book:flights', label: 'Book flights', description: 'Buy tickets on your behalf' },
33
34
  { scope: 'modify:booking', label: 'Modify bookings' },
34
35
  ],
36
+ client: new HelixClient({ apiUrl, apiKey }), // anything with getAgentScopes()
35
37
  });
36
38
  ```
37
39
 
38
- Output is the full union of **curated fallback ∪ MCP tool scopes ∪
40
+ Output is **the service's scopes that the agent holds as itself, plus
39
41
  `accept-terms`**.
40
42
 
41
- 1. Seed the catalog from `curatedFallback`.
42
- 2. If `mcpServerUrl` is set, call `tools/list` (plain JSON-RPC — no LLM) and
43
- insert **every** tool carrying a `metadata.requiredScope`. MCP data wins
44
- over curated data for the fields it defines.
43
+ 1. Read the agent's own scopes with `client.getAgentScopes({ serviceDid,
44
+ agentDid })`: the union of its active onboarding credentials. Credentials
45
+ delegated to the agent do not count: consent given to this agent directly
46
+ must not rest on authority another agent can withdraw.
47
+ 2. Keep each `serviceScopes` entry the agent holds, in the service's order.
45
48
  3. Always append `accept-terms` with `required: true` — T&C acceptance folds
46
49
  into grant scopes rather than living in a separate field.
47
- 4. Any resolved scope that neither source labels falls back to
48
- `humanizeScope()` (`book:flights` → `book flights`). No scope is ever
49
- rendered without a label.
50
+ 4. A scope with an empty label falls back to `humanizeScope()`
51
+ (`book:flights` → `book flights`). No scope is ever rendered without one.
50
52
 
51
- **There is no `requestedScopes` input.** The SP always advertises its own
52
- complete grantable-scope catalog. The grant's scopes and the agent's own VC
53
- scopes are independently scoped and intersected at verification time
54
- (`effectiveScopes`), never merged — so an agent narrowing this menu would be
55
- constraining a ceiling that has nothing to do with its own.
53
+ `serviceScopes` is SP-owned: a curated list, the SP's MCP server's tool
54
+ metadata, or anything else. HelixID provides the mechanism, not the scope
55
+ strings.
56
56
 
57
- `curatedFallback` is SP-owned. HelixID provides the mechanism, not the scope
58
- strings — the same division as the SP choosing its own `did:web` domain or
59
- status-list length.
57
+ Grant issuance (`POST /v1/service-delegation-grants`) refuses a scope outside
58
+ the agent's own scopes (`CONSENT_GRANT_SCOPE_NOT_ALLOWED`) and a grant of
59
+ nothing but `accept-terms` (`CONSENT_NO_GRANTABLE_SCOPES`), so the menu this
60
+ returns is exactly what issuance will accept.
60
61
 
61
- If the MCP server is unreachable or errors, the catalog falls back to
62
- `curatedFallback` alone. That narrows what the user can grant; it never
63
- widens it.
62
+ ### Errors — the consent screen fails closed
63
+
64
+ | Error | `code` | Means |
65
+ |---|---|---|
66
+ | `ConsentNoGrantableScopesError` | `CONSENT_NO_GRANTABLE_SCOPES` | The agent holds none of the service's scopes: a consent here would grant nothing. |
67
+ | `AgentScopesLookupError` | `AGENT_SCOPES_LOOKUP_FAILED` | The agent's scopes could not be read (unknown agent, no active credential, API unreachable). `cause` holds the underlying error. |
68
+
69
+ Neither falls back to the service's full catalog, which would offer scopes
70
+ issuance then refuses. The SP's route turns either into a non-200, and the
71
+ controller shows its error state.
64
72
 
65
73
  ---
66
74
 
67
75
  ## Part B — the SP's scope-resolution route (contract, not shipped code)
68
76
 
69
- HelixID does not ship this route. The SP's routing framework, auth middleware,
70
- and MCP server URL are all SP-owned. The route must satisfy:
77
+ HelixID does not ship this route. The SP's routing framework and auth
78
+ middleware are SP-owned. The route must satisfy:
71
79
 
72
80
  | | |
73
81
  |---|---|
74
82
  | Method | `GET` — pure resolution, no state mutation |
75
83
  | Path | SP's choice; passed to the widget as `scopesEndpoint` |
76
- | Query params | `agentDid` — **and only `agentDid`** |
84
+ | Query params | `agentDid` |
77
85
  | Auth | Same authenticated session context as the consent page. No separate token scheme; reuse the session middleware already protecting that page. |
78
- | Response | `{ "scopeOptions": ScopeOption[] }` |
86
+ | Response | `{ "scopeOptions": ScopeOption[] }`, or a non-200 when resolution throws |
79
87
 
80
- Reference implementation — **copy the `agentDid` comment with it**:
88
+ Reference implementation:
81
89
 
82
90
  ```ts
83
91
  // GET /api/consent/scopes?agentDid=<did>
84
92
  export async function GET(request: Request) {
85
93
  const agentDid = new URL(request.url).searchParams.get('agentDid') ?? '';
86
-
87
- // `agentDid` is retained for AUDIT CORRELATION only. It is deliberately NOT
88
- // passed into resolveConsentScopes() and must not affect the returned
89
- // catalog: the SP advertises its full scope catalog to every agent. Do not
90
- // delete this parameter as "unused" — the route contract requires it, and
91
- // the full-catalog-regardless-of-agentDid assertion depends on it staying.
92
- void agentDid;
93
-
94
- const scopeOptions = await resolveConsentScopes({
95
- mcpServerUrl: process.env.HELIX_MCP_SERVER_URL,
96
- curatedFallback: SP_SCOPE_CATALOG,
97
- });
98
-
99
- return Response.json({ scopeOptions });
94
+ try {
95
+ const scopeOptions = await resolveConsentScopes({
96
+ serviceDid: SP_DID,
97
+ agentDid,
98
+ serviceScopes: SP_SCOPE_CATALOG,
99
+ client: helixClient,
100
+ });
101
+ return Response.json({ scopeOptions });
102
+ } catch (error) {
103
+ const code = (error as { code?: string }).code ?? 'SCOPE_RESOLUTION_FAILED';
104
+ const status = code === 'CONSENT_NO_GRANTABLE_SCOPES' ? 422 : 502;
105
+ return Response.json({ error: { code, message: (error as Error).message } }, { status });
106
+ }
100
107
  }
101
108
  ```
102
109
 
103
- The audit sink this correlates into is not built yet (audit routing is
104
- parked); the parameter is retained ahead of that work, not wired to it.
105
-
106
110
  ---
107
111
 
108
112
  ## Part C — the consent controller
@@ -114,7 +118,8 @@ const controller = createConsentController({
114
118
  agentDid, agentName, userIdentifier, serviceDid,
115
119
  scopesEndpoint: '/api/consent/scopes', // or pre-resolved scopeOptions
116
120
  defaultDurability: 'standing',
117
- onAccept: async ({ scopes, durability }) => { /* POST to your grant route */ },
121
+ offerDelegationChoice: true, // optional; see below
122
+ onAccept: async ({ scopes, durability, allowDelegation }) => { /* POST to your grant route */ },
118
123
  onDecline: () => { /* close the dialog */ },
119
124
  });
120
125
 
@@ -138,6 +143,13 @@ Behavior:
138
143
  - Optional scopes start checked unless the resolver sets
139
144
  `defaultChecked: false`, so `onAccept` carries every required scope plus
140
145
  whichever optional ones were left checked.
146
+ - `offerDelegationChoice: true` adds a choice, "also allow agents this agent
147
+ delegates to". It starts unchecked and is set with
148
+ `controller.setAllowDelegation()`; `state.delegationChoiceOffered` says
149
+ whether to render it. The selection then carries `allowDelegation`, true or
150
+ false. Not offered (the default), the selection carries no
151
+ `allowDelegation`, the grant is issued without the flag, and verifiers treat
152
+ it as allowed.
141
153
 
142
154
  ### Fetch failure
143
155
 
@@ -149,7 +161,9 @@ Accept is disabled; **Decline stays available**. There is no retry.
149
161
 
150
162
  ## Downstream
151
163
 
152
- `onAccept`'s handler is the SP's own route: it calls `issueGrant()` with
153
- `selection.scopes` and `selection.durability`, persists the returned grant VC
154
- and updated status list, and returns the grant to the caller. The browser
155
- never sees the SP's private key.
164
+ `onAccept`'s handler is the SP's own route: it calls
165
+ `HelixClient.issueServiceDelegationGrant()` with `selection.scopes`,
166
+ `selection.durability` and, when present, `selection.allowDelegation`, and
167
+ returns the grant to the caller. HelixID holds
168
+ the service's key and signs on its behalf, so neither the browser nor the SP
169
+ process ever sees a private key.
@@ -13,6 +13,10 @@ export interface ConsentControllerState {
13
13
  durability: 'standing' | 'session';
14
14
  /** Always the full list — a `defaultDurability` pre-selects, it never hides. */
15
15
  durabilityOptions: DurabilityOption[];
16
+ /** Whether to render the delegation choice (`offerDelegationChoice`). */
17
+ delegationChoiceOffered: boolean;
18
+ /** The user's delegation choice; starts unchecked. */
19
+ allowDelegation: boolean;
16
20
  canAccept: boolean;
17
21
  error?: string;
18
22
  }
@@ -23,6 +27,8 @@ export interface ConsentController {
23
27
  load(): Promise<void>;
24
28
  toggleScope(scope: string): void;
25
29
  setDurability(value: 'standing' | 'session'): void;
30
+ /** No-op unless the delegation choice is offered. */
31
+ setAllowDelegation(value: boolean): void;
26
32
  accept(): Promise<void>;
27
33
  decline(): void;
28
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":"AAYA,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1D,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,yEAAyE;IACzE,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IACnC,gFAAgF;IAChF,iBAAiB,EAAE,gBAAgB,EAAE,CAA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,WAAW,iBAAiB;IAChC,QAAQ,IAAI,sBAAsB,CAAC;IACnC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACzE,iFAAiF;IACjF,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC;IACnD,qDAAqD;IACrD,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACzC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,IAAI,IAAI,CAAC;CACjB;AAgBD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,uBAAuB,GAAG,iBAAiB,CAkIzF"}
@@ -30,6 +30,7 @@ export function createConsentController(props) {
30
30
  }
31
31
  const durabilityOptions = props.durabilityOptions ?? DEFAULT_DURABILITY_OPTIONS;
32
32
  const inlineOptions = props.scopeOptions ?? [];
33
+ const delegationChoiceOffered = props.offerDelegationChoice === true;
33
34
  let state = hasInlineOptions
34
35
  ? {
35
36
  status: 'ready',
@@ -37,6 +38,8 @@ export function createConsentController(props) {
37
38
  selectedScopes: initialSelection(inlineOptions),
38
39
  durability: props.defaultDurability ?? 'standing',
39
40
  durabilityOptions,
41
+ delegationChoiceOffered,
42
+ allowDelegation: false,
40
43
  canAccept: true,
41
44
  }
42
45
  : {
@@ -45,6 +48,8 @@ export function createConsentController(props) {
45
48
  selectedScopes: [],
46
49
  durability: props.defaultDurability ?? 'standing',
47
50
  durabilityOptions,
51
+ delegationChoiceOffered,
52
+ allowDelegation: false,
48
53
  canAccept: false,
49
54
  };
50
55
  const listeners = new Set();
@@ -77,8 +82,7 @@ export function createConsentController(props) {
77
82
  if (!endpoint)
78
83
  return;
79
84
  try {
80
- // agentDid travels with the request for audit correlation only — the
81
- // route must not let it change the catalog it returns (register D4).
85
+ // The route narrows the service's scopes to those this agent holds.
82
86
  const response = await fetch(withAgentDid(endpoint, props.agentDid), {
83
87
  headers: { accept: 'application/json' },
84
88
  credentials: 'same-origin',
@@ -118,12 +122,18 @@ export function createConsentController(props) {
118
122
  setDurability(value) {
119
123
  setState({ durability: value });
120
124
  },
125
+ setAllowDelegation(value) {
126
+ if (!delegationChoiceOffered)
127
+ return;
128
+ setState({ allowDelegation: value });
129
+ },
121
130
  async accept() {
122
131
  if (!state.canAccept)
123
132
  return;
124
133
  const selection = {
125
134
  scopes: [...state.selectedScopes],
126
135
  durability: state.durability,
136
+ ...(delegationChoiceOffered ? { allowDelegation: state.allowDelegation } : {}),
127
137
  };
128
138
  await props.onAccept(selection);
129
139
  },
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EACL,0BAA0B,GAK3B,MAAM,YAAY,CAAC;AAgCpB,SAAS,gBAAgB,CAAC,YAA2B;IACnD,0EAA0E;IAC1E,2EAA2E;IAC3E,0EAA0E;IAC1E,OAAO,YAAY;SAChB,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAC,cAAc,KAAK,KAAK,CAAC;SAC/E,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,YAAY,CAAC,QAAgB,EAAE,QAAgB;IACtD,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,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AC/E,CAAC;YACF,MAAM,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC;QAED,OAAO;YACL,0DAA0D;YAC1D,KAAK,CAAC,SAAS,EAAE,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,3 +1,3 @@
1
- export { ACCEPT_TERMS_SCOPE, humanizeScope, resolveConsentScopes, type ResolveConsentScopesOptions, } from './resolve-scopes.js';
1
+ export { ACCEPT_TERMS_SCOPE, AgentScopesLookupError, ConsentNoGrantableScopesError, humanizeScope, resolveConsentScopes, type AgentScopesSource, type ResolveConsentScopesOptions, } from './resolve-scopes.js';
2
2
  export type { CuratedScopeEntry, ScopeOption } from '../types.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,KAAK,2BAA2B,GACjC,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,6BAA6B,EAC7B,aAAa,EACb,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,GACjC,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
@@ -6,5 +6,5 @@
6
6
  // Server-only entry point. Imported by the SP's own backend route (see the
7
7
  // Part B contract in this package's README) — never bundled into the browser,
8
8
  // because it talks to the SP's internal MCP server.
9
- export { ACCEPT_TERMS_SCOPE, humanizeScope, resolveConsentScopes, } from './resolve-scopes.js';
9
+ export { ACCEPT_TERMS_SCOPE, AgentScopesLookupError, ConsentNoGrantableScopesError, humanizeScope, resolveConsentScopes, } from './resolve-scopes.js';
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,gDAAgD;AAEhD,2EAA2E;AAC3E,8EAA8E;AAC9E,oDAAoD;AACpD,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,oBAAoB,GAErB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,gDAAgD;AAEhD,2EAA2E;AAC3E,8EAA8E;AAC9E,oDAAoD;AACpD,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,6BAA6B,EAC7B,aAAa,EACb,oBAAoB,GAGrB,MAAM,qBAAqB,CAAC"}
@@ -6,9 +6,48 @@ export type { CuratedScopeEntry, ScopeOption } from '../types.js';
6
6
  * listed in any SP's curated catalog (register D8).
7
7
  */
8
8
  export declare const ACCEPT_TERMS_SCOPE = "accept-terms";
9
+ /**
10
+ * Where the agent's own scopes come from. `HelixClient` from
11
+ * `@helixid/sdk-js` satisfies this as is.
12
+ */
13
+ export interface AgentScopesSource {
14
+ getAgentScopes(input: {
15
+ serviceDid: string;
16
+ agentDid: string;
17
+ }): Promise<{
18
+ scopes: string[];
19
+ }>;
20
+ }
9
21
  export interface ResolveConsentScopesOptions {
10
- mcpServerUrl?: string;
11
- curatedFallback: CuratedScopeEntry[];
22
+ /** The service whose consent screen this is; the grant's issuer. */
23
+ serviceDid: string;
24
+ /** The agent asking for consent. */
25
+ agentDid: string;
26
+ /**
27
+ * Every scope this service can grant. How the SP builds it (a curated
28
+ * list, its MCP server's tool metadata, anything else) is up to the SP.
29
+ */
30
+ serviceScopes: CuratedScopeEntry[];
31
+ client: AgentScopesSource;
32
+ }
33
+ /**
34
+ * The agent and the service share no scope, so a consent here would grant
35
+ * nothing. Distinct from {@link AgentScopesLookupError}: the lookup worked.
36
+ */
37
+ export declare class ConsentNoGrantableScopesError extends Error {
38
+ readonly code = "CONSENT_NO_GRANTABLE_SCOPES";
39
+ constructor(agentDid: string, serviceDid: string);
40
+ }
41
+ /**
42
+ * The agent's scopes could not be read (unknown agent, no active credential,
43
+ * API unreachable). The consent screen fails closed rather than falling back
44
+ * to the service's full catalog, which would offer scopes grant issuance
45
+ * then refuses.
46
+ */
47
+ export declare class AgentScopesLookupError extends Error {
48
+ readonly cause: unknown;
49
+ readonly code = "AGENT_SCOPES_LOOKUP_FAILED";
50
+ constructor(agentDid: string, cause: unknown);
12
51
  }
13
52
  /**
14
53
  * `book:flights` -> `book flights`. Last-resort label so no scope is ever
@@ -16,22 +55,16 @@ export interface ResolveConsentScopesOptions {
16
55
  */
17
56
  export declare function humanizeScope(scope: string): string;
18
57
  /**
19
- * Resolves the SP's grantable-scope catalog for the consent screen.
20
- *
21
- * Output is the full union of curated fallback ∪ MCP tool scopes ∪
22
- * `accept-terms`. There is deliberately no `requestedScopes` input: the SP
23
- * always advertises its own complete catalog, because the grant's scopes and
24
- * the agent's own VC scopes are independently scoped and intersected at
25
- * verification time (`effectiveScopes`), not merged. An agent narrowing this
26
- * menu would be constraining a ceiling that has nothing to do with its own.
27
- * (Epic 5 Part E, superseding this function's original contract.)
58
+ * Resolves what the consent screen may offer: the service's scopes that the
59
+ * agent also holds as itself, plus `accept-terms`. Grant issuance enforces
60
+ * the same bound, so nothing offered here is refused at submit.
28
61
  *
29
- * Note on `agentDid`: the SP route that wraps this function takes an
30
- * `agentDid` query param, but it is deliberately NOT threaded in here and
31
- * must not influence the returned catalog — see the route contract in this
32
- * package's README and register D4.
62
+ * Throws {@link AgentScopesLookupError} when the agent's scopes cannot be
63
+ * read and {@link ConsentNoGrantableScopesError} when the two sets share
64
+ * nothing; the SP's scopes route turns either into a non-200, which the
65
+ * widget shows as its error state.
33
66
  *
34
- * Pure `options -> ScopeOption[]`: no persistence, no auth, no grant signing.
67
+ * No persistence, no auth, no grant signing.
35
68
  */
36
69
  export declare function resolveConsentScopes(opts: ResolveConsentScopesOptions): Promise<ScopeOption[]>;
37
70
  //# sourceMappingURL=resolve-scopes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-scopes.d.ts","sourceRoot":"","sources":["../../src/server/resolve-scopes.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD,MAAM,WAAW,2BAA2B;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,iBAAiB,EAAE,CAAC;CACtC;AAkBD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKnD;AAiBD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,WAAW,EAAE,CAAC,CAkExB"}
1
+ {"version":3,"file":"resolve-scopes.d.ts","sourceRoot":"","sources":["../../src/server/resolve-scopes.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CAChG;AAED,MAAM,WAAW,2BAA2B;IAC1C,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,EAAE,iBAAiB,EAAE,CAAC;IACnC,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED;;;GAGG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,QAAQ,CAAC,IAAI,iCAAiC;gBAClC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAIjD;AAED;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAEjB,QAAQ,CAAC,KAAK,EAAE,OAAO;IADrD,QAAQ,CAAC,IAAI,gCAAgC;gBACjC,QAAQ,EAAE,MAAM,EAAW,KAAK,EAAE,OAAO;CAMtD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKnD;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,WAAW,EAAE,CAAC,CAuCxB"}
@@ -15,6 +15,32 @@
15
15
  * listed in any SP's curated catalog (register D8).
16
16
  */
17
17
  export const ACCEPT_TERMS_SCOPE = 'accept-terms';
18
+ /**
19
+ * The agent and the service share no scope, so a consent here would grant
20
+ * nothing. Distinct from {@link AgentScopesLookupError}: the lookup worked.
21
+ */
22
+ export class ConsentNoGrantableScopesError extends Error {
23
+ code = 'CONSENT_NO_GRANTABLE_SCOPES';
24
+ constructor(agentDid, serviceDid) {
25
+ super(`Agent ${agentDid} holds none of the scopes ${serviceDid} can grant`);
26
+ this.name = 'ConsentNoGrantableScopesError';
27
+ }
28
+ }
29
+ /**
30
+ * The agent's scopes could not be read (unknown agent, no active credential,
31
+ * API unreachable). The consent screen fails closed rather than falling back
32
+ * to the service's full catalog, which would offer scopes grant issuance
33
+ * then refuses.
34
+ */
35
+ export class AgentScopesLookupError extends Error {
36
+ cause;
37
+ code = 'AGENT_SCOPES_LOOKUP_FAILED';
38
+ constructor(agentDid, cause) {
39
+ super(`Could not read the scopes of agent ${agentDid}: ${cause instanceof Error ? cause.message : String(cause)}`);
40
+ this.cause = cause;
41
+ this.name = 'AgentScopesLookupError';
42
+ }
43
+ }
18
44
  /**
19
45
  * `book:flights` -> `book flights`. Last-resort label so no scope is ever
20
46
  * rendered without one.
@@ -25,97 +51,55 @@ export function humanizeScope(scope) {
25
51
  .replace(/\s+/g, ' ')
26
52
  .trim();
27
53
  }
28
- async function fetchMcpToolScopes(mcpServerUrl) {
29
- // Plain JSON-RPC metadata read — no LLM involved, no MCP SDK dependency.
30
- const response = await fetch(mcpServerUrl, {
31
- method: 'POST',
32
- headers: { 'content-type': 'application/json', accept: 'application/json' },
33
- body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/list' }),
34
- });
35
- if (!response.ok) {
36
- throw new Error(`MCP tools/list responded ${response.status}`);
37
- }
38
- const body = (await response.json());
39
- const tools = body?.result?.tools;
40
- return Array.isArray(tools) ? tools : [];
41
- }
42
54
  /**
43
- * Resolves the SP's grantable-scope catalog for the consent screen.
44
- *
45
- * Output is the full union of curated fallback ∪ MCP tool scopes ∪
46
- * `accept-terms`. There is deliberately no `requestedScopes` input: the SP
47
- * always advertises its own complete catalog, because the grant's scopes and
48
- * the agent's own VC scopes are independently scoped and intersected at
49
- * verification time (`effectiveScopes`), not merged. An agent narrowing this
50
- * menu would be constraining a ceiling that has nothing to do with its own.
51
- * (Epic 5 Part E, superseding this function's original contract.)
55
+ * Resolves what the consent screen may offer: the service's scopes that the
56
+ * agent also holds as itself, plus `accept-terms`. Grant issuance enforces
57
+ * the same bound, so nothing offered here is refused at submit.
52
58
  *
53
- * Note on `agentDid`: the SP route that wraps this function takes an
54
- * `agentDid` query param, but it is deliberately NOT threaded in here and
55
- * must not influence the returned catalog — see the route contract in this
56
- * package's README and register D4.
59
+ * Throws {@link AgentScopesLookupError} when the agent's scopes cannot be
60
+ * read and {@link ConsentNoGrantableScopesError} when the two sets share
61
+ * nothing; the SP's scopes route turns either into a non-200, which the
62
+ * widget shows as its error state.
57
63
  *
58
- * Pure `options -> ScopeOption[]`: no persistence, no auth, no grant signing.
64
+ * No persistence, no auth, no grant signing.
59
65
  */
60
66
  export async function resolveConsentScopes(opts) {
61
- // 1. Seed from the SP's curated catalog.
67
+ let agentScopes;
68
+ try {
69
+ const { scopes } = await opts.client.getAgentScopes({
70
+ serviceDid: opts.serviceDid,
71
+ agentDid: opts.agentDid,
72
+ });
73
+ agentScopes = new Set(scopes);
74
+ }
75
+ catch (error) {
76
+ throw new AgentScopesLookupError(opts.agentDid, error);
77
+ }
78
+ // The service's scopes, in its order, narrowed to what the agent holds.
62
79
  const resolved = new Map();
63
- for (const entry of opts.curatedFallback) {
80
+ for (const entry of opts.serviceScopes) {
81
+ if (entry.scope === ACCEPT_TERMS_SCOPE || !agentScopes.has(entry.scope))
82
+ continue;
64
83
  resolved.set(entry.scope, {
65
84
  scope: entry.scope,
66
- label: entry.label,
85
+ // Never leave a resolved scope without a label.
86
+ label: entry.label !== '' ? entry.label : humanizeScope(entry.scope),
67
87
  ...(entry.description !== undefined ? { description: entry.description } : {}),
68
88
  ...(entry.required !== undefined ? { required: entry.required } : {}),
69
89
  });
70
90
  }
71
- // 2. Overlay MCP tool metadata. Every tool carrying a requiredScope
72
- // contributes — there is no requested set to filter against. MCP data
73
- // wins over curated data for the fields it actually defines.
74
- if (opts.mcpServerUrl) {
75
- let tools = [];
76
- try {
77
- tools = await fetchMcpToolScopes(opts.mcpServerUrl);
78
- }
79
- catch {
80
- // MCP is the enrichment source, curated is the fallback — consolidated
81
- // log §4.3: "read from SP's MCP role/scope metadata if exposed, else
82
- // fall back to a manually curated list." An unreachable MCP server
83
- // yields a curated-only catalog rather than failing the consent page.
84
- // This narrows what the user can grant; it never widens it.
85
- tools = [];
86
- }
87
- for (const tool of tools) {
88
- const scope = tool.metadata?.requiredScope;
89
- if (!scope)
90
- continue;
91
- const existing = resolved.get(scope);
92
- const label = tool.metadata?.label ?? existing?.label;
93
- const description = tool.metadata?.description ?? tool.description ?? existing?.description;
94
- const required = existing?.required;
95
- resolved.set(scope, {
96
- scope,
97
- // Step 5 applies here: an MCP-derived scope whose tool metadata
98
- // carries no label falls back to humanizeScope() below.
99
- label: label ?? '',
100
- ...(description !== undefined ? { description } : {}),
101
- ...(required !== undefined ? { required } : {}),
102
- });
103
- }
91
+ if (resolved.size === 0) {
92
+ throw new ConsentNoGrantableScopesError(opts.agentDid, opts.serviceDid);
104
93
  }
105
- // 3. (Removed by Epic 5 Part E — there is no filtering pass. The output is
106
- // the full catalog, not a subset of anything the agent asked for.)
107
- // 5. Never leave a resolved scope without a label.
108
- const scopeOptions = [...resolved.values()].map((option) => ({
109
- ...option,
110
- label: option.label !== '' ? option.label : humanizeScope(option.scope),
111
- }));
112
- // 4. Always append the T&C entry, required and pre-checked.
113
- scopeOptions.push({
114
- scope: ACCEPT_TERMS_SCOPE,
115
- label: 'Accept the terms and conditions',
116
- required: true,
117
- defaultChecked: true,
118
- });
119
- return scopeOptions;
94
+ // Always append the T&C entry, required and pre-checked.
95
+ return [
96
+ ...resolved.values(),
97
+ {
98
+ scope: ACCEPT_TERMS_SCOPE,
99
+ label: 'Accept the terms and conditions',
100
+ required: true,
101
+ defaultChecked: true,
102
+ },
103
+ ];
120
104
  }
121
105
  //# sourceMappingURL=resolve-scopes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-scopes.js","sourceRoot":"","sources":["../../src/server/resolve-scopes.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E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
@@ -35,6 +35,12 @@ export interface HelixConsentWidgetProps {
35
35
  serviceDid: string;
36
36
  scopeOptions?: ScopeOption[];
37
37
  scopesEndpoint?: string;
38
+ /**
39
+ * Show the "also allow agents this agent delegates to" choice. Off by
40
+ * default; when off, the selection carries no `allowDelegation` and the
41
+ * grant is left without the flag, which verifiers treat as allowed.
42
+ */
43
+ offerDelegationChoice?: boolean;
38
44
  durabilityOptions?: DurabilityOption[];
39
45
  defaultDurability?: 'standing' | 'session';
40
46
  onAccept: (selection: ConsentSelection) => Promise<void> | void;
@@ -43,6 +49,11 @@ export interface HelixConsentWidgetProps {
43
49
  export interface ConsentSelection {
44
50
  scopes: string[];
45
51
  durability: 'standing' | 'session';
52
+ /**
53
+ * Present only when the delegation choice was offered: pass it to grant
54
+ * issuance as `allowDelegation`.
55
+ */
56
+ allowDelegation?: boolean;
46
57
  }
47
58
  export declare const DEFAULT_DURABILITY_OPTIONS: DurabilityOption[];
48
59
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAYA;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED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}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAwEjC,MAAM,CAAC,MAAM,0BAA0B,GAAuB;IAC5D,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,uCAAuC,EAAE;IACrE,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,uBAAuB,EAAE;CACrD,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@helixid/widget",
3
- "version": "0.1.0",
4
- "description": "HelixID consent widget \u2014 SP-side scope resolution and a headless consent-selection controller for issuing DelegationGrantCredentials.",
3
+ "version": "0.3.1",
4
+ "description": "HelixID consent widget — SP-side scope resolution and a headless consent-selection controller for issuing DelegationGrantCredentials.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "author": "DgVerse <hello@dgverse.in>",
8
- "homepage": "https://www.dgverse.in/products/helix-id",
8
+ "homepage": "https://helixid.dev/",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "https://github.com/helixid/helix-sdk-js",
@@ -35,19 +35,17 @@
35
35
  "default": "./dist/server/index.js"
36
36
  }
37
37
  },
38
+ "devDependencies": {
39
+ "@types/node": "^20.0.0",
40
+ "typescript": "^5.4.0",
41
+ "vitest": "^4.1.8"
42
+ },
38
43
  "scripts": {
39
44
  "build": "tsc --project tsconfig.json",
40
- "prepare": "npm run build",
41
- "prepublishOnly": "pnpm build",
42
45
  "test": "vitest run --passWithNoTests",
43
46
  "test:non-live": "vitest run --passWithNoTests",
44
47
  "test:unit": "vitest run tests --passWithNoTests",
45
48
  "lint": "eslint src tests",
46
49
  "typecheck": "tsc --noEmit"
47
- },
48
- "devDependencies": {
49
- "@types/node": "^20.0.0",
50
- "typescript": "^5.4.0",
51
- "vitest": "^4.1.8"
52
50
  }
53
- }
51
+ }