@sphereon/ssi-sdk.siopv2-oid4vp-op-auth 0.32.1-next.54 → 0.33.1-feature.jose.vcdm.55

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.
Files changed (86) hide show
  1. package/dist/index.cjs +2451 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +559 -0
  4. package/dist/index.d.ts +555 -8
  5. package/dist/index.js +2420 -31
  6. package/dist/index.js.map +1 -1
  7. package/package.json +44 -30
  8. package/src/agent/DidAuthSiopOpAuthenticator.ts +132 -53
  9. package/src/services/Siopv2MachineService.ts +130 -20
  10. package/src/session/OID4VP.ts +8 -8
  11. package/src/session/OpSession.ts +18 -17
  12. package/src/types/IDidAuthSiopOpAuthenticator.ts +20 -7
  13. package/src/types/siop-service/index.ts +9 -6
  14. package/src/utils/CredentialUtils.ts +71 -0
  15. package/src/utils/dcql.ts +36 -0
  16. package/dist/agent/DidAuthSiopOpAuthenticator.d.ts +0 -31
  17. package/dist/agent/DidAuthSiopOpAuthenticator.d.ts.map +0 -1
  18. package/dist/agent/DidAuthSiopOpAuthenticator.js +0 -323
  19. package/dist/agent/DidAuthSiopOpAuthenticator.js.map +0 -1
  20. package/dist/index.d.ts.map +0 -1
  21. package/dist/link-handler/index.d.ts +0 -22
  22. package/dist/link-handler/index.d.ts.map +0 -1
  23. package/dist/link-handler/index.js +0 -57
  24. package/dist/link-handler/index.js.map +0 -1
  25. package/dist/localization/Localization.d.ts +0 -9
  26. package/dist/localization/Localization.d.ts.map +0 -1
  27. package/dist/localization/Localization.js +0 -46
  28. package/dist/localization/Localization.js.map +0 -1
  29. package/dist/localization/translations/en.json +0 -9
  30. package/dist/localization/translations/nl.json +0 -8
  31. package/dist/machine/CallbackStateListener.d.ts +0 -3
  32. package/dist/machine/CallbackStateListener.d.ts.map +0 -1
  33. package/dist/machine/CallbackStateListener.js +0 -48
  34. package/dist/machine/CallbackStateListener.js.map +0 -1
  35. package/dist/machine/Siopv2Machine.d.ts +0 -8
  36. package/dist/machine/Siopv2Machine.d.ts.map +0 -1
  37. package/dist/machine/Siopv2Machine.js +0 -364
  38. package/dist/machine/Siopv2Machine.js.map +0 -1
  39. package/dist/services/IdentifierService.d.ts +0 -3
  40. package/dist/services/IdentifierService.d.ts.map +0 -1
  41. package/dist/services/IdentifierService.js +0 -28
  42. package/dist/services/IdentifierService.js.map +0 -1
  43. package/dist/services/Siopv2MachineService.d.ts +0 -16
  44. package/dist/services/Siopv2MachineService.d.ts.map +0 -1
  45. package/dist/services/Siopv2MachineService.js +0 -201
  46. package/dist/services/Siopv2MachineService.js.map +0 -1
  47. package/dist/session/OID4VP.d.ts +0 -72
  48. package/dist/session/OID4VP.d.ts.map +0 -1
  49. package/dist/session/OID4VP.js +0 -223
  50. package/dist/session/OID4VP.js.map +0 -1
  51. package/dist/session/OpSession.d.ts +0 -39
  52. package/dist/session/OpSession.d.ts.map +0 -1
  53. package/dist/session/OpSession.js +0 -365
  54. package/dist/session/OpSession.js.map +0 -1
  55. package/dist/session/functions.d.ts +0 -37
  56. package/dist/session/functions.d.ts.map +0 -1
  57. package/dist/session/functions.js +0 -163
  58. package/dist/session/functions.js.map +0 -1
  59. package/dist/session/index.d.ts +0 -4
  60. package/dist/session/index.d.ts.map +0 -1
  61. package/dist/session/index.js +0 -20
  62. package/dist/session/index.js.map +0 -1
  63. package/dist/types/IDidAuthSiopOpAuthenticator.d.ts +0 -116
  64. package/dist/types/IDidAuthSiopOpAuthenticator.d.ts.map +0 -1
  65. package/dist/types/IDidAuthSiopOpAuthenticator.js +0 -10
  66. package/dist/types/IDidAuthSiopOpAuthenticator.js.map +0 -1
  67. package/dist/types/error/index.d.ts +0 -8
  68. package/dist/types/error/index.d.ts.map +0 -1
  69. package/dist/types/error/index.js +0 -3
  70. package/dist/types/error/index.js.map +0 -1
  71. package/dist/types/identifier/index.d.ts +0 -53
  72. package/dist/types/identifier/index.d.ts.map +0 -1
  73. package/dist/types/identifier/index.js +0 -5
  74. package/dist/types/identifier/index.js.map +0 -1
  75. package/dist/types/index.d.ts +0 -6
  76. package/dist/types/index.d.ts.map +0 -1
  77. package/dist/types/index.js +0 -22
  78. package/dist/types/index.js.map +0 -1
  79. package/dist/types/machine/index.d.ts +0 -124
  80. package/dist/types/machine/index.d.ts.map +0 -1
  81. package/dist/types/machine/index.js +0 -57
  82. package/dist/types/machine/index.js.map +0 -1
  83. package/dist/types/siop-service/index.d.ts +0 -78
  84. package/dist/types/siop-service/index.d.ts.map +0 -1
  85. package/dist/types/siop-service/index.js +0 -14
  86. package/dist/types/siop-service/index.js.map +0 -1
@@ -1,364 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Siopv2Machine = exports.logger = void 0;
4
- const xstate_1 = require("xstate");
5
- const Localization_1 = require("../localization/Localization");
6
- const types_1 = require("../types");
7
- const types_2 = require("../types");
8
- const ssi_types_1 = require("@sphereon/ssi-types");
9
- exports.logger = ssi_types_1.Loggers.DEFAULT.get(types_2.LOGGER_NAMESPACE);
10
- const Siopv2HasNoContactGuard = (_ctx, _event) => {
11
- const { contact } = _ctx;
12
- return contact === undefined;
13
- };
14
- const Siopv2HasContactGuard = (_ctx, _event) => {
15
- const { contact } = _ctx;
16
- return contact !== undefined;
17
- };
18
- const Siopv2HasAuthorizationRequestGuard = (_ctx, _event) => {
19
- const { authorizationRequestData } = _ctx;
20
- return authorizationRequestData !== undefined;
21
- };
22
- const Siopv2HasSelectableCredentialsAndContactGuard = (_ctx, _event) => {
23
- const { authorizationRequestData, contact } = _ctx;
24
- if (!authorizationRequestData) {
25
- throw new Error('Missing authorization request data in context');
26
- }
27
- if (!contact) {
28
- throw new Error('Missing contact request data in context');
29
- }
30
- return authorizationRequestData.presentationDefinitions !== undefined;
31
- };
32
- const Siopv2CreateContactGuard = (_ctx, _event) => {
33
- const { contactAlias, hasContactConsent } = _ctx;
34
- return hasContactConsent && contactAlias !== undefined && contactAlias.length > 0;
35
- };
36
- const Siopv2HasSelectedRequiredCredentialsGuard = (_ctx, _event) => {
37
- const { authorizationRequestData } = _ctx;
38
- if (authorizationRequestData === undefined) {
39
- throw new Error('Missing authorization request data in context');
40
- }
41
- if (authorizationRequestData.presentationDefinitions === undefined || authorizationRequestData.presentationDefinitions.length === 0) {
42
- throw Error('No presentation definitions present');
43
- }
44
- // FIXME: Return _ctx.selectedCredentials.length > 0 for now, given this is a really expensive operation and will be called in the next phase anyway
45
- return _ctx.selectedCredentials.length > 0;
46
- /*const definitionWithLocation: PresentationDefinitionWithLocation = authorizationRequestData.presentationDefinitions[0];
47
- const pex: PEX = new PEX();
48
- const evaluationResults: EvaluationResults = pex.evaluateCredentials(definitionWithLocation.definition, selectedCredentials);
49
-
50
- return evaluationResults.areRequiredCredentialsPresent === Status.INFO;*/
51
- };
52
- const Siopv2IsSiopOnlyGuard = (_ctx, _event) => {
53
- const { authorizationRequestData } = _ctx;
54
- if (authorizationRequestData === undefined) {
55
- throw new Error('Missing authorization request data in context');
56
- }
57
- return authorizationRequestData.presentationDefinitions === undefined;
58
- };
59
- const Siopv2IsSiopWithOID4VPGuard = (_ctx, _event) => {
60
- const { authorizationRequestData, selectableCredentialsMap } = _ctx;
61
- if (!authorizationRequestData) {
62
- throw new Error('Missing authorization request data in context');
63
- }
64
- if (!selectableCredentialsMap) {
65
- throw new Error('Missing selectableCredentialsMap in context');
66
- }
67
- return authorizationRequestData.presentationDefinitions !== undefined;
68
- };
69
- const createSiopv2Machine = (opts) => {
70
- var _a;
71
- const { url, idOpts } = opts;
72
- const initialContext = {
73
- url: new URL(url).toString(),
74
- hasContactConsent: true,
75
- contactAlias: '',
76
- selectedCredentials: [],
77
- idOpts: idOpts,
78
- };
79
- return (0, xstate_1.createMachine)({
80
- id: (_a = opts === null || opts === void 0 ? void 0 : opts.machineId) !== null && _a !== void 0 ? _a : 'Siopv2',
81
- predictableActionArguments: true,
82
- initial: types_1.Siopv2MachineStates.createConfig,
83
- schema: {
84
- events: {},
85
- guards: {},
86
- services: {},
87
- },
88
- context: initialContext,
89
- states: {
90
- [types_1.Siopv2MachineStates.createConfig]: {
91
- id: types_1.Siopv2MachineStates.createConfig,
92
- invoke: {
93
- src: types_1.Siopv2MachineServices.createConfig,
94
- onDone: {
95
- target: types_1.Siopv2MachineStates.getSiopRequest,
96
- actions: (0, xstate_1.assign)({
97
- didAuthConfig: (_ctx, _event) => _event.data,
98
- }),
99
- },
100
- onError: {
101
- target: types_1.Siopv2MachineStates.handleError,
102
- actions: (0, xstate_1.assign)({
103
- error: (_ctx, _event) => ({
104
- title: (0, Localization_1.translate)('siopv2_machine_create_config_error_title'),
105
- message: _event.data.message,
106
- stack: _event.data.stack,
107
- }),
108
- }),
109
- },
110
- },
111
- },
112
- [types_1.Siopv2MachineStates.getSiopRequest]: {
113
- id: types_1.Siopv2MachineStates.getSiopRequest,
114
- invoke: {
115
- src: types_1.Siopv2MachineServices.getSiopRequest,
116
- onDone: {
117
- target: types_1.Siopv2MachineStates.retrieveContact,
118
- actions: (0, xstate_1.assign)({
119
- authorizationRequestData: (_ctx, _event) => _event.data,
120
- }),
121
- },
122
- onError: {
123
- target: types_1.Siopv2MachineStates.handleError,
124
- actions: (0, xstate_1.assign)({
125
- error: (_ctx, _event) => ({
126
- title: (0, Localization_1.translate)('siopv2_machine_get_request_error_title'),
127
- message: _event.data.message,
128
- stack: _event.data.stack,
129
- }),
130
- }),
131
- },
132
- },
133
- },
134
- [types_1.Siopv2MachineStates.retrieveContact]: {
135
- id: types_1.Siopv2MachineStates.retrieveContact,
136
- invoke: {
137
- src: types_1.Siopv2MachineServices.retrieveContact,
138
- onDone: {
139
- target: types_1.Siopv2MachineStates.transitionFromSetup,
140
- actions: (0, xstate_1.assign)({ contact: (_ctx, _event) => _event.data }),
141
- },
142
- onError: {
143
- target: types_1.Siopv2MachineStates.handleError,
144
- actions: (0, xstate_1.assign)({
145
- error: (_ctx, _event) => ({
146
- title: (0, Localization_1.translate)('siopv2_machine_retrieve_contact_error_title'),
147
- message: _event.data.message,
148
- stack: _event.data.stack,
149
- }),
150
- }),
151
- },
152
- },
153
- },
154
- [types_1.Siopv2MachineStates.transitionFromSetup]: {
155
- id: types_1.Siopv2MachineStates.transitionFromSetup,
156
- always: [
157
- {
158
- target: types_1.Siopv2MachineStates.addContact,
159
- cond: types_1.Siopv2MachineGuards.hasNoContactGuard,
160
- },
161
- {
162
- target: types_1.Siopv2MachineStates.sendResponse,
163
- cond: types_1.Siopv2MachineGuards.siopOnlyGuard,
164
- },
165
- {
166
- target: types_1.Siopv2MachineStates.getSelectableCredentials,
167
- cond: types_1.Siopv2MachineGuards.hasSelectableCredentialsAndContactGuard,
168
- },
169
- {
170
- target: types_1.Siopv2MachineStates.selectCredentials,
171
- cond: types_1.Siopv2MachineGuards.siopWithOID4VPGuard,
172
- },
173
- ],
174
- },
175
- [types_1.Siopv2MachineStates.addContact]: {
176
- id: types_1.Siopv2MachineStates.addContact,
177
- initial: types_1.Siopv2MachineAddContactStates.idle,
178
- on: {
179
- [types_1.Siopv2MachineEvents.SET_CONTACT_CONSENT]: {
180
- actions: (0, xstate_1.assign)({ hasContactConsent: (_ctx, _event) => _event.data }),
181
- },
182
- [types_1.Siopv2MachineEvents.SET_CONTACT_ALIAS]: {
183
- actions: (0, xstate_1.assign)({ contactAlias: (_ctx, _event) => _event.data }),
184
- },
185
- [types_1.Siopv2MachineEvents.CREATE_CONTACT]: {
186
- target: `.${types_1.Siopv2MachineAddContactStates.next}`,
187
- actions: (0, xstate_1.assign)({ contact: (_ctx, _event) => _event.data }),
188
- cond: types_1.Siopv2MachineGuards.createContactGuard,
189
- },
190
- [types_1.Siopv2MachineEvents.DECLINE]: {
191
- target: types_1.Siopv2MachineStates.declined,
192
- },
193
- [types_1.Siopv2MachineEvents.PREVIOUS]: {
194
- target: types_1.Siopv2MachineStates.aborted,
195
- },
196
- },
197
- states: {
198
- [types_1.Siopv2MachineAddContactStates.idle]: {},
199
- [types_1.Siopv2MachineAddContactStates.next]: {
200
- always: {
201
- target: `#${types_1.Siopv2MachineStates.transitionFromSetup}`,
202
- cond: types_1.Siopv2MachineGuards.hasContactGuard,
203
- },
204
- },
205
- },
206
- },
207
- [types_1.Siopv2MachineStates.addContactIdentity]: {
208
- id: types_1.Siopv2MachineStates.addContactIdentity,
209
- invoke: {
210
- src: types_1.Siopv2MachineServices.addContactIdentity,
211
- onDone: [
212
- {
213
- target: types_1.Siopv2MachineStates.getSelectableCredentials,
214
- actions: (_ctx, _event) => {
215
- var _a;
216
- (_a = _ctx.contact) === null || _a === void 0 ? void 0 : _a.identities.push(_event.data);
217
- },
218
- cond: types_1.Siopv2MachineGuards.hasSelectableCredentialsAndContactGuard,
219
- },
220
- {
221
- target: types_1.Siopv2MachineStates.sendResponse,
222
- actions: (_ctx, _event) => {
223
- var _a;
224
- (_a = _ctx.contact) === null || _a === void 0 ? void 0 : _a.identities.push(_event.data);
225
- },
226
- cond: types_1.Siopv2MachineGuards.siopOnlyGuard,
227
- },
228
- ],
229
- onError: {
230
- target: types_1.Siopv2MachineStates.handleError,
231
- actions: (0, xstate_1.assign)({
232
- error: (_ctx, _event) => ({
233
- title: (0, Localization_1.translate)('siopv2_machine_add_contact_identity_error_title'),
234
- message: _event.data.message,
235
- stack: _event.data.stack,
236
- }),
237
- }),
238
- },
239
- },
240
- },
241
- [types_1.Siopv2MachineStates.getSelectableCredentials]: {
242
- id: types_1.Siopv2MachineStates.getSelectableCredentials,
243
- invoke: {
244
- src: types_1.Siopv2MachineServices.getSelectableCredentials,
245
- onDone: {
246
- target: types_1.Siopv2MachineStates.selectCredentials,
247
- actions: (0, xstate_1.assign)({
248
- selectableCredentialsMap: (_ctx, _event) => _event.data,
249
- }),
250
- },
251
- onError: {
252
- target: types_1.Siopv2MachineStates.handleError,
253
- actions: (0, xstate_1.assign)({
254
- error: (_ctx, _event) => ({
255
- title: (0, Localization_1.translate)('siopv2_machine_get_selectable_credentials_error_title'),
256
- message: _event.data.message,
257
- stack: _event.data.stack,
258
- }),
259
- }),
260
- },
261
- },
262
- },
263
- [types_1.Siopv2MachineStates.selectCredentials]: {
264
- id: types_1.Siopv2MachineStates.selectCredentials,
265
- on: {
266
- [types_1.Siopv2MachineEvents.SET_SELECTED_CREDENTIALS]: {
267
- actions: (0, xstate_1.assign)({ selectedCredentials: (_ctx, _event) => _event.data }),
268
- },
269
- [types_1.Siopv2MachineEvents.NEXT]: {
270
- target: types_1.Siopv2MachineStates.sendResponse,
271
- cond: types_1.Siopv2MachineGuards.hasSelectedRequiredCredentialsGuard,
272
- },
273
- [types_1.Siopv2MachineEvents.DECLINE]: {
274
- target: types_1.Siopv2MachineStates.declined,
275
- },
276
- [types_1.Siopv2MachineEvents.PREVIOUS]: {
277
- target: types_1.Siopv2MachineStates.aborted,
278
- },
279
- },
280
- },
281
- [types_1.Siopv2MachineStates.sendResponse]: {
282
- id: types_1.Siopv2MachineStates.sendResponse,
283
- invoke: {
284
- src: types_1.Siopv2MachineServices.sendResponse,
285
- onDone: {
286
- target: types_1.Siopv2MachineStates.done,
287
- actions: (0, xstate_1.assign)({
288
- authorizationResponseData: (_ctx, _event) => _event.data,
289
- }),
290
- },
291
- onError: {
292
- target: types_1.Siopv2MachineStates.handleError,
293
- actions: (0, xstate_1.assign)({
294
- error: (_ctx, _event) => ({
295
- title: (0, Localization_1.translate)('siopv2_machine_send_response_error_title'),
296
- message: _event.data.message,
297
- stack: _event.data.stack,
298
- }),
299
- }),
300
- },
301
- },
302
- },
303
- [types_1.Siopv2MachineStates.handleError]: {
304
- id: types_1.Siopv2MachineStates.handleError,
305
- on: {
306
- [types_1.Siopv2MachineEvents.NEXT]: {
307
- target: types_1.Siopv2MachineStates.error,
308
- },
309
- [types_1.Siopv2MachineEvents.PREVIOUS]: {
310
- target: types_1.Siopv2MachineStates.error,
311
- },
312
- },
313
- },
314
- [types_1.Siopv2MachineStates.aborted]: {
315
- id: types_1.Siopv2MachineStates.aborted,
316
- type: 'final',
317
- },
318
- [types_1.Siopv2MachineStates.declined]: {
319
- id: types_1.Siopv2MachineStates.declined,
320
- type: 'final',
321
- },
322
- [types_1.Siopv2MachineStates.error]: {
323
- id: types_1.Siopv2MachineStates.error,
324
- type: 'final',
325
- },
326
- [types_1.Siopv2MachineStates.done]: {
327
- id: types_1.Siopv2MachineStates.done,
328
- type: 'final',
329
- },
330
- },
331
- });
332
- };
333
- class Siopv2Machine {
334
- static newInstance(opts) {
335
- exports.logger.info('New Siopv2Machine instance');
336
- const interpreter = (0, xstate_1.interpret)(createSiopv2Machine(opts).withConfig({
337
- services: Object.assign({}, opts === null || opts === void 0 ? void 0 : opts.services),
338
- guards: Object.assign({ Siopv2HasNoContactGuard,
339
- Siopv2HasContactGuard,
340
- Siopv2HasAuthorizationRequestGuard,
341
- Siopv2HasSelectableCredentialsAndContactGuard,
342
- Siopv2HasSelectedRequiredCredentialsGuard,
343
- Siopv2IsSiopOnlyGuard,
344
- Siopv2IsSiopWithOID4VPGuard,
345
- Siopv2CreateContactGuard }, opts === null || opts === void 0 ? void 0 : opts.guards),
346
- }));
347
- if (typeof (opts === null || opts === void 0 ? void 0 : opts.subscription) === 'function') {
348
- interpreter.onTransition(opts.subscription);
349
- }
350
- if ((opts === null || opts === void 0 ? void 0 : opts.requireCustomNavigationHook) !== true) {
351
- interpreter.onTransition((snapshot) => {
352
- if (opts.stateNavigationListener !== undefined) {
353
- void opts.stateNavigationListener(interpreter, snapshot);
354
- }
355
- });
356
- }
357
- interpreter.onTransition((snapshot) => {
358
- exports.logger.info('onTransition to new state', snapshot.value);
359
- });
360
- return { interpreter };
361
- }
362
- }
363
- exports.Siopv2Machine = Siopv2Machine;
364
- //# sourceMappingURL=Siopv2Machine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Siopv2Machine.js","sourceRoot":"","sources":["../../src/machine/Siopv2Machine.ts"],"names":[],"mappings":";;;AAEA,mCAA0E;AAC1E,+DAAwD;AAExD,oCAiBiB;AACjB,oCAAsI;AACtI,mDAA6C;AAEhC,QA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qBAAqB;gBACrB,kCAAkC;gBAClC,6CAA6C;gBAC7C,yCAAyC;gBACzC,qBAAqB;gBACrB,2BAA2B;gBAC3B,wBAAwB,IACrB,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAChB;SACF,CAAC,CACH,CAAA;QAED,IAAI,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,CAAA,KAAK,UAAU,EAAE,CAAC;YAC7C,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QAC7C,CAAC;QAED,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,2BAA2B,MAAK,IAAI,EAAE,CAAC;YAC/C,WAAW,CAAC,YAAY,CAAC,CAAC,QAA4B,EAAQ,EAAE;gBAC9D,IAAI,IAAI,CAAC,uBAAuB,KAAK,SAAS,EAAE,CAAC;oBAC/C,KAAK,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;gBAC1D,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,WAAW,CAAC,YAAY,CAAC,CAAC,QAA4B,EAAQ,EAAE;YAC9D,cAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC1D,CAAC,CAAC,CAAA;QAEF,OAAO,EAAE,WAAW,EAAE,CAAA;IACxB,CAAC;CACF;AAvCD,sCAuCC"}
@@ -1,3 +0,0 @@
1
- import { GetIdentifierArgs, IdentifierWithKey } from '../types';
2
- export declare const getIdentifierWithKey: (args: GetIdentifierArgs) => Promise<IdentifierWithKey>;
3
- //# sourceMappingURL=IdentifierService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IdentifierService.d.ts","sourceRoot":"","sources":["../../src/services/IdentifierService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAG1E,eAAO,MAAM,oBAAoB,SAAgB,iBAAiB,KAAG,OAAO,CAAC,iBAAiB,CAc7F,CAAA"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getIdentifierWithKey = void 0;
13
- const ssi_sdk_ext_did_resolver_jwk_1 = require("@sphereon/ssi-sdk-ext.did-resolver-jwk");
14
- const ssi_sdk_ext_did_utils_1 = require("@sphereon/ssi-sdk-ext.did-utils");
15
- const getIdentifierWithKey = (args) => __awaiter(void 0, void 0, void 0, function* () {
16
- var _a;
17
- const { keyOpts, context } = args;
18
- const agentContext = Object.assign(Object.assign({}, context), { agent: context.agent });
19
- const identifier = (_a = keyOpts.identifier) !== null && _a !== void 0 ? _a : (yield (0, ssi_sdk_ext_did_utils_1.getOrCreatePrimaryIdentifier)(agentContext, {
20
- method: keyOpts.didMethod,
21
- createOpts: { options: { type: keyOpts.keyType, use: ssi_sdk_ext_did_resolver_jwk_1.KeyUse.Signature, codecName: keyOpts.codecName } },
22
- }));
23
- const key = yield (0, ssi_sdk_ext_did_utils_1.getAuthenticationKey)({ identifier, keyType: keyOpts.keyType }, agentContext);
24
- const kid = key.meta.verificationMethod.id;
25
- return { identifier, key, kid };
26
- });
27
- exports.getIdentifierWithKey = getIdentifierWithKey;
28
- //# sourceMappingURL=IdentifierService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IdentifierService.js","sourceRoot":"","sources":["../../src/services/IdentifierService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yFAA+D;AAG/D,2EAAoG;AAE7F,MAAM,oBAAoB,GAAG,CAAO,IAAuB,EAA8B,EAAE;;IAChG,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IACjC,MAAM,YAAY,mCAAQ,OAAO,KAAE,KAAK,EAAE,OAAO,CAAC,KAAkB,GAAE,CAAA;IAEtE,MAAM,UAAU,GACd,MAAA,OAAO,CAAC,UAAU,mCAClB,CAAC,MAAM,IAAA,oDAA4B,EAAC,YAAY,EAAE;QAChD,MAAM,EAAE,OAAO,CAAC,SAAS;QACzB,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,qCAAM,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE;KACxG,CAAC,CAAC,CAAA;IACL,MAAM,GAAG,GAAkB,MAAM,IAAA,4CAAoB,EAAC,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAA;IAC7G,MAAM,GAAG,GAAW,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAA;IAElD,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA;AACjC,CAAC,CAAA,CAAA;AAdY,QAAA,oBAAoB,wBAchC"}
@@ -1,16 +0,0 @@
1
- import { IPresentationDefinition } from '@sphereon/pex';
2
- import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
3
- import { ConnectionType } from '@sphereon/ssi-sdk.data-store';
4
- import { Hasher } from '@sphereon/ssi-types';
5
- import { RequiredContext, SelectableCredentialsMap, VerifiableCredentialsWithDefinition } from '../types';
6
- export declare const logger: import("@sphereon/ssi-types").ISimpleLogger<unknown>;
7
- export declare const siopSendAuthorizationResponse: (connectionType: ConnectionType, args: {
8
- sessionId: string;
9
- verifiableCredentialsWithDefinition?: VerifiableCredentialsWithDefinition[];
10
- idOpts?: ManagedIdentifierOptsOrResult;
11
- isFirstParty?: boolean;
12
- hasher?: Hasher;
13
- }, context: RequiredContext) => Promise<Response>;
14
- export declare const getSelectableCredentials: (presentationDefinition: IPresentationDefinition, context: RequiredContext) => Promise<SelectableCredentialsMap>;
15
- export declare const translateCorrelationIdToName: (correlationId: string, context: RequiredContext) => Promise<string | undefined>;
16
- //# sourceMappingURL=Siopv2MachineService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Siopv2MachineService.d.ts","sourceRoot":"","sources":["../../src/services/Siopv2MachineService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAO,MAAM,eAAe,CAAA;AAE5D,OAAO,EAA4B,6BAA6B,EAAE,MAAM,6CAA6C,CAAA;AAErH,OAAO,EAAE,cAAc,EAAkB,MAAM,8BAA8B,CAAA;AAC7E,OAAO,EAAoB,MAAM,EAAmC,MAAM,qBAAqB,CAAA;AAE/F,OAAO,EAGL,eAAe,EAEf,wBAAwB,EAGxB,mCAAmC,EAEpC,MAAM,UAAU,CAAA;AAKjB,eAAO,MAAM,MAAM,sDAAwC,CAAA;AAqB3D,eAAO,MAAM,6BAA6B,mBACxB,cAAc,QACxB;IACJ,SAAS,EAAE,MAAM,CAAA;IACjB,mCAAmC,CAAC,EAAE,mCAAmC,EAAE,CAAA;IAC3E,MAAM,CAAC,EAAE,6BAA6B,CAAA;IACtC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,WACQ,eAAe,sBAmHzB,CAAA;AAYD,eAAO,MAAM,wBAAwB,2BACX,uBAAuB,WACtC,eAAe,KACvB,OAAO,CAAC,wBAAwB,CA8ClC,CAAA;AAED,eAAO,MAAM,4BAA4B,kBAAyB,MAAM,WAAW,eAAe,KAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAY9H,CAAA"}
@@ -1,201 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.translateCorrelationIdToName = exports.getSelectableCredentials = exports.siopSendAuthorizationResponse = exports.logger = void 0;
13
- const did_auth_siop_1 = require("@sphereon/did-auth-siop");
14
- const pex_1 = require("@sphereon/pex");
15
- const ssi_sdk_ext_identifier_resolution_1 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
16
- const ssi_sdk_credential_store_1 = require("@sphereon/ssi-sdk.credential-store");
17
- const ssi_sdk_data_store_1 = require("@sphereon/ssi-sdk.data-store");
18
- const ssi_types_1 = require("@sphereon/ssi-types");
19
- const types_1 = require("../types");
20
- const ssi_sdk_ext_did_utils_1 = require("@sphereon/ssi-sdk-ext.did-utils");
21
- const ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
22
- exports.logger = ssi_types_1.Loggers.DEFAULT.get(types_1.LOGGER_NAMESPACE);
23
- const createEbsiIdentifier = (agentContext) => __awaiter(void 0, void 0, void 0, function* () {
24
- exports.logger.log(`No EBSI key present yet. Creating a new one...`);
25
- const { result: newIdentifier, created } = yield (0, ssi_sdk_ext_did_utils_1.getOrCreatePrimaryIdentifier)(agentContext, {
26
- method: ssi_sdk_ext_did_utils_1.SupportedDidMethodEnum.DID_KEY,
27
- createOpts: { options: { codecName: 'jwk_jcs-pub', type: 'Secp256r1' } },
28
- });
29
- exports.logger.log(`EBSI key created: ${newIdentifier.did}`);
30
- if (created) {
31
- yield agentContext.agent.emit(types_1.Siopv2HolderEvent.IDENTIFIER_CREATED, { result: newIdentifier });
32
- }
33
- return yield agentContext.agent.identifierManagedGetByDid({ identifier: newIdentifier.did });
34
- });
35
- const hasEbsiClient = (authorizationRequest) => __awaiter(void 0, void 0, void 0, function* () {
36
- const clientId = yield authorizationRequest.getMergedProperty('client_id');
37
- const redirectUri = yield authorizationRequest.getMergedProperty('redirect_uri');
38
- return (clientId === null || clientId === void 0 ? void 0 : clientId.toLowerCase().includes('.ebsi.eu')) || (redirectUri === null || redirectUri === void 0 ? void 0 : redirectUri.toLowerCase().includes('.ebsi.eu'));
39
- });
40
- const siopSendAuthorizationResponse = (connectionType, args, context) => __awaiter(void 0, void 0, void 0, function* () {
41
- var _a, _b, _c, _d, _e, _f, _g, _h;
42
- const { agent } = context;
43
- const agentContext = Object.assign(Object.assign({}, context), { agent: context.agent });
44
- let { idOpts, isFirstParty, hasher } = args;
45
- if (connectionType !== ssi_sdk_data_store_1.ConnectionType.SIOPv2_OpenID4VP) {
46
- return Promise.reject(Error(`No supported authentication provider for type: ${connectionType}`));
47
- }
48
- const session = yield agent.siopGetOPSession({ sessionId: args.sessionId });
49
- const request = yield session.getAuthorizationRequest();
50
- const aud = yield request.authorizationRequest.getMergedProperty('aud');
51
- exports.logger.debug(`AUD: ${aud}`);
52
- exports.logger.debug(JSON.stringify(request.authorizationRequest));
53
- let presentationsAndDefs;
54
- let presentationSubmission;
55
- if (yield session.hasPresentationDefinitions()) {
56
- const oid4vp = yield session.getOID4VP({ hasher });
57
- const credentialsAndDefinitions = args.verifiableCredentialsWithDefinition
58
- ? args.verifiableCredentialsWithDefinition
59
- : yield oid4vp.filterCredentialsAgainstAllDefinitions(ssi_sdk_data_store_1.CredentialRole.HOLDER);
60
- const domain = (_b = (_a = (yield request.authorizationRequest.getMergedProperty('client_id'))) !== null && _a !== void 0 ? _a : request.issuer) !== null && _b !== void 0 ? _b : (request.versions.includes(did_auth_siop_1.SupportedVersion.JWT_VC_PRESENTATION_PROFILE_v1)
61
- ? 'https://self-issued.me/v2/openid-vc'
62
- : 'https://self-issued.me/v2');
63
- exports.logger.log(`NONCE: ${session.nonce}, domain: ${domain}`);
64
- const firstUniqueDC = credentialsAndDefinitions[0].credentials[0];
65
- if (typeof firstUniqueDC !== 'object' || !('digitalCredential' in firstUniqueDC)) {
66
- return Promise.reject(Error('SiopMachine only supports UniqueDigitalCredentials for now'));
67
- }
68
- let identifier;
69
- const digitalCredential = firstUniqueDC.digitalCredential;
70
- const firstVC = firstUniqueDC.uniformVerifiableCredential;
71
- const holder = ssi_types_1.CredentialMapper.isSdJwtDecodedCredential(firstVC)
72
- ? ((_c = firstVC.decodedPayload.cnf) === null || _c === void 0 ? void 0 : _c.jwk)
73
- ? //TODO SDK-19: convert the JWK to hex and search for the appropriate key and associated DID
74
- //doesn't apply to did:jwk only, as you can represent any DID key as a JWK. So whenever you encounter a JWK it doesn't mean it had to come from a did:jwk in the system. It just can always be represented as a did:jwk
75
- `did:jwk:${(0, ssi_sdk_core_1.encodeJoseBlob)((_d = firstVC.decodedPayload.cnf) === null || _d === void 0 ? void 0 : _d.jwk)}#0`
76
- : firstVC.decodedPayload.sub
77
- : Array.isArray(firstVC.credentialSubject)
78
- ? firstVC.credentialSubject[0].id
79
- : firstVC.credentialSubject.id;
80
- if (!digitalCredential.kmsKeyRef) {
81
- // In case the store does not have the kmsKeyRef lets search for the holder
82
- if (!holder) {
83
- return Promise.reject(`No holder found and no kmsKeyRef in DB. Cannot determine identifier to use`);
84
- }
85
- try {
86
- identifier = yield session.context.agent.identifierManagedGet({ identifier: holder });
87
- }
88
- catch (e) {
89
- exports.logger.debug(`Holder DID not found: ${holder}`);
90
- throw e;
91
- }
92
- }
93
- else if ((0, ssi_sdk_ext_identifier_resolution_1.isOID4VCIssuerIdentifier)(digitalCredential.kmsKeyRef)) {
94
- identifier = yield session.context.agent.identifierManagedGetByOID4VCIssuer({
95
- identifier: firstUniqueDC.digitalCredential.kmsKeyRef,
96
- });
97
- }
98
- else {
99
- switch (digitalCredential.subjectCorrelationType) {
100
- case 'DID':
101
- identifier = yield session.context.agent.identifierManagedGetByDid({
102
- identifier: (_e = digitalCredential.subjectCorrelationId) !== null && _e !== void 0 ? _e : holder,
103
- kmsKeyRef: digitalCredential.kmsKeyRef,
104
- });
105
- break;
106
- // TODO other implementations?
107
- default:
108
- // Since we are using the kmsKeyRef we will find the KID regardless of the identifier. We set it for later access though
109
- identifier = yield session.context.agent.identifierManagedGetByKid({
110
- identifier: (_g = (_f = digitalCredential.subjectCorrelationId) !== null && _f !== void 0 ? _f : holder) !== null && _g !== void 0 ? _g : digitalCredential.kmsKeyRef,
111
- kmsKeyRef: digitalCredential.kmsKeyRef,
112
- });
113
- }
114
- }
115
- if (identifier === undefined && idOpts !== undefined && (yield hasEbsiClient(request.authorizationRequest))) {
116
- identifier = yield createEbsiIdentifier(agentContext);
117
- }
118
- exports.logger.debug(`Identifier`, identifier);
119
- // TODO Add mdoc support
120
- presentationsAndDefs = yield oid4vp.createVerifiablePresentations(ssi_sdk_data_store_1.CredentialRole.HOLDER, credentialsAndDefinitions, {
121
- idOpts: identifier,
122
- proofOpts: {
123
- nonce: session.nonce,
124
- domain,
125
- },
126
- });
127
- if (!presentationsAndDefs || presentationsAndDefs.length === 0) {
128
- throw Error('No verifiable presentations could be created');
129
- }
130
- else if (presentationsAndDefs.length > 1) {
131
- throw Error(`Only one verifiable presentation supported for now. Got ${presentationsAndDefs.length}`);
132
- }
133
- idOpts = presentationsAndDefs[0].idOpts;
134
- presentationSubmission = presentationsAndDefs[0].presentationSubmission;
135
- }
136
- exports.logger.log(`Definitions and locations:`, JSON.stringify((_h = presentationsAndDefs === null || presentationsAndDefs === void 0 ? void 0 : presentationsAndDefs[0]) === null || _h === void 0 ? void 0 : _h.verifiablePresentations, null, 2));
137
- exports.logger.log(`Presentation Submission:`, JSON.stringify(presentationSubmission, null, 2));
138
- const mergedVerifiablePresentations = (presentationsAndDefs === null || presentationsAndDefs === void 0 ? void 0 : presentationsAndDefs.flatMap((pd) => pd.verifiablePresentations)) || [];
139
- return yield session.sendAuthorizationResponse(Object.assign(Object.assign(Object.assign({}, (presentationsAndDefs && { verifiablePresentations: mergedVerifiablePresentations })), (presentationSubmission && { presentationSubmission })), {
140
- // todo: Change issuer value in case we do not use identifier. Use key.meta.jwkThumbprint then
141
- responseSignerOpts: idOpts, isFirstParty }));
142
- });
143
- exports.siopSendAuthorizationResponse = siopSendAuthorizationResponse;
144
- function buildPartialPD(inputDescriptor, presentationDefinition) {
145
- return Object.assign(Object.assign({}, presentationDefinition), { input_descriptors: [inputDescriptor] });
146
- }
147
- const getSelectableCredentials = (presentationDefinition, context) => __awaiter(void 0, void 0, void 0, function* () {
148
- var _a;
149
- const agentContext = Object.assign(Object.assign({}, context), { agent: context.agent });
150
- const { agent } = agentContext;
151
- const pex = new pex_1.PEX();
152
- const uniqueVerifiableCredentials = yield agent.crsGetUniqueCredentials({
153
- filter: (0, ssi_sdk_credential_store_1.verifiableCredentialForRoleFilter)(ssi_sdk_data_store_1.CredentialRole.HOLDER),
154
- });
155
- const credentialBranding = yield agent.ibGetCredentialBranding();
156
- const selectableCredentialsMap = new Map();
157
- for (const inputDescriptor of presentationDefinition.input_descriptors) {
158
- const partialPD = buildPartialPD(inputDescriptor, presentationDefinition);
159
- const originalCredentials = uniqueVerifiableCredentials.map((uniqueVC) => {
160
- return ssi_types_1.CredentialMapper.storedCredentialToOriginalFormat(uniqueVC.originalVerifiableCredential); // ( ! is valid for verifiableCredentialForRoleFilter )
161
- });
162
- const selectionResults = pex.selectFrom(partialPD, originalCredentials);
163
- const selectableCredentials = [];
164
- for (const selectedCredential of selectionResults.verifiableCredential || []) {
165
- const filteredUniqueVC = uniqueVerifiableCredentials.find((uniqueVC) => {
166
- const proof = uniqueVC.uniformVerifiableCredential.proof;
167
- return Array.isArray(proof) ? proof.some((proofItem) => proofItem.jwt === selectedCredential) : proof.jwt === selectedCredential;
168
- });
169
- if (filteredUniqueVC) {
170
- const filteredCredentialBrandings = credentialBranding.filter((cb) => cb.vcHash === filteredUniqueVC.hash);
171
- const issuerPartyIdentity = yield agent.cmGetContacts({
172
- filter: [{ identities: { identifier: { correlationId: filteredUniqueVC.uniformVerifiableCredential.issuerDid } } }],
173
- });
174
- const subjectPartyIdentity = yield agent.cmGetContacts({
175
- filter: [{ identities: { identifier: { correlationId: filteredUniqueVC.uniformVerifiableCredential.subjectDid } } }],
176
- });
177
- selectableCredentials.push({
178
- credential: filteredUniqueVC,
179
- credentialBranding: (_a = filteredCredentialBrandings[0]) === null || _a === void 0 ? void 0 : _a.localeBranding,
180
- issuerParty: issuerPartyIdentity === null || issuerPartyIdentity === void 0 ? void 0 : issuerPartyIdentity[0],
181
- subjectParty: subjectPartyIdentity === null || subjectPartyIdentity === void 0 ? void 0 : subjectPartyIdentity[0],
182
- });
183
- }
184
- }
185
- selectableCredentialsMap.set(inputDescriptor.id, selectableCredentials);
186
- }
187
- return selectableCredentialsMap;
188
- });
189
- exports.getSelectableCredentials = getSelectableCredentials;
190
- const translateCorrelationIdToName = (correlationId, context) => __awaiter(void 0, void 0, void 0, function* () {
191
- const { agent } = context;
192
- const contacts = yield agent.cmGetContacts({
193
- filter: [{ identities: { identifier: { correlationId } } }],
194
- });
195
- if (contacts.length === 0) {
196
- return undefined;
197
- }
198
- return contacts[0].contact.displayName;
199
- });
200
- exports.translateCorrelationIdToName = translateCorrelationIdToName;
201
- //# sourceMappingURL=Siopv2MachineService.js.map