@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth 0.34.1-feature.FIDES.1.274 → 0.34.1-feature.IDK.11.49

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/dist/index.cjs CHANGED
@@ -4,6 +4,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
7
10
  var __export = (target, all) => {
8
11
  for (var name in all)
9
12
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -18,352 +21,354 @@ var __copyProps = (to, from, except, desc) => {
18
21
  };
19
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
23
 
21
- // src/index.ts
22
- var index_exports = {};
23
- __export(index_exports, {
24
- SIOPv2RP: () => SIOPv2RP,
25
- schema: () => plugin_schema_default
26
- });
27
- module.exports = __toCommonJS(index_exports);
28
-
29
24
  // plugin.schema.json
30
- var plugin_schema_default = {
31
- IDidAuthSiopOpAuthenticator: {
32
- components: {
33
- schemas: {
34
- IGetSiopSessionArgs: {
35
- type: "object",
36
- properties: {
37
- sessionId: {
38
- type: "string"
25
+ var require_plugin_schema = __commonJS({
26
+ "plugin.schema.json"(exports, module2) {
27
+ module2.exports = {
28
+ IDidAuthSiopOpAuthenticator: {
29
+ components: {
30
+ schemas: {
31
+ IGetSiopSessionArgs: {
32
+ type: "object",
33
+ properties: {
34
+ sessionId: {
35
+ type: "string"
36
+ },
37
+ additionalProperties: false
38
+ },
39
+ required: ["sessionId"],
40
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSessionForSiop } "
39
41
  },
40
- additionalProperties: false
41
- },
42
- required: ["sessionId"],
43
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSessionForSiop } "
44
- },
45
- IRegisterSiopSessionArgs: {
46
- type: "object",
47
- properties: {
48
- identifier: {
42
+ IRegisterSiopSessionArgs: {
49
43
  type: "object",
50
44
  properties: {
51
- did: {
45
+ identifier: {
46
+ type: "object",
47
+ properties: {
48
+ did: {
49
+ type: "string"
50
+ },
51
+ alias: {
52
+ type: "string"
53
+ },
54
+ provider: {
55
+ type: "string"
56
+ },
57
+ controllerKeyId: {
58
+ type: "string"
59
+ },
60
+ keys: {
61
+ type: "array",
62
+ items: {
63
+ type: "object",
64
+ properties: {
65
+ additionalProperties: true
66
+ }
67
+ }
68
+ },
69
+ services: {
70
+ type: "array",
71
+ items: {
72
+ type: "object",
73
+ properties: {
74
+ additionalProperties: true
75
+ }
76
+ }
77
+ }
78
+ },
79
+ additionalProperties: false,
80
+ required: ["did", "provider", "keys", "services"]
81
+ },
82
+ sessionId: {
52
83
  type: "string"
53
84
  },
54
- alias: {
85
+ expiresIn: {
86
+ type: "number"
87
+ },
88
+ additionalProperties: false
89
+ },
90
+ required: ["identifier"],
91
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.registerSessionForSiop } "
92
+ },
93
+ IRemoveSiopSessionArgs: {
94
+ type: "object",
95
+ properties: {
96
+ sessionId: {
55
97
  type: "string"
56
98
  },
57
- provider: {
99
+ additionalProperties: false
100
+ },
101
+ required: ["sessionId"],
102
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.removeSessionForSiop } "
103
+ },
104
+ IAuthenticateWithSiopArgs: {
105
+ type: "object",
106
+ properties: {
107
+ sessionId: {
58
108
  type: "string"
59
109
  },
60
- controllerKeyId: {
110
+ stateId: {
61
111
  type: "string"
62
112
  },
63
- keys: {
64
- type: "array",
65
- items: {
66
- type: "object",
67
- properties: {
68
- additionalProperties: true
69
- }
70
- }
113
+ redirectUrl: {
114
+ type: "string"
71
115
  },
72
- services: {
73
- type: "array",
74
- items: {
75
- type: "object",
76
- properties: {
77
- additionalProperties: true
78
- }
79
- }
80
- }
116
+ additionalProperties: false
81
117
  },
82
- additionalProperties: false,
83
- required: ["did", "provider", "keys", "services"]
84
- },
85
- sessionId: {
86
- type: "string"
87
- },
88
- expiresIn: {
89
- type: "number"
90
- },
91
- additionalProperties: false
92
- },
93
- required: ["identifier"],
94
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.registerSessionForSiop } "
95
- },
96
- IRemoveSiopSessionArgs: {
97
- type: "object",
98
- properties: {
99
- sessionId: {
100
- type: "string"
101
- },
102
- additionalProperties: false
103
- },
104
- required: ["sessionId"],
105
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.removeSessionForSiop } "
106
- },
107
- IAuthenticateWithSiopArgs: {
108
- type: "object",
109
- properties: {
110
- sessionId: {
111
- type: "string"
112
- },
113
- stateId: {
114
- type: "string"
115
- },
116
- redirectUrl: {
117
- type: "string"
118
- },
119
- additionalProperties: false
120
- },
121
- required: ["sessionId", "stateId", "redirectUrl"],
122
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } "
123
- },
124
- IResponse: {
125
- type: "object",
126
- properties: {
127
- status: {
128
- type: "number"
118
+ required: ["sessionId", "stateId", "redirectUrl"],
119
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } "
129
120
  },
130
- additionalProperties: true
131
- },
132
- required: ["status"],
133
- description: "Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
134
- },
135
- IGetSiopAuthenticationRequestFromRpArgs: {
136
- type: "object",
137
- properties: {
138
- sessionId: {
139
- type: "string"
140
- },
141
- stateId: {
142
- type: "string"
143
- },
144
- redirectUrl: {
145
- type: "string"
146
- },
147
- additionalProperties: false
148
- },
149
- required: ["sessionId", "stateId", "redirectUrl"],
150
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
151
- },
152
- ParsedAuthenticationRequestURI: {
153
- type: "object",
154
- properties: {
155
- jwt: {
156
- type: "string"
157
- },
158
- requestPayload: {
121
+ IResponse: {
159
122
  type: "object",
160
123
  properties: {
124
+ status: {
125
+ type: "number"
126
+ },
161
127
  additionalProperties: true
162
- }
128
+ },
129
+ required: ["status"],
130
+ description: "Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
163
131
  },
164
- registration: {
132
+ IGetSiopAuthenticationRequestFromRpArgs: {
165
133
  type: "object",
166
134
  properties: {
167
- additionalProperties: true
168
- }
169
- },
170
- additionalProperties: false
171
- },
172
- required: ["jwt", "requestPayload", "registration"],
173
- description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
174
- },
175
- IGetSiopAuthenticationRequestDetailsArgs: {
176
- type: "object",
177
- properties: {
178
- sessionId: {
179
- type: "string"
135
+ sessionId: {
136
+ type: "string"
137
+ },
138
+ stateId: {
139
+ type: "string"
140
+ },
141
+ redirectUrl: {
142
+ type: "string"
143
+ },
144
+ additionalProperties: false
145
+ },
146
+ required: ["sessionId", "stateId", "redirectUrl"],
147
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
180
148
  },
181
- verifiedAuthenticationRequest: {
149
+ ParsedAuthenticationRequestURI: {
182
150
  type: "object",
183
151
  properties: {
184
- additionalProperties: true
185
- }
152
+ jwt: {
153
+ type: "string"
154
+ },
155
+ requestPayload: {
156
+ type: "object",
157
+ properties: {
158
+ additionalProperties: true
159
+ }
160
+ },
161
+ registration: {
162
+ type: "object",
163
+ properties: {
164
+ additionalProperties: true
165
+ }
166
+ },
167
+ additionalProperties: false
168
+ },
169
+ required: ["jwt", "requestPayload", "registration"],
170
+ description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
186
171
  },
187
- credentialFilter: {
172
+ IGetSiopAuthenticationRequestDetailsArgs: {
188
173
  type: "object",
189
174
  properties: {
190
- additionalProperties: true
191
- }
192
- },
193
- additionalProperties: false
194
- },
195
- required: ["sessionId", "verifiedAuthenticationRequest"],
196
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
197
- },
198
- IAuthRequestDetails: {
199
- type: "object",
200
- properties: {
201
- id: {
202
- type: "string"
203
- },
204
- alsoKnownAs: {
205
- type: "array",
206
- items: {
207
- type: "string"
208
- }
175
+ sessionId: {
176
+ type: "string"
177
+ },
178
+ verifiedAuthenticationRequest: {
179
+ type: "object",
180
+ properties: {
181
+ additionalProperties: true
182
+ }
183
+ },
184
+ credentialFilter: {
185
+ type: "object",
186
+ properties: {
187
+ additionalProperties: true
188
+ }
189
+ },
190
+ additionalProperties: false
191
+ },
192
+ required: ["sessionId", "verifiedAuthenticationRequest"],
193
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
209
194
  },
210
- vpResponseOpts: {
195
+ IAuthRequestDetails: {
211
196
  type: "object",
212
197
  properties: {
213
- additionalProperties: true
214
- }
215
- },
216
- additionalProperties: false
217
- },
218
- required: ["id", "vpResponseOpts"],
219
- description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
220
- },
221
- IVerifySiopAuthenticationRequestUriArgs: {
222
- type: "object",
223
- properties: {
224
- sessionId: {
225
- type: "string"
198
+ id: {
199
+ type: "string"
200
+ },
201
+ alsoKnownAs: {
202
+ type: "array",
203
+ items: {
204
+ type: "string"
205
+ }
206
+ },
207
+ vpResponseOpts: {
208
+ type: "object",
209
+ properties: {
210
+ additionalProperties: true
211
+ }
212
+ },
213
+ additionalProperties: false
214
+ },
215
+ required: ["id", "vpResponseOpts"],
216
+ description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
226
217
  },
227
- ParsedAuthenticationRequestURI: {
218
+ IVerifySiopAuthenticationRequestUriArgs: {
228
219
  type: "object",
229
220
  properties: {
230
- additionalProperties: true
231
- }
221
+ sessionId: {
222
+ type: "string"
223
+ },
224
+ ParsedAuthenticationRequestURI: {
225
+ type: "object",
226
+ properties: {
227
+ additionalProperties: true
228
+ }
229
+ },
230
+ additionalProperties: false
231
+ },
232
+ required: ["sessionId", "ParsedAuthenticationRequestURI"],
233
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
232
234
  },
233
- additionalProperties: false
234
- },
235
- required: ["sessionId", "ParsedAuthenticationRequestURI"],
236
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
237
- },
238
- VerifiedAuthorizationRequest: {
239
- type: "object",
240
- properties: {
241
- payload: {
235
+ VerifiedAuthorizationRequest: {
242
236
  type: "object",
243
237
  properties: {
244
- additionalProperties: true
245
- }
238
+ payload: {
239
+ type: "object",
240
+ properties: {
241
+ additionalProperties: true
242
+ }
243
+ },
244
+ presentationDefinitions: {
245
+ type: "object",
246
+ properties: {
247
+ additionalProperties: true
248
+ }
249
+ },
250
+ verifyOpts: {
251
+ type: "object",
252
+ properties: {
253
+ additionalProperties: true
254
+ }
255
+ },
256
+ additionalProperties: false
257
+ },
258
+ required: ["payload", "verifyOpts"],
259
+ description: "Result of {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
246
260
  },
247
- presentationDefinitions: {
261
+ ISendSiopAuthenticationResponseArgs: {
248
262
  type: "object",
249
263
  properties: {
250
- additionalProperties: true
251
- }
264
+ sessionId: {
265
+ type: "string"
266
+ },
267
+ verifiedAuthenticationRequest: {
268
+ type: "object",
269
+ properties: {
270
+ additionalProperties: true
271
+ }
272
+ },
273
+ verifiablePresentationResponse: {
274
+ type: "object",
275
+ properties: {
276
+ additionalProperties: true
277
+ }
278
+ },
279
+ additionalProperties: false
280
+ },
281
+ required: ["sessionId", "verifiedAuthenticationRequest"],
282
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
283
+ }
284
+ },
285
+ methods: {
286
+ getSessionForSiop: {
287
+ description: "Get SIOP session",
288
+ arguments: {
289
+ $ref: "#/components/schemas/IGetSiopSessionArgs"
290
+ },
291
+ returnType: "object"
252
292
  },
253
- verifyOpts: {
254
- type: "object",
255
- properties: {
256
- additionalProperties: true
293
+ registerSessionForSiop: {
294
+ description: "Register SIOP session",
295
+ arguments: {
296
+ $ref: "#/components/schemas/IRegisterSiopSessionArgs"
297
+ },
298
+ returnType: "object"
299
+ },
300
+ removeSessionForSiop: {
301
+ description: "Remove SIOP session",
302
+ arguments: {
303
+ $ref: "#/components/schemas/IRemoveSiopSessionArgs"
304
+ },
305
+ returnType: "boolean"
306
+ },
307
+ authenticateWithSiop: {
308
+ description: "Authenticate using DID Auth SIOP",
309
+ arguments: {
310
+ $ref: "#/components/schemas/IAuthenticateWithSiopArgs"
311
+ },
312
+ returnType: {
313
+ $ref: "#/components/schemas/Response"
257
314
  }
258
315
  },
259
- additionalProperties: false
260
- },
261
- required: ["payload", "verifyOpts"],
262
- description: "Result of {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
263
- },
264
- ISendSiopAuthenticationResponseArgs: {
265
- type: "object",
266
- properties: {
267
- sessionId: {
268
- type: "string"
316
+ getSiopAuthenticationRequestFromRP: {
317
+ description: "Get authentication request from RP",
318
+ arguments: {
319
+ $ref: "#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs"
320
+ },
321
+ returnType: {
322
+ $ref: "#/components/schemas/ParsedAuthenticationRequestURI"
323
+ }
269
324
  },
270
- verifiedAuthenticationRequest: {
271
- type: "object",
272
- properties: {
273
- additionalProperties: true
325
+ getSiopAuthenticationRequestDetails: {
326
+ description: "Get authentication request details",
327
+ arguments: {
328
+ $ref: "#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs"
329
+ },
330
+ returnType: {
331
+ $ref: "#/components/schemas/IAuthRequestDetails"
274
332
  }
275
333
  },
276
- verifiablePresentationResponse: {
277
- type: "object",
278
- properties: {
279
- additionalProperties: true
334
+ verifySiopAuthenticationRequestURI: {
335
+ description: "Verify authentication request URI",
336
+ arguments: {
337
+ $ref: "#/components/schemas/IVerifySiopAuthenticationRequestUriArgs"
338
+ },
339
+ returnType: {
340
+ $ref: "#/components/schemas/VerifiedAuthorizationRequest"
280
341
  }
281
342
  },
282
- additionalProperties: false
283
- },
284
- required: ["sessionId", "verifiedAuthenticationRequest"],
285
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
286
- }
287
- },
288
- methods: {
289
- getSessionForSiop: {
290
- description: "Get SIOP session",
291
- arguments: {
292
- $ref: "#/components/schemas/IGetSiopSessionArgs"
293
- },
294
- returnType: "object"
295
- },
296
- registerSessionForSiop: {
297
- description: "Register SIOP session",
298
- arguments: {
299
- $ref: "#/components/schemas/IRegisterSiopSessionArgs"
300
- },
301
- returnType: "object"
302
- },
303
- removeSessionForSiop: {
304
- description: "Remove SIOP session",
305
- arguments: {
306
- $ref: "#/components/schemas/IRemoveSiopSessionArgs"
307
- },
308
- returnType: "boolean"
309
- },
310
- authenticateWithSiop: {
311
- description: "Authenticate using DID Auth SIOP",
312
- arguments: {
313
- $ref: "#/components/schemas/IAuthenticateWithSiopArgs"
314
- },
315
- returnType: {
316
- $ref: "#/components/schemas/Response"
317
- }
318
- },
319
- getSiopAuthenticationRequestFromRP: {
320
- description: "Get authentication request from RP",
321
- arguments: {
322
- $ref: "#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs"
323
- },
324
- returnType: {
325
- $ref: "#/components/schemas/ParsedAuthenticationRequestURI"
326
- }
327
- },
328
- getSiopAuthenticationRequestDetails: {
329
- description: "Get authentication request details",
330
- arguments: {
331
- $ref: "#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs"
332
- },
333
- returnType: {
334
- $ref: "#/components/schemas/IAuthRequestDetails"
335
- }
336
- },
337
- verifySiopAuthenticationRequestURI: {
338
- description: "Verify authentication request URI",
339
- arguments: {
340
- $ref: "#/components/schemas/IVerifySiopAuthenticationRequestUriArgs"
341
- },
342
- returnType: {
343
- $ref: "#/components/schemas/VerifiedAuthorizationRequest"
344
- }
345
- },
346
- sendSiopAuthenticationResponse: {
347
- description: "Send authentication response",
348
- arguments: {
349
- $ref: "#/components/schemas/ISendSiopAuthenticationResponseArgs"
350
- },
351
- returnType: {
352
- $ref: "#/components/schemas/IRequiredContext"
343
+ sendSiopAuthenticationResponse: {
344
+ description: "Send authentication response",
345
+ arguments: {
346
+ $ref: "#/components/schemas/ISendSiopAuthenticationResponseArgs"
347
+ },
348
+ returnType: {
349
+ $ref: "#/components/schemas/IRequiredContext"
350
+ }
351
+ }
353
352
  }
354
353
  }
355
354
  }
356
- }
355
+ };
357
356
  }
358
- };
357
+ });
358
+
359
+ // src/index.ts
360
+ var index_exports = {};
361
+ __export(index_exports, {
362
+ SIOPv2RP: () => SIOPv2RP,
363
+ VerifiedDataMode: () => VerifiedDataMode,
364
+ schema: () => schema
365
+ });
366
+ module.exports = __toCommonJS(index_exports);
359
367
 
360
368
  // src/agent/SIOPv2RP.ts
361
369
  var import_did_auth_siop2 = require("@sphereon/did-auth-siop");
362
370
  var import_ssi_sdk_ext4 = require("@sphereon/ssi-sdk-ext.did-utils");
363
- var import_ssi_sdk2 = require("@sphereon/ssi-sdk.core");
364
- var import_uuid3 = require("uuid");
365
371
  var import_ssi_types2 = require("@sphereon/ssi-types");
366
- var import_dcql = require("dcql");
367
372
 
368
373
  // src/functions.ts
369
374
  var import_did_auth_siop = require("@sphereon/did-auth-siop");
@@ -372,13 +377,12 @@ var import_ssi_sdk_ext = require("@sphereon/ssi-sdk-ext.did-utils");
372
377
  var import_ssi_sdk_ext2 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
373
378
  var import_ssi_types = require("@sphereon/ssi-types");
374
379
  var import_events = require("events");
375
- var import_uuid = require("uuid");
376
380
  var import_ssi_sdk = require("@sphereon/ssi-sdk.core");
377
381
  function getRequestVersion(rpOptions) {
378
382
  if (Array.isArray(rpOptions.supportedVersions) && rpOptions.supportedVersions.length > 0) {
379
383
  return rpOptions.supportedVersions[0];
380
384
  }
381
- return import_did_auth_siop.SupportedVersion.OID4VP_v1;
385
+ return import_did_auth_siop.SupportedVersion.JWT_VC_PRESENTATION_PROFILE_v1;
382
386
  }
383
387
  __name(getRequestVersion, "getRequestVersion");
384
388
  function getWellKnownDIDVerifyCallback(siopIdentifierOpts, context) {
@@ -393,40 +397,12 @@ function getWellKnownDIDVerifyCallback(siopIdentifierOpts, context) {
393
397
  };
394
398
  }
395
399
  __name(getWellKnownDIDVerifyCallback, "getWellKnownDIDVerifyCallback");
396
- function getDcqlQueryLookupCallback(context) {
397
- async function dcqlQueryLookup(queryId, version, tenantId) {
398
- const result = await context.agent.pdmGetDefinitions({
399
- filter: [
400
- {
401
- queryId,
402
- ...tenantId && {
403
- tenantId
404
- },
405
- ...version && {
406
- version
407
- }
408
- },
409
- ...(0, import_uuid.validate)(queryId) ? [
410
- {
411
- id: queryId
412
- }
413
- ] : []
414
- ]
415
- });
416
- if (result && result.length > 0) {
417
- return result[0].query;
418
- }
419
- return Promise.reject(Error(`No dcql query found for queryId ${queryId}`));
420
- }
421
- __name(dcqlQueryLookup, "dcqlQueryLookup");
422
- return dcqlQueryLookup;
423
- }
424
- __name(getDcqlQueryLookupCallback, "getDcqlQueryLookupCallback");
425
400
  function getPresentationVerificationCallback(idOpts, context) {
426
401
  async function presentationVerificationCallback(args, presentationSubmission) {
427
402
  if (import_ssi_types.CredentialMapper.isSdJwtEncoded(args)) {
428
403
  const result2 = await context.agent.verifySdJwtPresentation({
429
- presentation: args
404
+ presentation: args,
405
+ kb: true
430
406
  });
431
407
  return {
432
408
  verified: !!result2.payload
@@ -461,8 +437,28 @@ function getPresentationVerificationCallback(idOpts, context) {
461
437
  }
462
438
  __name(getPresentationVerificationCallback, "getPresentationVerificationCallback");
463
439
  async function createRPBuilder(args) {
464
- const { rpOpts, context } = args;
440
+ const { rpOpts, pexOpts, context } = args;
465
441
  const { identifierOpts } = rpOpts;
442
+ let definition = args.definition;
443
+ let dcqlQuery = args.dcql;
444
+ if (!definition && pexOpts && pexOpts.definitionId) {
445
+ const presentationDefinitionItems = await context.agent.pdmGetDefinitions({
446
+ filter: [
447
+ {
448
+ definitionId: pexOpts.definitionId,
449
+ version: pexOpts.version,
450
+ tenantId: pexOpts.tenantId
451
+ }
452
+ ]
453
+ });
454
+ if (presentationDefinitionItems.length > 0) {
455
+ const presentationDefinitionItem = presentationDefinitionItems[0];
456
+ definition = presentationDefinitionItem.definitionPayload;
457
+ if (!dcqlQuery && presentationDefinitionItem.dcqlPayload) {
458
+ dcqlQuery = presentationDefinitionItem.dcqlPayload;
459
+ }
460
+ }
461
+ }
466
462
  const didMethods = identifierOpts.supportedDIDMethods ?? await (0, import_ssi_sdk_ext.getAgentDIDMethods)(context);
467
463
  const eventEmitter = rpOpts.eventEmitter ?? new import_events.EventEmitter();
468
464
  const defaultClientMetadata = {
@@ -517,27 +513,34 @@ async function createRPBuilder(args) {
517
513
  const builder = import_did_auth_siop.RP.builder({
518
514
  requestVersion: getRequestVersion(rpOpts)
519
515
  }).withScope("openid", import_did_auth_siop.PropertyTarget.REQUEST_OBJECT).withResponseMode(rpOpts.responseMode ?? import_did_auth_siop.ResponseMode.POST).withResponseType(import_did_auth_siop.ResponseType.VP_TOKEN, import_did_auth_siop.PropertyTarget.REQUEST_OBJECT).withSupportedVersions(rpOpts.supportedVersions ?? [
520
- import_did_auth_siop.SupportedVersion.OID4VP_v1,
521
- import_did_auth_siop.SupportedVersion.SIOPv2_OID4VP_D28
516
+ import_did_auth_siop.SupportedVersion.JWT_VC_PRESENTATION_PROFILE_v1,
517
+ import_did_auth_siop.SupportedVersion.SIOPv2_ID1,
518
+ import_did_auth_siop.SupportedVersion.SIOPv2_D11
522
519
  ]).withEventEmitter(eventEmitter).withSessionManager(rpOpts.sessionManager ?? new import_did_auth_siop.InMemoryRPSessionManager(eventEmitter)).withClientMetadata(rpOpts.clientMetadataOpts ?? defaultClientMetadata, import_did_auth_siop.PropertyTarget.REQUEST_OBJECT).withVerifyJwtCallback(rpOpts.verifyJwtCallback ? rpOpts.verifyJwtCallback : getVerifyJwtCallback({
523
520
  resolver,
524
521
  verifyOpts: {
525
522
  wellknownDIDVerifyCallback: getWellKnownDIDVerifyCallback(rpOpts.identifierOpts, context),
526
523
  checkLinkedDomain: "if_present"
527
524
  }
528
- }, context)).withDcqlQueryLookup(getDcqlQueryLookupCallback(context)).withRevocationVerification(import_did_auth_siop.RevocationVerification.NEVER).withPresentationVerification(getPresentationVerificationCallback(identifierOpts.idOpts, context));
525
+ }, context)).withRevocationVerification(import_did_auth_siop.RevocationVerification.NEVER).withPresentationVerification(getPresentationVerificationCallback(identifierOpts.idOpts, context));
529
526
  const oidfOpts = identifierOpts.oidfOpts;
530
527
  if (oidfOpts && (0, import_ssi_sdk_ext2.isExternalIdentifierOIDFEntityIdOpts)(oidfOpts)) {
531
- builder.withEntityId(oidfOpts.identifier, import_did_auth_siop.PropertyTarget.REQUEST_OBJECT);
528
+ builder.withEntityId(oidfOpts.identifier, import_did_auth_siop.PropertyTarget.REQUEST_OBJECT).withClientIdScheme("entity_id", import_did_auth_siop.PropertyTarget.REQUEST_OBJECT);
532
529
  } else {
533
530
  const resolution = await context.agent.identifierManagedGet(identifierOpts.idOpts);
534
- const clientId = rpOpts.clientMetadataOpts?.client_id ?? resolution.issuer ?? ((0, import_ssi_sdk_ext2.isManagedIdentifierDidResult)(resolution) ? resolution.did : resolution.jwkThumbprint);
535
- const clientIdPrefixed = prefixClientId(clientId);
536
- builder.withClientId(clientIdPrefixed, import_did_auth_siop.PropertyTarget.REQUEST_OBJECT);
531
+ builder.withClientId(resolution.issuer ?? ((0, import_ssi_sdk_ext2.isManagedIdentifierDidResult)(resolution) ? resolution.did : resolution.jwkThumbprint), import_did_auth_siop.PropertyTarget.REQUEST_OBJECT).withClientIdScheme(resolution.clientIdScheme ?? identifierOpts.idOpts.clientIdScheme, import_did_auth_siop.PropertyTarget.REQUEST_OBJECT);
537
532
  }
538
533
  if (hasher) {
539
534
  builder.withHasher(hasher);
540
535
  }
536
+ if (definition) {
537
+ builder.withPresentationDefinition({
538
+ definition
539
+ }, import_did_auth_siop.PropertyTarget.REQUEST_OBJECT);
540
+ }
541
+ if (dcqlQuery) {
542
+ builder.withDcqlQuery(dcqlQuery);
543
+ }
541
544
  if (rpOpts.responseRedirectUri) {
542
545
  builder.withResponseRedirectUri(rpOpts.responseRedirectUri);
543
546
  }
@@ -594,32 +597,26 @@ function getSigningAlgo(type) {
594
597
  }
595
598
  }
596
599
  __name(getSigningAlgo, "getSigningAlgo");
597
- function prefixClientId(clientId) {
598
- if (clientId.startsWith("did:")) {
599
- return `${import_did_auth_siop.ClientIdentifierPrefix.DECENTRALIZED_IDENTIFIER}:${clientId}`;
600
- }
601
- return clientId;
602
- }
603
- __name(prefixClientId, "prefixClientId");
604
600
 
605
601
  // src/RPInstance.ts
606
- var import_uuid2 = require("uuid");
602
+ var import_uuid = require("uuid");
607
603
  var import_ssi_sdk_ext3 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
608
604
  var RPInstance = class {
609
605
  static {
610
606
  __name(this, "RPInstance");
611
607
  }
612
608
  _rp;
613
- _presentationOptions;
609
+ _pexOptions;
614
610
  _rpOptions;
615
611
  constructor({ rpOpts, pexOpts }) {
616
612
  this._rpOptions = rpOpts;
617
- this._presentationOptions = pexOpts;
613
+ this._pexOptions = pexOpts;
618
614
  }
619
615
  async get(context) {
620
616
  if (!this._rp) {
621
617
  const builder = await createRPBuilder({
622
618
  rpOpts: this._rpOptions,
619
+ pexOpts: this._pexOptions,
623
620
  context
624
621
  });
625
622
  this._rp = builder.build();
@@ -629,12 +626,24 @@ var RPInstance = class {
629
626
  get rpOptions() {
630
627
  return this._rpOptions;
631
628
  }
632
- get presentationOptions() {
633
- return this._presentationOptions;
629
+ get pexOptions() {
630
+ return this._pexOptions;
631
+ }
632
+ hasDefinition() {
633
+ return this.definitionId !== void 0;
634
+ }
635
+ get definitionId() {
636
+ return this.pexOptions?.definitionId;
637
+ }
638
+ async getPresentationDefinition(context) {
639
+ return this.definitionId ? await context.agent.pexStoreGetDefinition({
640
+ definitionId: this.definitionId,
641
+ tenantId: this.pexOptions?.tenantId
642
+ }) : void 0;
634
643
  }
635
644
  async createAuthorizationRequestURI(createArgs, context) {
636
- const { correlationId, queryId, claims, requestByReferenceURI, responseURI, responseURIType, callback, responseRedirectURI } = createArgs;
637
- const nonce = createArgs.nonce ?? (0, import_uuid2.v4)();
645
+ const { correlationId, claims, requestByReferenceURI, responseURI, responseURIType } = createArgs;
646
+ const nonce = createArgs.nonce ?? (0, import_uuid.v4)();
638
647
  const state = createArgs.state ?? correlationId;
639
648
  let jwtIssuer;
640
649
  const idOpts = this.rpOptions.identifierOpts.idOpts;
@@ -661,21 +670,18 @@ var RPInstance = class {
661
670
  return await this.get(context).then((rp) => rp.createAuthorizationRequestURI({
662
671
  version: getRequestVersion(this.rpOptions),
663
672
  correlationId,
664
- queryId,
665
673
  nonce,
666
674
  state,
667
675
  claims,
668
676
  requestByReferenceURI,
669
677
  responseURI,
670
678
  responseURIType,
671
- jwtIssuer,
672
- callback,
673
- responseRedirectURI
679
+ jwtIssuer
674
680
  }));
675
681
  }
676
682
  async createAuthorizationRequest(createArgs, context) {
677
- const { correlationId, claims, requestByReferenceURI, responseURI, responseURIType, responseRedirectURI } = createArgs;
678
- const nonce = createArgs.nonce ?? (0, import_uuid2.v4)();
683
+ const { correlationId, claims, requestByReferenceURI, responseURI, responseURIType } = createArgs;
684
+ const nonce = createArgs.nonce ?? (0, import_uuid.v4)();
679
685
  const state = createArgs.state ?? correlationId;
680
686
  const idOpts = this.rpOptions.identifierOpts.idOpts;
681
687
  const resolution = await (0, import_ssi_sdk_ext3.ensureManagedIdentifierResult)(idOpts, context);
@@ -705,13 +711,13 @@ var RPInstance = class {
705
711
  requestByReferenceURI,
706
712
  responseURIType,
707
713
  responseURI,
708
- jwtIssuer,
709
- responseRedirectURI
714
+ jwtIssuer
710
715
  }));
711
716
  }
712
717
  };
713
718
 
714
719
  // src/agent/SIOPv2RP.ts
720
+ var import_ssi_sdk2 = require("@sphereon/ssi-sdk.core");
715
721
  var SIOPv2RP = class _SIOPv2RP {
716
722
  static {
717
723
  __name(this, "SIOPv2RP");
@@ -719,7 +725,7 @@ var SIOPv2RP = class _SIOPv2RP {
719
725
  opts;
720
726
  static _DEFAULT_OPTS_KEY = "_default";
721
727
  instances = /* @__PURE__ */ new Map();
722
- schema = plugin_schema_default.IDidAuthSiopOpAuthenticator;
728
+ schema = schema.IDidAuthSiopOpAuthenticator;
723
729
  methods = {
724
730
  siopCreateAuthRequestURI: this.createAuthorizationRequestURI.bind(this),
725
731
  siopCreateAuthRequestPayloads: this.createAuthorizationRequestPayloads.bind(this),
@@ -749,72 +755,53 @@ var SIOPv2RP = class _SIOPv2RP {
749
755
  }
750
756
  async createAuthorizationRequestURI(createArgs, context) {
751
757
  return await this.getRPInstance({
752
- createWhenNotPresent: true,
753
- responseRedirectURI: createArgs.responseRedirectURI,
754
- ...createArgs.useQueryIdInstance === true && {
755
- queryId: createArgs.queryId
756
- }
758
+ definitionId: createArgs.definitionId,
759
+ responseRedirectURI: createArgs.responseRedirectURI
757
760
  }, context).then((rp) => rp.createAuthorizationRequestURI(createArgs, context)).then((URI) => URI.encodedUri);
758
761
  }
759
762
  async createAuthorizationRequestPayloads(createArgs, context) {
760
763
  return await this.getRPInstance({
761
- createWhenNotPresent: true,
762
- queryId: createArgs.queryId
764
+ definitionId: createArgs.definitionId
763
765
  }, context).then((rp) => rp.createAuthorizationRequest(createArgs, context)).then(async (request) => {
764
766
  const authRequest = {
765
767
  authorizationRequest: request.payload,
766
768
  requestObject: await request.requestObjectJwt(),
767
- requestObjectDecoded: request.requestObject?.getPayload()
769
+ requestObjectDecoded: await request.requestObject?.getPayload()
768
770
  };
769
771
  return authRequest;
770
772
  });
771
773
  }
772
774
  async siopGetRequestState(args, context) {
773
775
  return await this.getRPInstance({
774
- createWhenNotPresent: false,
775
- queryId: args.queryId
776
+ definitionId: args.definitionId
776
777
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.getRequestStateByCorrelationId(args.correlationId, args.errorOnNotFound)));
777
778
  }
778
779
  async siopGetResponseState(args, context) {
779
780
  const rpInstance = await this.getRPInstance({
780
- createWhenNotPresent: false,
781
- queryId: args.queryId
781
+ definitionId: args.definitionId
782
782
  }, context);
783
783
  const authorizationResponseState = await rpInstance.get(context).then((rp) => rp.sessionManager.getResponseStateByCorrelationId(args.correlationId, args.errorOnNotFound));
784
784
  if (authorizationResponseState === void 0) {
785
785
  return void 0;
786
786
  }
787
787
  const responseState = authorizationResponseState;
788
- if (responseState.status === import_did_auth_siop2.AuthorizationResponseStateStatus.VERIFIED) {
788
+ if (responseState.status === import_did_auth_siop2.AuthorizationResponseStateStatus.VERIFIED && args.includeVerifiedData && args.includeVerifiedData !== VerifiedDataMode.NONE) {
789
789
  let hasher;
790
790
  if (import_ssi_types2.CredentialMapper.isSdJwtEncoded(responseState.response.payload.vp_token) && (!rpInstance.rpOptions.credentialOpts?.hasher || typeof rpInstance.rpOptions.credentialOpts?.hasher !== "function")) {
791
791
  hasher = import_ssi_sdk2.shaHasher;
792
792
  }
793
- const vpToken = responseState.response.payload.vp_token && JSON.parse(responseState.response.payload.vp_token);
794
- const claims = [];
795
- for (const [credentialQueryId, presentationValue] of Object.entries(vpToken)) {
796
- let singleVP;
797
- if (Array.isArray(presentationValue)) {
798
- if (presentationValue.length === 0) {
799
- throw Error(`DCQL query '${credentialQueryId}' has empty array of presentations`);
800
- }
801
- if (presentationValue.length > 1) {
802
- throw Error(`DCQL query '${credentialQueryId}' has multiple presentations (${presentationValue.length}), but only one is supported atm`);
803
- }
804
- singleVP = presentationValue[0];
805
- } else {
806
- singleVP = presentationValue;
807
- }
808
- const presentationDecoded = import_ssi_types2.CredentialMapper.decodeVerifiablePresentation(
809
- singleVP,
810
- //todo: later we want to conditionally pass in options for mdl-mdoc here
811
- hasher
812
- );
813
- console.log(`presentationDecoded: ${JSON.stringify(presentationDecoded)}`);
814
- const allClaims = {};
815
- const presentationOrClaims = this.presentationOrClaimsFrom(presentationDecoded);
816
- if ("verifiableCredential" in presentationOrClaims) {
817
- for (const credential of presentationOrClaims.verifiableCredential) {
793
+ const presentationDecoded = import_ssi_types2.CredentialMapper.decodeVerifiablePresentation(
794
+ responseState.response.payload.vp_token,
795
+ //todo: later we want to conditionally pass in options for mdl-mdoc here
796
+ hasher
797
+ );
798
+ switch (args.includeVerifiedData) {
799
+ case VerifiedDataMode.VERIFIED_PRESENTATION:
800
+ responseState.response.payload.verifiedData = this.presentationOrClaimsFrom(presentationDecoded);
801
+ break;
802
+ case VerifiedDataMode.CREDENTIAL_SUBJECT_FLATTENED:
803
+ const allClaims = {};
804
+ for (const credential of this.presentationOrClaimsFrom(presentationDecoded).verifiableCredential || []) {
818
805
  const vc = credential;
819
806
  const schemaValidationResult = await context.agent.cvVerifySchema({
820
807
  credential,
@@ -835,43 +822,20 @@ var SIOPv2RP = class _SIOPv2RP {
835
822
  allClaims[key] = value;
836
823
  }
837
824
  });
838
- claims.push({
839
- id: credentialQueryId,
840
- type: vc.type[0],
841
- claims: allClaims
842
- });
843
825
  }
844
- } else {
845
- claims.push({
846
- id: credentialQueryId,
847
- type: presentationDecoded.decodedPayload.vct,
848
- claims: presentationOrClaims
849
- });
850
- }
826
+ responseState.verifiedData = allClaims;
827
+ break;
851
828
  }
852
- responseState.verifiedData = {
853
- ...responseState.response.payload.vp_token && {
854
- authorization_response: {
855
- vp_token: typeof responseState.response.payload.vp_token === "string" ? JSON.parse(responseState.response.payload.vp_token) : responseState.response.payload.vp_token
856
- }
857
- },
858
- ...claims.length > 0 && {
859
- credential_claims: claims
860
- }
861
- };
862
829
  }
863
830
  return responseState;
864
831
  }
865
- presentationOrClaimsFrom = /* @__PURE__ */ __name((presentationDecoded) => {
866
- return import_ssi_types2.CredentialMapper.isSdJwtDecodedCredential(presentationDecoded) ? presentationDecoded.decodedPayload : import_ssi_types2.CredentialMapper.toUniformPresentation(presentationDecoded);
867
- }, "presentationOrClaimsFrom");
832
+ presentationOrClaimsFrom = /* @__PURE__ */ __name((presentationDecoded) => import_ssi_types2.CredentialMapper.isSdJwtDecodedCredential(presentationDecoded) ? presentationDecoded.decodedPayload : import_ssi_types2.CredentialMapper.toUniformPresentation(presentationDecoded), "presentationOrClaimsFrom");
868
833
  async siopUpdateRequestState(args, context) {
869
- if (args.state !== "authorization_request_created") {
870
- throw Error(`Only 'authorization_request_created' status is supported for this method at this point`);
834
+ if (args.state !== "sent") {
835
+ throw Error(`Only 'sent' status is supported for this method at this point`);
871
836
  }
872
837
  return await this.getRPInstance({
873
- createWhenNotPresent: false,
874
- queryId: args.queryId
838
+ definitionId: args.definitionId
875
839
  }, context).then((rp) => rp.get(context).then(async (rp2) => {
876
840
  await rp2.signalAuthRequestRetrieved({
877
841
  correlationId: args.correlationId,
@@ -882,8 +846,7 @@ var SIOPv2RP = class _SIOPv2RP {
882
846
  }
883
847
  async siopDeleteState(args, context) {
884
848
  return await this.getRPInstance({
885
- createWhenNotPresent: false,
886
- queryId: args.queryId
849
+ definitionId: args.definitionId
887
850
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.deleteStateForCorrelationId(args.correlationId))).then(() => true);
888
851
  }
889
852
  async siopVerifyAuthResponse(args, context) {
@@ -892,27 +855,32 @@ var SIOPv2RP = class _SIOPv2RP {
892
855
  }
893
856
  const authResponse = typeof args.authorizationResponse === "string" ? (0, import_did_auth_siop2.decodeUriAsJson)(args.authorizationResponse) : args.authorizationResponse;
894
857
  return await this.getRPInstance({
895
- createWhenNotPresent: false,
896
- queryId: args.queryId
858
+ definitionId: args.definitionId
897
859
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.verifyAuthorizationResponse(authResponse, {
898
860
  correlationId: args.correlationId,
899
- ...args.dcqlQuery && {
861
+ ...args.presentationDefinitions && !args.dcqlQuery ? {
862
+ presentationDefinitions: args.presentationDefinitions
863
+ } : {},
864
+ ...args.dcqlQuery ? {
900
865
  dcqlQuery: args.dcqlQuery
901
- },
866
+ } : {},
902
867
  audience: args.audience
903
868
  })));
904
869
  }
905
870
  async siopImportDefinitions(args, context) {
906
- const { importItems, tenantId, version, versionControlMode } = args;
907
- await Promise.all(importItems.map(async (importItem) => {
908
- import_dcql.DcqlQuery.validate(importItem.query);
909
- console.log(`persisting DCQL definition ${importItem.queryId} with versionControlMode ${versionControlMode}`);
871
+ const { definitions, tenantId, version, versionControlMode } = args;
872
+ await Promise.all(definitions.map(async (definitionPair) => {
873
+ const definitionPayload = definitionPair.definitionPayload;
874
+ await context.agent.pexValidateDefinition({
875
+ definition: definitionPayload
876
+ });
877
+ console.log(`persisting definition ${definitionPayload.id} / ${definitionPayload.name} with versionControlMode ${versionControlMode}`);
910
878
  return context.agent.pdmPersistDefinition({
911
879
  definitionItem: {
912
- queryId: importItem.queryId,
913
880
  tenantId,
914
881
  version,
915
- query: importItem.query
882
+ definitionPayload,
883
+ dcqlPayload: definitionPair.dcqlPayload
916
884
  },
917
885
  opts: {
918
886
  versionControlMode
@@ -921,12 +889,12 @@ var SIOPv2RP = class _SIOPv2RP {
921
889
  }));
922
890
  }
923
891
  async siopGetRedirectURI(args, context) {
924
- const instanceId = args.queryId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
892
+ const instanceId = args.definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
925
893
  if (this.instances.has(instanceId)) {
926
894
  const rpInstance = this.instances.get(instanceId);
927
895
  if (rpInstance !== void 0) {
928
896
  const rp = await rpInstance.get(context);
929
- return await rp.getResponseRedirectUri({
897
+ return rp.getResponseRedirectUri({
930
898
  correlation_id: args.correlationId,
931
899
  correlationId: args.correlationId,
932
900
  ...args.state && {
@@ -937,40 +905,12 @@ var SIOPv2RP = class _SIOPv2RP {
937
905
  }
938
906
  return void 0;
939
907
  }
940
- async getRPInstance({ createWhenNotPresent, queryId, responseRedirectURI }, context) {
941
- let rpInstanceId = _SIOPv2RP._DEFAULT_OPTS_KEY;
942
- let rpInstance;
943
- if (queryId) {
944
- if (this.instances.has(queryId)) {
945
- rpInstanceId = queryId;
946
- rpInstance = this.instances.get(rpInstanceId);
947
- } else if ((0, import_uuid3.validate)(queryId)) {
948
- try {
949
- const pd = await context.agent.pdmGetDefinition({
950
- itemId: queryId
951
- });
952
- if (this.instances.has(pd.queryId)) {
953
- rpInstanceId = pd.queryId;
954
- rpInstance = this.instances.get(rpInstanceId);
955
- }
956
- } catch (ignore) {
957
- }
958
- }
959
- if (createWhenNotPresent) {
960
- rpInstanceId = queryId;
961
- } else {
962
- rpInstance = this.instances.get(rpInstanceId);
963
- }
964
- } else {
965
- rpInstance = this.instances.get(rpInstanceId);
966
- }
967
- if (!rpInstance) {
968
- if (!createWhenNotPresent) {
969
- return Promise.reject(`No RP instance found for key ${rpInstanceId}`);
970
- }
971
- const instanceOpts = this.getInstanceOpts(queryId);
908
+ async getRPInstance({ definitionId, responseRedirectURI }, context) {
909
+ const instanceId = definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
910
+ if (!this.instances.has(instanceId)) {
911
+ const instanceOpts = this.getInstanceOpts(definitionId);
972
912
  const rpOpts = await this.getRPOptions(context, {
973
- queryId,
913
+ definitionId,
974
914
  responseRedirectURI
975
915
  });
976
916
  if (!rpOpts.identifierOpts.resolveOpts?.resolver || typeof rpOpts.identifierOpts.resolveOpts.resolver.resolve !== "function") {
@@ -982,29 +922,29 @@ var SIOPv2RP = class _SIOPv2RP {
982
922
  ...rpOpts.identifierOpts.resolveOpts
983
923
  };
984
924
  }
985
- console.log("Using agent DID resolver for RP instance with definition id " + queryId);
925
+ console.log("Using agent DID resolver for RP instance with definition id " + definitionId);
986
926
  rpOpts.identifierOpts.resolveOpts.resolver = (0, import_ssi_sdk_ext4.getAgentResolver)(context, {
987
927
  uniresolverResolution: true,
988
928
  localResolution: true,
989
929
  resolverResolution: true
990
930
  });
991
931
  }
992
- rpInstance = new RPInstance({
932
+ this.instances.set(instanceId, new RPInstance({
993
933
  rpOpts,
994
934
  pexOpts: instanceOpts
995
- });
996
- this.instances.set(rpInstanceId, rpInstance);
935
+ }));
997
936
  }
937
+ const rpInstance = this.instances.get(instanceId);
998
938
  if (responseRedirectURI) {
999
939
  rpInstance.rpOptions.responseRedirectUri = responseRedirectURI;
1000
940
  }
1001
941
  return rpInstance;
1002
942
  }
1003
943
  async getRPOptions(context, opts) {
1004
- const { queryId, responseRedirectURI } = opts;
1005
- const options = this.getInstanceOpts(queryId)?.rpOpts ?? this.opts.defaultOpts;
944
+ const { definitionId, responseRedirectURI } = opts;
945
+ const options = this.getInstanceOpts(definitionId)?.rpOpts ?? this.opts.defaultOpts;
1006
946
  if (!options) {
1007
- throw Error(`Could not get specific nor default options for definition ${queryId}`);
947
+ throw Error(`Could not get specific nor default options for definition ${definitionId}`);
1008
948
  }
1009
949
  if (this.opts.defaultOpts) {
1010
950
  if (!options.identifierOpts) {
@@ -1036,24 +976,35 @@ var SIOPv2RP = class _SIOPv2RP {
1036
976
  }
1037
977
  return options;
1038
978
  }
1039
- getInstanceOpts(queryId) {
979
+ getInstanceOpts(definitionId) {
1040
980
  if (!this.opts.instanceOpts) return void 0;
1041
- const instanceOpt = queryId ? this.opts.instanceOpts.find((i) => i.queryId === queryId) : void 0;
1042
- return instanceOpt ?? this.getDefaultOptions(queryId);
981
+ const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.definitionId === definitionId) : void 0;
982
+ return instanceOpt ?? this.getDefaultOptions(definitionId);
1043
983
  }
1044
- getDefaultOptions(queryId) {
984
+ getDefaultOptions(definitionId) {
1045
985
  if (!this.opts.instanceOpts) return void 0;
1046
- const defaultOptions = this.opts.instanceOpts.find((i) => i.queryId === "default");
986
+ const defaultOptions = this.opts.instanceOpts.find((i) => i.definitionId === "default");
1047
987
  if (defaultOptions) {
1048
988
  const clonedOptions = {
1049
989
  ...defaultOptions
1050
990
  };
1051
- if (queryId !== void 0) {
1052
- clonedOptions.queryId = queryId;
991
+ if (definitionId !== void 0) {
992
+ clonedOptions.definitionId = definitionId;
1053
993
  }
1054
994
  return clonedOptions;
1055
995
  }
1056
996
  return void 0;
1057
997
  }
1058
998
  };
999
+
1000
+ // src/types/ISIOPv2RP.ts
1001
+ var VerifiedDataMode = /* @__PURE__ */ (function(VerifiedDataMode2) {
1002
+ VerifiedDataMode2["NONE"] = "none";
1003
+ VerifiedDataMode2["VERIFIED_PRESENTATION"] = "vp";
1004
+ VerifiedDataMode2["CREDENTIAL_SUBJECT_FLATTENED"] = "cs-flat";
1005
+ return VerifiedDataMode2;
1006
+ })({});
1007
+
1008
+ // src/index.ts
1009
+ var schema = require_plugin_schema();
1059
1010
  //# sourceMappingURL=index.cjs.map