@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth 0.34.1-feature.SSISDK.26.RP.57 → 0.34.1-feature.SSISDK.45.135

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,9 +4,6 @@ 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
- };
10
7
  var __export = (target, all) => {
11
8
  for (var name in all)
12
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -21,354 +18,351 @@ var __copyProps = (to, from, except, desc) => {
21
18
  };
22
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
20
 
21
+ // src/index.ts
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
+ SIOPv2RP: () => SIOPv2RP,
25
+ VerifiedDataMode: () => VerifiedDataMode,
26
+ schema: () => plugin_schema_default
27
+ });
28
+ module.exports = __toCommonJS(index_exports);
29
+
24
30
  // plugin.schema.json
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 } "
31
+ var plugin_schema_default = {
32
+ IDidAuthSiopOpAuthenticator: {
33
+ components: {
34
+ schemas: {
35
+ IGetSiopSessionArgs: {
36
+ type: "object",
37
+ properties: {
38
+ sessionId: {
39
+ type: "string"
41
40
  },
42
- IRegisterSiopSessionArgs: {
41
+ additionalProperties: false
42
+ },
43
+ required: ["sessionId"],
44
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSessionForSiop } "
45
+ },
46
+ IRegisterSiopSessionArgs: {
47
+ type: "object",
48
+ properties: {
49
+ identifier: {
43
50
  type: "object",
44
51
  properties: {
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
+ did: {
83
53
  type: "string"
84
54
  },
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
+ alias: {
97
56
  type: "string"
98
57
  },
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
+ provider: {
108
59
  type: "string"
109
60
  },
110
- stateId: {
61
+ controllerKeyId: {
111
62
  type: "string"
112
63
  },
113
- redirectUrl: {
114
- type: "string"
64
+ keys: {
65
+ type: "array",
66
+ items: {
67
+ type: "object",
68
+ properties: {
69
+ additionalProperties: true
70
+ }
71
+ }
115
72
  },
116
- additionalProperties: false
73
+ services: {
74
+ type: "array",
75
+ items: {
76
+ type: "object",
77
+ properties: {
78
+ additionalProperties: true
79
+ }
80
+ }
81
+ }
117
82
  },
118
- required: ["sessionId", "stateId", "redirectUrl"],
119
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } "
83
+ additionalProperties: false,
84
+ required: ["did", "provider", "keys", "services"]
85
+ },
86
+ sessionId: {
87
+ type: "string"
88
+ },
89
+ expiresIn: {
90
+ type: "number"
91
+ },
92
+ additionalProperties: false
93
+ },
94
+ required: ["identifier"],
95
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.registerSessionForSiop } "
96
+ },
97
+ IRemoveSiopSessionArgs: {
98
+ type: "object",
99
+ properties: {
100
+ sessionId: {
101
+ type: "string"
102
+ },
103
+ additionalProperties: false
104
+ },
105
+ required: ["sessionId"],
106
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.removeSessionForSiop } "
107
+ },
108
+ IAuthenticateWithSiopArgs: {
109
+ type: "object",
110
+ properties: {
111
+ sessionId: {
112
+ type: "string"
113
+ },
114
+ stateId: {
115
+ type: "string"
116
+ },
117
+ redirectUrl: {
118
+ type: "string"
119
+ },
120
+ additionalProperties: false
121
+ },
122
+ required: ["sessionId", "stateId", "redirectUrl"],
123
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } "
124
+ },
125
+ IResponse: {
126
+ type: "object",
127
+ properties: {
128
+ status: {
129
+ type: "number"
130
+ },
131
+ additionalProperties: true
132
+ },
133
+ required: ["status"],
134
+ description: "Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
135
+ },
136
+ IGetSiopAuthenticationRequestFromRpArgs: {
137
+ type: "object",
138
+ properties: {
139
+ sessionId: {
140
+ type: "string"
141
+ },
142
+ stateId: {
143
+ type: "string"
120
144
  },
121
- IResponse: {
145
+ redirectUrl: {
146
+ type: "string"
147
+ },
148
+ additionalProperties: false
149
+ },
150
+ required: ["sessionId", "stateId", "redirectUrl"],
151
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
152
+ },
153
+ ParsedAuthenticationRequestURI: {
154
+ type: "object",
155
+ properties: {
156
+ jwt: {
157
+ type: "string"
158
+ },
159
+ requestPayload: {
122
160
  type: "object",
123
161
  properties: {
124
- status: {
125
- type: "number"
126
- },
127
162
  additionalProperties: true
128
- },
129
- required: ["status"],
130
- description: "Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
163
+ }
131
164
  },
132
- IGetSiopAuthenticationRequestFromRpArgs: {
165
+ registration: {
133
166
  type: "object",
134
167
  properties: {
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 } "
168
+ additionalProperties: true
169
+ }
148
170
  },
149
- ParsedAuthenticationRequestURI: {
171
+ additionalProperties: false
172
+ },
173
+ required: ["jwt", "requestPayload", "registration"],
174
+ description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
175
+ },
176
+ IGetSiopAuthenticationRequestDetailsArgs: {
177
+ type: "object",
178
+ properties: {
179
+ sessionId: {
180
+ type: "string"
181
+ },
182
+ verifiedAuthenticationRequest: {
150
183
  type: "object",
151
184
  properties: {
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 } "
185
+ additionalProperties: true
186
+ }
171
187
  },
172
- IGetSiopAuthenticationRequestDetailsArgs: {
188
+ credentialFilter: {
173
189
  type: "object",
174
190
  properties: {
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 } "
191
+ additionalProperties: true
192
+ }
193
+ },
194
+ additionalProperties: false
195
+ },
196
+ required: ["sessionId", "verifiedAuthenticationRequest"],
197
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
198
+ },
199
+ IAuthRequestDetails: {
200
+ type: "object",
201
+ properties: {
202
+ id: {
203
+ type: "string"
204
+ },
205
+ alsoKnownAs: {
206
+ type: "array",
207
+ items: {
208
+ type: "string"
209
+ }
194
210
  },
195
- IAuthRequestDetails: {
211
+ vpResponseOpts: {
196
212
  type: "object",
197
213
  properties: {
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 } "
214
+ additionalProperties: true
215
+ }
217
216
  },
218
- IVerifySiopAuthenticationRequestUriArgs: {
217
+ additionalProperties: false
218
+ },
219
+ required: ["id", "vpResponseOpts"],
220
+ description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
221
+ },
222
+ IVerifySiopAuthenticationRequestUriArgs: {
223
+ type: "object",
224
+ properties: {
225
+ sessionId: {
226
+ type: "string"
227
+ },
228
+ ParsedAuthenticationRequestURI: {
219
229
  type: "object",
220
230
  properties: {
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 } "
231
+ additionalProperties: true
232
+ }
234
233
  },
235
- VerifiedAuthorizationRequest: {
234
+ additionalProperties: false
235
+ },
236
+ required: ["sessionId", "ParsedAuthenticationRequestURI"],
237
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
238
+ },
239
+ VerifiedAuthorizationRequest: {
240
+ type: "object",
241
+ properties: {
242
+ payload: {
236
243
  type: "object",
237
244
  properties: {
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 } "
245
+ additionalProperties: true
246
+ }
260
247
  },
261
- ISendSiopAuthenticationResponseArgs: {
248
+ presentationDefinitions: {
262
249
  type: "object",
263
250
  properties: {
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"
292
- },
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"
251
+ additionalProperties: true
314
252
  }
315
253
  },
316
- getSiopAuthenticationRequestFromRP: {
317
- description: "Get authentication request from RP",
318
- arguments: {
319
- $ref: "#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs"
320
- },
321
- returnType: {
322
- $ref: "#/components/schemas/ParsedAuthenticationRequestURI"
254
+ verifyOpts: {
255
+ type: "object",
256
+ properties: {
257
+ additionalProperties: true
323
258
  }
324
259
  },
325
- getSiopAuthenticationRequestDetails: {
326
- description: "Get authentication request details",
327
- arguments: {
328
- $ref: "#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs"
329
- },
330
- returnType: {
331
- $ref: "#/components/schemas/IAuthRequestDetails"
332
- }
260
+ additionalProperties: false
261
+ },
262
+ required: ["payload", "verifyOpts"],
263
+ description: "Result of {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
264
+ },
265
+ ISendSiopAuthenticationResponseArgs: {
266
+ type: "object",
267
+ properties: {
268
+ sessionId: {
269
+ type: "string"
333
270
  },
334
- verifySiopAuthenticationRequestURI: {
335
- description: "Verify authentication request URI",
336
- arguments: {
337
- $ref: "#/components/schemas/IVerifySiopAuthenticationRequestUriArgs"
338
- },
339
- returnType: {
340
- $ref: "#/components/schemas/VerifiedAuthorizationRequest"
271
+ verifiedAuthenticationRequest: {
272
+ type: "object",
273
+ properties: {
274
+ additionalProperties: true
341
275
  }
342
276
  },
343
- sendSiopAuthenticationResponse: {
344
- description: "Send authentication response",
345
- arguments: {
346
- $ref: "#/components/schemas/ISendSiopAuthenticationResponseArgs"
347
- },
348
- returnType: {
349
- $ref: "#/components/schemas/IRequiredContext"
277
+ verifiablePresentationResponse: {
278
+ type: "object",
279
+ properties: {
280
+ additionalProperties: true
350
281
  }
351
- }
282
+ },
283
+ additionalProperties: false
284
+ },
285
+ required: ["sessionId", "verifiedAuthenticationRequest"],
286
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
287
+ }
288
+ },
289
+ methods: {
290
+ getSessionForSiop: {
291
+ description: "Get SIOP session",
292
+ arguments: {
293
+ $ref: "#/components/schemas/IGetSiopSessionArgs"
294
+ },
295
+ returnType: "object"
296
+ },
297
+ registerSessionForSiop: {
298
+ description: "Register SIOP session",
299
+ arguments: {
300
+ $ref: "#/components/schemas/IRegisterSiopSessionArgs"
301
+ },
302
+ returnType: "object"
303
+ },
304
+ removeSessionForSiop: {
305
+ description: "Remove SIOP session",
306
+ arguments: {
307
+ $ref: "#/components/schemas/IRemoveSiopSessionArgs"
308
+ },
309
+ returnType: "boolean"
310
+ },
311
+ authenticateWithSiop: {
312
+ description: "Authenticate using DID Auth SIOP",
313
+ arguments: {
314
+ $ref: "#/components/schemas/IAuthenticateWithSiopArgs"
315
+ },
316
+ returnType: {
317
+ $ref: "#/components/schemas/Response"
318
+ }
319
+ },
320
+ getSiopAuthenticationRequestFromRP: {
321
+ description: "Get authentication request from RP",
322
+ arguments: {
323
+ $ref: "#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs"
324
+ },
325
+ returnType: {
326
+ $ref: "#/components/schemas/ParsedAuthenticationRequestURI"
327
+ }
328
+ },
329
+ getSiopAuthenticationRequestDetails: {
330
+ description: "Get authentication request details",
331
+ arguments: {
332
+ $ref: "#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs"
333
+ },
334
+ returnType: {
335
+ $ref: "#/components/schemas/IAuthRequestDetails"
336
+ }
337
+ },
338
+ verifySiopAuthenticationRequestURI: {
339
+ description: "Verify authentication request URI",
340
+ arguments: {
341
+ $ref: "#/components/schemas/IVerifySiopAuthenticationRequestUriArgs"
342
+ },
343
+ returnType: {
344
+ $ref: "#/components/schemas/VerifiedAuthorizationRequest"
345
+ }
346
+ },
347
+ sendSiopAuthenticationResponse: {
348
+ description: "Send authentication response",
349
+ arguments: {
350
+ $ref: "#/components/schemas/ISendSiopAuthenticationResponseArgs"
351
+ },
352
+ returnType: {
353
+ $ref: "#/components/schemas/IRequiredContext"
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
361
  // src/agent/SIOPv2RP.ts
369
362
  var import_did_auth_siop2 = require("@sphereon/did-auth-siop");
370
363
  var import_ssi_sdk_ext4 = require("@sphereon/ssi-sdk-ext.did-utils");
371
364
  var import_ssi_types2 = require("@sphereon/ssi-types");
365
+ var import_dcql = require("dcql");
372
366
 
373
367
  // src/functions.ts
374
368
  var import_did_auth_siop = require("@sphereon/did-auth-siop");
@@ -441,11 +435,11 @@ async function createRPBuilder(args) {
441
435
  const { identifierOpts } = rpOpts;
442
436
  let definition = args.definition;
443
437
  let dcqlQuery = args.dcql;
444
- if (!definition && pexOpts && pexOpts.definitionId) {
438
+ if (!definition && pexOpts && pexOpts.queryId) {
445
439
  const presentationDefinitionItems = await context.agent.pdmGetDefinitions({
446
440
  filter: [
447
441
  {
448
- definitionId: pexOpts.definitionId,
442
+ definitionId: pexOpts.queryId,
449
443
  version: pexOpts.version,
450
444
  tenantId: pexOpts.tenantId
451
445
  }
@@ -633,7 +627,7 @@ var RPInstance = class {
633
627
  return this.definitionId !== void 0;
634
628
  }
635
629
  get definitionId() {
636
- return this.pexOptions?.definitionId;
630
+ return this.pexOptions?.queryId;
637
631
  }
638
632
  async getPresentationDefinition(context) {
639
633
  return this.definitionId ? await context.agent.pexStoreGetDefinition({
@@ -642,7 +636,7 @@ var RPInstance = class {
642
636
  }) : void 0;
643
637
  }
644
638
  async createAuthorizationRequestURI(createArgs, context) {
645
- const { correlationId, claims, requestByReferenceURI, responseURI, responseURIType } = createArgs;
639
+ const { correlationId, queryId, claims, requestByReferenceURI, responseURI, responseURIType, callback } = createArgs;
646
640
  const nonce = createArgs.nonce ?? (0, import_uuid.v4)();
647
641
  const state = createArgs.state ?? correlationId;
648
642
  let jwtIssuer;
@@ -670,13 +664,15 @@ var RPInstance = class {
670
664
  return await this.get(context).then((rp) => rp.createAuthorizationRequestURI({
671
665
  version: getRequestVersion(this.rpOptions),
672
666
  correlationId,
667
+ queryId,
673
668
  nonce,
674
669
  state,
675
670
  claims,
676
671
  requestByReferenceURI,
677
672
  responseURI,
678
673
  responseURIType,
679
- jwtIssuer
674
+ jwtIssuer,
675
+ callback
680
676
  }));
681
677
  }
682
678
  async createAuthorizationRequest(createArgs, context) {
@@ -725,7 +721,7 @@ var SIOPv2RP = class _SIOPv2RP {
725
721
  opts;
726
722
  static _DEFAULT_OPTS_KEY = "_default";
727
723
  instances = /* @__PURE__ */ new Map();
728
- schema = schema.IDidAuthSiopOpAuthenticator;
724
+ schema = plugin_schema_default.IDidAuthSiopOpAuthenticator;
729
725
  methods = {
730
726
  siopCreateAuthRequestURI: this.createAuthorizationRequestURI.bind(this),
731
727
  siopCreateAuthRequestPayloads: this.createAuthorizationRequestPayloads.bind(this),
@@ -755,30 +751,32 @@ var SIOPv2RP = class _SIOPv2RP {
755
751
  }
756
752
  async createAuthorizationRequestURI(createArgs, context) {
757
753
  return await this.getRPInstance({
758
- definitionId: createArgs.definitionId,
759
- responseRedirectURI: createArgs.responseRedirectURI
754
+ responseRedirectURI: createArgs.responseRedirectURI,
755
+ ...createArgs.useQueryIdInstance === true && {
756
+ queryId: createArgs.queryId
757
+ }
760
758
  }, context).then((rp) => rp.createAuthorizationRequestURI(createArgs, context)).then((URI) => URI.encodedUri);
761
759
  }
762
760
  async createAuthorizationRequestPayloads(createArgs, context) {
763
761
  return await this.getRPInstance({
764
- definitionId: createArgs.definitionId
762
+ queryId: createArgs.queryId
765
763
  }, context).then((rp) => rp.createAuthorizationRequest(createArgs, context)).then(async (request) => {
766
764
  const authRequest = {
767
765
  authorizationRequest: request.payload,
768
766
  requestObject: await request.requestObjectJwt(),
769
- requestObjectDecoded: await request.requestObject?.getPayload()
767
+ requestObjectDecoded: request.requestObject?.getPayload()
770
768
  };
771
769
  return authRequest;
772
770
  });
773
771
  }
774
772
  async siopGetRequestState(args, context) {
775
773
  return await this.getRPInstance({
776
- definitionId: args.definitionId
774
+ queryId: args.queryId
777
775
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.getRequestStateByCorrelationId(args.correlationId, args.errorOnNotFound)));
778
776
  }
779
777
  async siopGetResponseState(args, context) {
780
778
  const rpInstance = await this.getRPInstance({
781
- definitionId: args.definitionId
779
+ queryId: args.queryId
782
780
  }, context);
783
781
  const authorizationResponseState = await rpInstance.get(context).then((rp) => rp.sessionManager.getResponseStateByCorrelationId(args.correlationId, args.errorOnNotFound));
784
782
  if (authorizationResponseState === void 0) {
@@ -831,11 +829,11 @@ var SIOPv2RP = class _SIOPv2RP {
831
829
  }
832
830
  presentationOrClaimsFrom = /* @__PURE__ */ __name((presentationDecoded) => import_ssi_types2.CredentialMapper.isSdJwtDecodedCredential(presentationDecoded) ? presentationDecoded.decodedPayload : import_ssi_types2.CredentialMapper.toUniformPresentation(presentationDecoded), "presentationOrClaimsFrom");
833
831
  async siopUpdateRequestState(args, context) {
834
- if (args.state !== "sent") {
835
- throw Error(`Only 'sent' status is supported for this method at this point`);
832
+ if (args.state !== "authorization_request_created") {
833
+ throw Error(`Only 'authorization_request_created' status is supported for this method at this point`);
836
834
  }
837
835
  return await this.getRPInstance({
838
- definitionId: args.definitionId
836
+ queryId: args.queryId
839
837
  }, context).then((rp) => rp.get(context).then(async (rp2) => {
840
838
  await rp2.signalAuthRequestRetrieved({
841
839
  correlationId: args.correlationId,
@@ -846,7 +844,7 @@ var SIOPv2RP = class _SIOPv2RP {
846
844
  }
847
845
  async siopDeleteState(args, context) {
848
846
  return await this.getRPInstance({
849
- definitionId: args.definitionId
847
+ queryId: args.queryId
850
848
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.deleteStateForCorrelationId(args.correlationId))).then(() => true);
851
849
  }
852
850
  async siopVerifyAuthResponse(args, context) {
@@ -855,28 +853,38 @@ var SIOPv2RP = class _SIOPv2RP {
855
853
  }
856
854
  const authResponse = typeof args.authorizationResponse === "string" ? (0, import_did_auth_siop2.decodeUriAsJson)(args.authorizationResponse) : args.authorizationResponse;
857
855
  return await this.getRPInstance({
858
- definitionId: args.definitionId
856
+ queryId: args.queryId
859
857
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.verifyAuthorizationResponse(authResponse, {
860
858
  correlationId: args.correlationId,
861
- ...args.presentationDefinitions && !args.dcqlQuery ? {
862
- presentationDefinitions: args.presentationDefinitions
863
- } : {},
864
- ...args.dcqlQuery ? {
865
- dcqlQuery: args.dcqlQuery
859
+ ...args.dcqlQueryPayload ? {
860
+ dcqlQuery: args.dcqlQueryPayload.dcqlQuery
866
861
  } : {},
867
862
  audience: args.audience
868
863
  })));
869
864
  }
870
865
  async siopImportDefinitions(args, context) {
871
- const { definitions, tenantId, version, versionControlMode } = args;
872
- await Promise.all(definitions.map(async (definitionPair) => {
866
+ const { queries, tenantId, version, versionControlMode } = args;
867
+ await Promise.all(queries.map(async (definitionPair) => {
873
868
  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}`);
869
+ if (!definitionPayload && !definitionPair.dcqlPayload) {
870
+ return Promise.reject(Error("Either dcqlPayload or definitionPayload must be suppplied"));
871
+ }
872
+ let definitionId;
873
+ if (definitionPair.dcqlPayload) {
874
+ import_dcql.DcqlQuery.validate(definitionPair.dcqlPayload.dcqlQuery);
875
+ console.log(`persisting DCQL definition ${definitionPair.dcqlPayload.queryId} with versionControlMode ${versionControlMode}`);
876
+ definitionId = definitionPair.dcqlPayload.queryId;
877
+ }
878
+ if (definitionPayload) {
879
+ await context.agent.pexValidateDefinition({
880
+ definition: definitionPayload
881
+ });
882
+ console.log(`persisting PEX definition ${definitionPayload.id} / ${definitionPayload.name} with versionControlMode ${versionControlMode}`);
883
+ definitionId = definitionPayload.id;
884
+ }
878
885
  return context.agent.pdmPersistDefinition({
879
886
  definitionItem: {
887
+ definitionId,
880
888
  tenantId,
881
889
  version,
882
890
  definitionPayload,
@@ -889,7 +897,7 @@ var SIOPv2RP = class _SIOPv2RP {
889
897
  }));
890
898
  }
891
899
  async siopGetRedirectURI(args, context) {
892
- const instanceId = args.definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
900
+ const instanceId = args.queryId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
893
901
  if (this.instances.has(instanceId)) {
894
902
  const rpInstance = this.instances.get(instanceId);
895
903
  if (rpInstance !== void 0) {
@@ -905,12 +913,12 @@ var SIOPv2RP = class _SIOPv2RP {
905
913
  }
906
914
  return void 0;
907
915
  }
908
- async getRPInstance({ definitionId, responseRedirectURI }, context) {
909
- const instanceId = definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
916
+ async getRPInstance({ queryId, responseRedirectURI }, context) {
917
+ const instanceId = queryId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
910
918
  if (!this.instances.has(instanceId)) {
911
- const instanceOpts = this.getInstanceOpts(definitionId);
919
+ const instanceOpts = this.getInstanceOpts(queryId);
912
920
  const rpOpts = await this.getRPOptions(context, {
913
- definitionId,
921
+ queryId,
914
922
  responseRedirectURI
915
923
  });
916
924
  if (!rpOpts.identifierOpts.resolveOpts?.resolver || typeof rpOpts.identifierOpts.resolveOpts.resolver.resolve !== "function") {
@@ -922,7 +930,7 @@ var SIOPv2RP = class _SIOPv2RP {
922
930
  ...rpOpts.identifierOpts.resolveOpts
923
931
  };
924
932
  }
925
- console.log("Using agent DID resolver for RP instance with definition id " + definitionId);
933
+ console.log("Using agent DID resolver for RP instance with definition id " + queryId);
926
934
  rpOpts.identifierOpts.resolveOpts.resolver = (0, import_ssi_sdk_ext4.getAgentResolver)(context, {
927
935
  uniresolverResolution: true,
928
936
  localResolution: true,
@@ -941,10 +949,10 @@ var SIOPv2RP = class _SIOPv2RP {
941
949
  return rpInstance;
942
950
  }
943
951
  async getRPOptions(context, opts) {
944
- const { definitionId, responseRedirectURI } = opts;
945
- const options = this.getInstanceOpts(definitionId)?.rpOpts ?? this.opts.defaultOpts;
952
+ const { queryId, responseRedirectURI } = opts;
953
+ const options = this.getInstanceOpts(queryId)?.rpOpts ?? this.opts.defaultOpts;
946
954
  if (!options) {
947
- throw Error(`Could not get specific nor default options for definition ${definitionId}`);
955
+ throw Error(`Could not get specific nor default options for definition ${queryId}`);
948
956
  }
949
957
  if (this.opts.defaultOpts) {
950
958
  if (!options.identifierOpts) {
@@ -978,18 +986,18 @@ var SIOPv2RP = class _SIOPv2RP {
978
986
  }
979
987
  getInstanceOpts(definitionId) {
980
988
  if (!this.opts.instanceOpts) return void 0;
981
- const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.definitionId === definitionId) : void 0;
989
+ const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.queryId === definitionId) : void 0;
982
990
  return instanceOpt ?? this.getDefaultOptions(definitionId);
983
991
  }
984
992
  getDefaultOptions(definitionId) {
985
993
  if (!this.opts.instanceOpts) return void 0;
986
- const defaultOptions = this.opts.instanceOpts.find((i) => i.definitionId === "default");
994
+ const defaultOptions = this.opts.instanceOpts.find((i) => i.queryId === "default");
987
995
  if (defaultOptions) {
988
996
  const clonedOptions = {
989
997
  ...defaultOptions
990
998
  };
991
999
  if (definitionId !== void 0) {
992
- clonedOptions.definitionId = definitionId;
1000
+ clonedOptions.queryId = definitionId;
993
1001
  }
994
1002
  return clonedOptions;
995
1003
  }
@@ -1004,7 +1012,4 @@ var VerifiedDataMode = /* @__PURE__ */ function(VerifiedDataMode2) {
1004
1012
  VerifiedDataMode2["CREDENTIAL_SUBJECT_FLATTENED"] = "cs-flat";
1005
1013
  return VerifiedDataMode2;
1006
1014
  }({});
1007
-
1008
- // src/index.ts
1009
- var schema = require_plugin_schema();
1010
1015
  //# sourceMappingURL=index.cjs.map