@helixid/widget 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +155 -0
- package/dist/controller.d.ts +30 -0
- package/dist/controller.d.ts.map +1 -0
- package/dist/controller.js +136 -0
- package/dist/controller.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +10 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/resolve-scopes.d.ts +37 -0
- package/dist/server/resolve-scopes.d.ts.map +1 -0
- package/dist/server/resolve-scopes.js +121 -0
- package/dist/server/resolve-scopes.js.map +1 -0
- package/dist/types.d.ts +48 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing
|
|
141
|
+
the origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 DgVerse LLP
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# `@helixid/widget`
|
|
2
|
+
|
|
3
|
+
Consent-screen building blocks for a Service Provider issuing
|
|
4
|
+
`DelegationGrantCredential`s: an SP-side scope resolver and a headless
|
|
5
|
+
consent-selection controller.
|
|
6
|
+
|
|
7
|
+
Two entry points, deliberately separated:
|
|
8
|
+
|
|
9
|
+
| Import | Runs | Contains |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `@helixid/widget/server` | SP backend only | `resolveConsentScopes()` — talks to the SP's internal MCP server |
|
|
12
|
+
| `@helixid/widget` | Browser-safe | types, `DEFAULT_DURABILITY_OPTIONS`, `createConsentController()` |
|
|
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.
|
|
17
|
+
|
|
18
|
+
**Visual rendering is not shipped here.** This package provides the types and
|
|
19
|
+
the selection logic; drawing the consent screen is normal frontend work owned
|
|
20
|
+
by the SP.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Part A — `resolveConsentScopes()`
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { resolveConsentScopes } from '@helixid/widget/server';
|
|
28
|
+
|
|
29
|
+
const scopeOptions = await resolveConsentScopes({
|
|
30
|
+
mcpServerUrl: process.env.HELIX_MCP_SERVER_URL, // optional
|
|
31
|
+
curatedFallback: [
|
|
32
|
+
{ scope: 'book:flights', label: 'Book flights', description: 'Buy tickets on your behalf' },
|
|
33
|
+
{ scope: 'modify:booking', label: 'Modify bookings' },
|
|
34
|
+
],
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Output is the full union of **curated fallback ∪ MCP tool scopes ∪
|
|
39
|
+
`accept-terms`**.
|
|
40
|
+
|
|
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.
|
|
45
|
+
3. Always append `accept-terms` with `required: true` — T&C acceptance folds
|
|
46
|
+
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
|
+
|
|
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.
|
|
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.
|
|
60
|
+
|
|
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.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Part B — the SP's scope-resolution route (contract, not shipped code)
|
|
68
|
+
|
|
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:
|
|
71
|
+
|
|
72
|
+
| | |
|
|
73
|
+
|---|---|
|
|
74
|
+
| Method | `GET` — pure resolution, no state mutation |
|
|
75
|
+
| Path | SP's choice; passed to the widget as `scopesEndpoint` |
|
|
76
|
+
| Query params | `agentDid` — **and only `agentDid`** |
|
|
77
|
+
| 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[] }` |
|
|
79
|
+
|
|
80
|
+
Reference implementation — **copy the `agentDid` comment with it**:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
// GET /api/consent/scopes?agentDid=<did>
|
|
84
|
+
export async function GET(request: Request) {
|
|
85
|
+
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 });
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
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
|
+
---
|
|
107
|
+
|
|
108
|
+
## Part C — the consent controller
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { createConsentController, DEFAULT_DURABILITY_OPTIONS } from '@helixid/widget';
|
|
112
|
+
|
|
113
|
+
const controller = createConsentController({
|
|
114
|
+
agentDid, agentName, userIdentifier, serviceDid,
|
|
115
|
+
scopesEndpoint: '/api/consent/scopes', // or pre-resolved scopeOptions
|
|
116
|
+
defaultDurability: 'standing',
|
|
117
|
+
onAccept: async ({ scopes, durability }) => { /* POST to your grant route */ },
|
|
118
|
+
onDecline: () => { /* close the dialog */ },
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
await controller.load(); // mount
|
|
122
|
+
controller.subscribe((state) => render(state));
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Behavior:
|
|
126
|
+
|
|
127
|
+
- Provide **one** of `scopeOptions` (pre-resolved, SSR path) or
|
|
128
|
+
`scopesEndpoint` (fetched at mount). If both are given, `scopeOptions` wins
|
|
129
|
+
and no fetch occurs. If neither is given, the factory throws — that is a
|
|
130
|
+
caller integration error, not a state to render around.
|
|
131
|
+
- `userIdentifier` must be the same form (DID or email) the grant captures at
|
|
132
|
+
consent time, or VP verification's user-match fails later.
|
|
133
|
+
- Durability is an explicit control: `defaultDurability` pre-selects one
|
|
134
|
+
option, it never hides the other. `state.durabilityOptions` always holds the
|
|
135
|
+
full list.
|
|
136
|
+
- `required: true` scopes (i.e. `accept-terms`) cannot be unchecked and appear
|
|
137
|
+
in every `onAccept` payload. Decline is the way not to proceed.
|
|
138
|
+
- Optional scopes start checked unless the resolver sets
|
|
139
|
+
`defaultChecked: false`, so `onAccept` carries every required scope plus
|
|
140
|
+
whichever optional ones were left checked.
|
|
141
|
+
|
|
142
|
+
### Fetch failure
|
|
143
|
+
|
|
144
|
+
If the `scopesEndpoint` request fails — non-200, malformed JSON, or network
|
|
145
|
+
failure — the controller enters `status: 'error'` with `canAccept: false`.
|
|
146
|
+
Accept is disabled; **Decline stays available**. There is no retry.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Downstream
|
|
151
|
+
|
|
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.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type DurabilityOption, type HelixConsentWidgetProps, type ScopeOption } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* `error` is the D3 state: the `scopesEndpoint` fetch failed (non-200,
|
|
4
|
+
* malformed JSON, or network failure). Accept is disabled, Decline stays
|
|
5
|
+
* available, and there is no retry.
|
|
6
|
+
*/
|
|
7
|
+
export type ConsentStatus = 'loading' | 'ready' | 'error';
|
|
8
|
+
export interface ConsentControllerState {
|
|
9
|
+
status: ConsentStatus;
|
|
10
|
+
scopeOptions: ScopeOption[];
|
|
11
|
+
/** Scopes currently checked, always including every `required` scope. */
|
|
12
|
+
selectedScopes: string[];
|
|
13
|
+
durability: 'standing' | 'session';
|
|
14
|
+
/** Always the full list — a `defaultDurability` pre-selects, it never hides. */
|
|
15
|
+
durabilityOptions: DurabilityOption[];
|
|
16
|
+
canAccept: boolean;
|
|
17
|
+
error?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ConsentController {
|
|
20
|
+
getState(): ConsentControllerState;
|
|
21
|
+
subscribe(listener: (state: ConsentControllerState) => void): () => void;
|
|
22
|
+
/** Mount hook: resolves scopes from `scopesEndpoint` when that is the source. */
|
|
23
|
+
load(): Promise<void>;
|
|
24
|
+
toggleScope(scope: string): void;
|
|
25
|
+
setDurability(value: 'standing' | 'session'): void;
|
|
26
|
+
accept(): Promise<void>;
|
|
27
|
+
decline(): void;
|
|
28
|
+
}
|
|
29
|
+
export declare function createConsentController(props: HelixConsentWidgetProps): ConsentController;
|
|
30
|
+
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -0,0 +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,CAAC;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,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,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,IAAI,IAAI,CAAC;CACjB;AAgBD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,uBAAuB,GAAG,iBAAiB,CAwHzF"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// Copyright 2026 DgVerse LLP
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
//
|
|
7
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
// See the License for the specific language governing permissions and
|
|
11
|
+
// limitations under the License.
|
|
12
|
+
import { DEFAULT_DURABILITY_OPTIONS, } from './types.js';
|
|
13
|
+
function initialSelection(scopeOptions) {
|
|
14
|
+
// Required scopes are always in. Optional scopes start checked unless the
|
|
15
|
+
// resolver explicitly opted them out, so that Part C's "whichever optional
|
|
16
|
+
// ones were left checked at submit time" describes an unchecking gesture.
|
|
17
|
+
return scopeOptions
|
|
18
|
+
.filter((option) => option.required === true || option.defaultChecked !== false)
|
|
19
|
+
.map((option) => option.scope);
|
|
20
|
+
}
|
|
21
|
+
function withAgentDid(endpoint, agentDid) {
|
|
22
|
+
const separator = endpoint.includes('?') ? '&' : '?';
|
|
23
|
+
return `${endpoint}${separator}agentDid=${encodeURIComponent(agentDid)}`;
|
|
24
|
+
}
|
|
25
|
+
export function createConsentController(props) {
|
|
26
|
+
const hasInlineOptions = Array.isArray(props.scopeOptions);
|
|
27
|
+
if (!hasInlineOptions && !props.scopesEndpoint) {
|
|
28
|
+
// Caller integration error, not a state to render around.
|
|
29
|
+
throw new Error('HelixConsentWidget requires either scopeOptions or scopesEndpoint. Neither was provided.');
|
|
30
|
+
}
|
|
31
|
+
const durabilityOptions = props.durabilityOptions ?? DEFAULT_DURABILITY_OPTIONS;
|
|
32
|
+
const inlineOptions = props.scopeOptions ?? [];
|
|
33
|
+
let state = hasInlineOptions
|
|
34
|
+
? {
|
|
35
|
+
status: 'ready',
|
|
36
|
+
scopeOptions: inlineOptions,
|
|
37
|
+
selectedScopes: initialSelection(inlineOptions),
|
|
38
|
+
durability: props.defaultDurability ?? 'standing',
|
|
39
|
+
durabilityOptions,
|
|
40
|
+
canAccept: true,
|
|
41
|
+
}
|
|
42
|
+
: {
|
|
43
|
+
status: 'loading',
|
|
44
|
+
scopeOptions: [],
|
|
45
|
+
selectedScopes: [],
|
|
46
|
+
durability: props.defaultDurability ?? 'standing',
|
|
47
|
+
durabilityOptions,
|
|
48
|
+
canAccept: false,
|
|
49
|
+
};
|
|
50
|
+
const listeners = new Set();
|
|
51
|
+
const setState = (patch) => {
|
|
52
|
+
state = { ...state, ...patch };
|
|
53
|
+
for (const listener of listeners)
|
|
54
|
+
listener(state);
|
|
55
|
+
};
|
|
56
|
+
const failClosed = (message) => {
|
|
57
|
+
setState({
|
|
58
|
+
status: 'error',
|
|
59
|
+
scopeOptions: [],
|
|
60
|
+
selectedScopes: [],
|
|
61
|
+
canAccept: false,
|
|
62
|
+
error: message,
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
getState: () => state,
|
|
67
|
+
subscribe(listener) {
|
|
68
|
+
listeners.add(listener);
|
|
69
|
+
return () => listeners.delete(listener);
|
|
70
|
+
},
|
|
71
|
+
async load() {
|
|
72
|
+
// scopeOptions wins outright: scopesEndpoint is treated as unused and
|
|
73
|
+
// no fetch is issued.
|
|
74
|
+
if (hasInlineOptions)
|
|
75
|
+
return;
|
|
76
|
+
const endpoint = props.scopesEndpoint;
|
|
77
|
+
if (!endpoint)
|
|
78
|
+
return;
|
|
79
|
+
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).
|
|
82
|
+
const response = await fetch(withAgentDid(endpoint, props.agentDid), {
|
|
83
|
+
headers: { accept: 'application/json' },
|
|
84
|
+
credentials: 'same-origin',
|
|
85
|
+
});
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
failClosed(`Scope resolution failed with HTTP ${response.status}`);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const body = (await response.json());
|
|
91
|
+
if (!Array.isArray(body?.scopeOptions)) {
|
|
92
|
+
failClosed('Scope resolution returned an unexpected response shape');
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const scopeOptions = body.scopeOptions;
|
|
96
|
+
setState({
|
|
97
|
+
status: 'ready',
|
|
98
|
+
scopeOptions,
|
|
99
|
+
selectedScopes: initialSelection(scopeOptions),
|
|
100
|
+
canAccept: true,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
// Network failure or malformed JSON. No retry (register D3).
|
|
105
|
+
failClosed(error instanceof Error ? error.message : 'Scope resolution failed');
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
toggleScope(scope) {
|
|
109
|
+
const option = state.scopeOptions.find((entry) => entry.scope === scope);
|
|
110
|
+
// Required scopes cannot be unchecked; Decline is the way not to proceed.
|
|
111
|
+
if (!option || option.required === true)
|
|
112
|
+
return;
|
|
113
|
+
const selected = state.selectedScopes.includes(scope)
|
|
114
|
+
? state.selectedScopes.filter((entry) => entry !== scope)
|
|
115
|
+
: [...state.selectedScopes, scope];
|
|
116
|
+
setState({ selectedScopes: selected });
|
|
117
|
+
},
|
|
118
|
+
setDurability(value) {
|
|
119
|
+
setState({ durability: value });
|
|
120
|
+
},
|
|
121
|
+
async accept() {
|
|
122
|
+
if (!state.canAccept)
|
|
123
|
+
return;
|
|
124
|
+
const selection = {
|
|
125
|
+
scopes: [...state.selectedScopes],
|
|
126
|
+
durability: state.durability,
|
|
127
|
+
};
|
|
128
|
+
await props.onAccept(selection);
|
|
129
|
+
},
|
|
130
|
+
decline() {
|
|
131
|
+
// Available in every state, including the D3 error state.
|
|
132
|
+
props.onDecline();
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=controller.js.map
|
|
@@ -0,0 +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,GAAG,CAAC;IACrD,OAAO,GAAG,QAAQ,GAAG,SAAS,YAAY,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC3E,CAAC;AA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B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { DEFAULT_DURABILITY_OPTIONS, type ConsentSelection, type CuratedScopeEntry, type DurabilityOption, type HelixConsentWidgetProps, type ScopeOption, } from './types.js';
|
|
2
|
+
export { createConsentController, type ConsentController, type ConsentControllerState, type ConsentStatus, } from './controller.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,0BAA0B,EAC1B,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,GACnB,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2026 DgVerse LLP
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
// Browser-safe entry point: types and the headless consent controller.
|
|
7
|
+
// Server-side scope resolution lives behind `@helixid/widget/server` so the
|
|
8
|
+
// MCP-facing code is never bundled into the browser.
|
|
9
|
+
export { DEFAULT_DURABILITY_OPTIONS, } from './types.js';
|
|
10
|
+
export { createConsentController, } from './controller.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,gDAAgD;AAEhD,uEAAuE;AACvE,4EAA4E;AAC5E,qDAAqD;AACrD,OAAO,EACL,0BAA0B,GAM3B,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,uBAAuB,GAIxB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright 2026 DgVerse LLP
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
// Server-only entry point. Imported by the SP's own backend route (see the
|
|
7
|
+
// Part B contract in this package's README) — never bundled into the browser,
|
|
8
|
+
// because it talks to the SP's internal MCP server.
|
|
9
|
+
export { ACCEPT_TERMS_SCOPE, humanizeScope, resolveConsentScopes, } from './resolve-scopes.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CuratedScopeEntry, ScopeOption } from '../types.js';
|
|
2
|
+
export type { CuratedScopeEntry, ScopeOption } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The T&C scope. Folded into grant scopes rather than carried as a separate
|
|
5
|
+
* field (consolidated log §4.4), and appended by this resolver rather than
|
|
6
|
+
* listed in any SP's curated catalog (register D8).
|
|
7
|
+
*/
|
|
8
|
+
export declare const ACCEPT_TERMS_SCOPE = "accept-terms";
|
|
9
|
+
export interface ResolveConsentScopesOptions {
|
|
10
|
+
mcpServerUrl?: string;
|
|
11
|
+
curatedFallback: CuratedScopeEntry[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `book:flights` -> `book flights`. Last-resort label so no scope is ever
|
|
15
|
+
* rendered without one.
|
|
16
|
+
*/
|
|
17
|
+
export declare function humanizeScope(scope: string): string;
|
|
18
|
+
/**
|
|
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.)
|
|
28
|
+
*
|
|
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.
|
|
33
|
+
*
|
|
34
|
+
* Pure `options -> ScopeOption[]`: no persistence, no auth, no grant signing.
|
|
35
|
+
*/
|
|
36
|
+
export declare function resolveConsentScopes(opts: ResolveConsentScopesOptions): Promise<ScopeOption[]>;
|
|
37
|
+
//# sourceMappingURL=resolve-scopes.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// Copyright 2026 DgVerse LLP
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
//
|
|
7
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
// See the License for the specific language governing permissions and
|
|
11
|
+
// limitations under the License.
|
|
12
|
+
/**
|
|
13
|
+
* The T&C scope. Folded into grant scopes rather than carried as a separate
|
|
14
|
+
* field (consolidated log §4.4), and appended by this resolver rather than
|
|
15
|
+
* listed in any SP's curated catalog (register D8).
|
|
16
|
+
*/
|
|
17
|
+
export const ACCEPT_TERMS_SCOPE = 'accept-terms';
|
|
18
|
+
/**
|
|
19
|
+
* `book:flights` -> `book flights`. Last-resort label so no scope is ever
|
|
20
|
+
* rendered without one.
|
|
21
|
+
*/
|
|
22
|
+
export function humanizeScope(scope) {
|
|
23
|
+
return scope
|
|
24
|
+
.replace(/[:_-]+/g, ' ')
|
|
25
|
+
.replace(/\s+/g, ' ')
|
|
26
|
+
.trim();
|
|
27
|
+
}
|
|
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
|
+
/**
|
|
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.)
|
|
52
|
+
*
|
|
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.
|
|
57
|
+
*
|
|
58
|
+
* Pure `options -> ScopeOption[]`: no persistence, no auth, no grant signing.
|
|
59
|
+
*/
|
|
60
|
+
export async function resolveConsentScopes(opts) {
|
|
61
|
+
// 1. Seed from the SP's curated catalog.
|
|
62
|
+
const resolved = new Map();
|
|
63
|
+
for (const entry of opts.curatedFallback) {
|
|
64
|
+
resolved.set(entry.scope, {
|
|
65
|
+
scope: entry.scope,
|
|
66
|
+
label: entry.label,
|
|
67
|
+
...(entry.description !== undefined ? { description: entry.description } : {}),
|
|
68
|
+
...(entry.required !== undefined ? { required: entry.required } : {}),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
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
|
+
}
|
|
104
|
+
}
|
|
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;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=resolve-scopes.js.map
|
|
@@ -0,0 +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,sEAAsE;AACtE,iCAAiC;AAMjC;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAuBjD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,KAAK;SACT,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;AACZ,CAAC;AAED,KAAK,UAAU,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CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAChD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,2EAA2E;IAC3E,sEAAsE;IAEtE,mDAAmD;IACnD,MAAM,YAAY,GAAkB,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC1E,GAAG,MAAM;QACT,KAAK,EAAE,MAAM,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;KACxE,CAAC,CAAC,CAAC;IAEJ,4DAA4D;IAC5D,YAAY,CAAC,IAAI,CAAC;QAChB,KAAK,EAAE,kBAAkB;QACzB,KAAK,EAAE,iCAAiC;QACxC,QAAQ,EAAE,IAAI;QACd,cAAc,EAAE,IAAI;KACrB,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One selectable permission on the consent screen.
|
|
3
|
+
*
|
|
4
|
+
* Produced by `resolveConsentScopes()` (see `@helixid/widget/server`) and
|
|
5
|
+
* consumed by the widget either pre-resolved (`scopeOptions`) or fetched at
|
|
6
|
+
* mount (`scopesEndpoint`).
|
|
7
|
+
*/
|
|
8
|
+
export interface ScopeOption {
|
|
9
|
+
scope: string;
|
|
10
|
+
label: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
defaultChecked?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* An SP-owned catalog entry. The SP supplies these — HelixID never invents
|
|
17
|
+
* scope strings (register D8).
|
|
18
|
+
*/
|
|
19
|
+
export interface CuratedScopeEntry {
|
|
20
|
+
scope: string;
|
|
21
|
+
label: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface DurabilityOption {
|
|
26
|
+
value: 'standing' | 'session';
|
|
27
|
+
label: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface HelixConsentWidgetProps {
|
|
31
|
+
agentDid: string;
|
|
32
|
+
agentName: string;
|
|
33
|
+
agentAvatarUrl?: string;
|
|
34
|
+
userIdentifier: string;
|
|
35
|
+
serviceDid: string;
|
|
36
|
+
scopeOptions?: ScopeOption[];
|
|
37
|
+
scopesEndpoint?: string;
|
|
38
|
+
durabilityOptions?: DurabilityOption[];
|
|
39
|
+
defaultDurability?: 'standing' | 'session';
|
|
40
|
+
onAccept: (selection: ConsentSelection) => Promise<void> | void;
|
|
41
|
+
onDecline: () => void;
|
|
42
|
+
}
|
|
43
|
+
export interface ConsentSelection {
|
|
44
|
+
scopes: string[];
|
|
45
|
+
durability: 'standing' | 'session';
|
|
46
|
+
}
|
|
47
|
+
export declare const DEFAULT_DURABILITY_OPTIONS: DurabilityOption[];
|
|
48
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IAGvB,UAAU,EAAE,MAAM,CAAC;IAGnB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;IAGxB,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACvC,iBAAiB,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAE3C,QAAQ,EAAE,CAAC,SAAS,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAChE,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;CACpC;AAED,eAAO,MAAM,0BAA0B,EAAE,gBAAgB,EAGxD,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 2026 DgVerse LLP
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
//
|
|
7
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
// See the License for the specific language governing permissions and
|
|
11
|
+
// limitations under the License.
|
|
12
|
+
export const DEFAULT_DURABILITY_OPTIONS = [
|
|
13
|
+
{ value: 'standing', label: 'Keep this connected until I revoke it' },
|
|
14
|
+
{ value: 'session', label: 'Only for this session' },
|
|
15
|
+
];
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;AA4DjC,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
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
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.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": "DgVerse <hello@dgverse.in>",
|
|
8
|
+
"homepage": "https://www.dgverse.in/products/helix-id",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/helixid/helix-sdk-js",
|
|
12
|
+
"directory": "widget"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist/",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"require": "./dist/index.js",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./server": {
|
|
32
|
+
"types": "./dist/server/index.d.ts",
|
|
33
|
+
"import": "./dist/server/index.js",
|
|
34
|
+
"require": "./dist/server/index.js",
|
|
35
|
+
"default": "./dist/server/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc --project tsconfig.json",
|
|
40
|
+
"prepare": "npm run build",
|
|
41
|
+
"prepublishOnly": "pnpm build",
|
|
42
|
+
"test": "vitest run --passWithNoTests",
|
|
43
|
+
"test:non-live": "vitest run --passWithNoTests",
|
|
44
|
+
"test:unit": "vitest run tests --passWithNoTests",
|
|
45
|
+
"lint": "eslint src tests",
|
|
46
|
+
"typecheck": "tsc --noEmit"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^20.0.0",
|
|
50
|
+
"typescript": "^5.4.0",
|
|
51
|
+
"vitest": "^4.1.8"
|
|
52
|
+
}
|
|
53
|
+
}
|