@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth 0.34.1-feature.DIIPv4.144 → 0.34.1-feature.DIIPv4.156

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.js CHANGED
@@ -1,344 +1,336 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __commonJS = (cb, mod) => function __require() {
5
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
6
- };
7
3
 
8
4
  // plugin.schema.json
9
- var require_plugin_schema = __commonJS({
10
- "plugin.schema.json"(exports, module) {
11
- module.exports = {
12
- IDidAuthSiopOpAuthenticator: {
13
- components: {
14
- schemas: {
15
- IGetSiopSessionArgs: {
16
- type: "object",
17
- properties: {
18
- sessionId: {
19
- type: "string"
20
- },
21
- additionalProperties: false
22
- },
23
- required: ["sessionId"],
24
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSessionForSiop } "
5
+ var plugin_schema_default = {
6
+ IDidAuthSiopOpAuthenticator: {
7
+ components: {
8
+ schemas: {
9
+ IGetSiopSessionArgs: {
10
+ type: "object",
11
+ properties: {
12
+ sessionId: {
13
+ type: "string"
25
14
  },
26
- IRegisterSiopSessionArgs: {
15
+ additionalProperties: false
16
+ },
17
+ required: ["sessionId"],
18
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSessionForSiop } "
19
+ },
20
+ IRegisterSiopSessionArgs: {
21
+ type: "object",
22
+ properties: {
23
+ identifier: {
27
24
  type: "object",
28
25
  properties: {
29
- identifier: {
30
- type: "object",
31
- properties: {
32
- did: {
33
- type: "string"
34
- },
35
- alias: {
36
- type: "string"
37
- },
38
- provider: {
39
- type: "string"
40
- },
41
- controllerKeyId: {
42
- type: "string"
43
- },
44
- keys: {
45
- type: "array",
46
- items: {
47
- type: "object",
48
- properties: {
49
- additionalProperties: true
50
- }
51
- }
52
- },
53
- services: {
54
- type: "array",
55
- items: {
56
- type: "object",
57
- properties: {
58
- additionalProperties: true
59
- }
60
- }
61
- }
62
- },
63
- additionalProperties: false,
64
- required: ["did", "provider", "keys", "services"]
65
- },
66
- sessionId: {
26
+ did: {
67
27
  type: "string"
68
28
  },
69
- expiresIn: {
70
- type: "number"
71
- },
72
- additionalProperties: false
73
- },
74
- required: ["identifier"],
75
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.registerSessionForSiop } "
76
- },
77
- IRemoveSiopSessionArgs: {
78
- type: "object",
79
- properties: {
80
- sessionId: {
29
+ alias: {
81
30
  type: "string"
82
31
  },
83
- additionalProperties: false
84
- },
85
- required: ["sessionId"],
86
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.removeSessionForSiop } "
87
- },
88
- IAuthenticateWithSiopArgs: {
89
- type: "object",
90
- properties: {
91
- sessionId: {
32
+ provider: {
92
33
  type: "string"
93
34
  },
94
- stateId: {
35
+ controllerKeyId: {
95
36
  type: "string"
96
37
  },
97
- redirectUrl: {
98
- type: "string"
38
+ keys: {
39
+ type: "array",
40
+ items: {
41
+ type: "object",
42
+ properties: {
43
+ additionalProperties: true
44
+ }
45
+ }
99
46
  },
100
- additionalProperties: false
47
+ services: {
48
+ type: "array",
49
+ items: {
50
+ type: "object",
51
+ properties: {
52
+ additionalProperties: true
53
+ }
54
+ }
55
+ }
101
56
  },
102
- required: ["sessionId", "stateId", "redirectUrl"],
103
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } "
57
+ additionalProperties: false,
58
+ required: ["did", "provider", "keys", "services"]
59
+ },
60
+ sessionId: {
61
+ type: "string"
62
+ },
63
+ expiresIn: {
64
+ type: "number"
65
+ },
66
+ additionalProperties: false
67
+ },
68
+ required: ["identifier"],
69
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.registerSessionForSiop } "
70
+ },
71
+ IRemoveSiopSessionArgs: {
72
+ type: "object",
73
+ properties: {
74
+ sessionId: {
75
+ type: "string"
76
+ },
77
+ additionalProperties: false
78
+ },
79
+ required: ["sessionId"],
80
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.removeSessionForSiop } "
81
+ },
82
+ IAuthenticateWithSiopArgs: {
83
+ type: "object",
84
+ properties: {
85
+ sessionId: {
86
+ type: "string"
104
87
  },
105
- IResponse: {
88
+ stateId: {
89
+ type: "string"
90
+ },
91
+ redirectUrl: {
92
+ type: "string"
93
+ },
94
+ additionalProperties: false
95
+ },
96
+ required: ["sessionId", "stateId", "redirectUrl"],
97
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } "
98
+ },
99
+ IResponse: {
100
+ type: "object",
101
+ properties: {
102
+ status: {
103
+ type: "number"
104
+ },
105
+ additionalProperties: true
106
+ },
107
+ required: ["status"],
108
+ description: "Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
109
+ },
110
+ IGetSiopAuthenticationRequestFromRpArgs: {
111
+ type: "object",
112
+ properties: {
113
+ sessionId: {
114
+ type: "string"
115
+ },
116
+ stateId: {
117
+ type: "string"
118
+ },
119
+ redirectUrl: {
120
+ type: "string"
121
+ },
122
+ additionalProperties: false
123
+ },
124
+ required: ["sessionId", "stateId", "redirectUrl"],
125
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
126
+ },
127
+ ParsedAuthenticationRequestURI: {
128
+ type: "object",
129
+ properties: {
130
+ jwt: {
131
+ type: "string"
132
+ },
133
+ requestPayload: {
106
134
  type: "object",
107
135
  properties: {
108
- status: {
109
- type: "number"
110
- },
111
136
  additionalProperties: true
112
- },
113
- required: ["status"],
114
- description: "Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
137
+ }
115
138
  },
116
- IGetSiopAuthenticationRequestFromRpArgs: {
139
+ registration: {
117
140
  type: "object",
118
141
  properties: {
119
- sessionId: {
120
- type: "string"
121
- },
122
- stateId: {
123
- type: "string"
124
- },
125
- redirectUrl: {
126
- type: "string"
127
- },
128
- additionalProperties: false
129
- },
130
- required: ["sessionId", "stateId", "redirectUrl"],
131
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
142
+ additionalProperties: true
143
+ }
132
144
  },
133
- ParsedAuthenticationRequestURI: {
145
+ additionalProperties: false
146
+ },
147
+ required: ["jwt", "requestPayload", "registration"],
148
+ description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
149
+ },
150
+ IGetSiopAuthenticationRequestDetailsArgs: {
151
+ type: "object",
152
+ properties: {
153
+ sessionId: {
154
+ type: "string"
155
+ },
156
+ verifiedAuthenticationRequest: {
134
157
  type: "object",
135
158
  properties: {
136
- jwt: {
137
- type: "string"
138
- },
139
- requestPayload: {
140
- type: "object",
141
- properties: {
142
- additionalProperties: true
143
- }
144
- },
145
- registration: {
146
- type: "object",
147
- properties: {
148
- additionalProperties: true
149
- }
150
- },
151
- additionalProperties: false
152
- },
153
- required: ["jwt", "requestPayload", "registration"],
154
- description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
159
+ additionalProperties: true
160
+ }
155
161
  },
156
- IGetSiopAuthenticationRequestDetailsArgs: {
162
+ credentialFilter: {
157
163
  type: "object",
158
164
  properties: {
159
- sessionId: {
160
- type: "string"
161
- },
162
- verifiedAuthenticationRequest: {
163
- type: "object",
164
- properties: {
165
- additionalProperties: true
166
- }
167
- },
168
- credentialFilter: {
169
- type: "object",
170
- properties: {
171
- additionalProperties: true
172
- }
173
- },
174
- additionalProperties: false
175
- },
176
- required: ["sessionId", "verifiedAuthenticationRequest"],
177
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
165
+ additionalProperties: true
166
+ }
167
+ },
168
+ additionalProperties: false
169
+ },
170
+ required: ["sessionId", "verifiedAuthenticationRequest"],
171
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
172
+ },
173
+ IAuthRequestDetails: {
174
+ type: "object",
175
+ properties: {
176
+ id: {
177
+ type: "string"
178
+ },
179
+ alsoKnownAs: {
180
+ type: "array",
181
+ items: {
182
+ type: "string"
183
+ }
178
184
  },
179
- IAuthRequestDetails: {
185
+ vpResponseOpts: {
180
186
  type: "object",
181
187
  properties: {
182
- id: {
183
- type: "string"
184
- },
185
- alsoKnownAs: {
186
- type: "array",
187
- items: {
188
- type: "string"
189
- }
190
- },
191
- vpResponseOpts: {
192
- type: "object",
193
- properties: {
194
- additionalProperties: true
195
- }
196
- },
197
- additionalProperties: false
198
- },
199
- required: ["id", "vpResponseOpts"],
200
- description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
188
+ additionalProperties: true
189
+ }
201
190
  },
202
- IVerifySiopAuthenticationRequestUriArgs: {
191
+ additionalProperties: false
192
+ },
193
+ required: ["id", "vpResponseOpts"],
194
+ description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
195
+ },
196
+ IVerifySiopAuthenticationRequestUriArgs: {
197
+ type: "object",
198
+ properties: {
199
+ sessionId: {
200
+ type: "string"
201
+ },
202
+ ParsedAuthenticationRequestURI: {
203
203
  type: "object",
204
204
  properties: {
205
- sessionId: {
206
- type: "string"
207
- },
208
- ParsedAuthenticationRequestURI: {
209
- type: "object",
210
- properties: {
211
- additionalProperties: true
212
- }
213
- },
214
- additionalProperties: false
215
- },
216
- required: ["sessionId", "ParsedAuthenticationRequestURI"],
217
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
205
+ additionalProperties: true
206
+ }
218
207
  },
219
- VerifiedAuthorizationRequest: {
208
+ additionalProperties: false
209
+ },
210
+ required: ["sessionId", "ParsedAuthenticationRequestURI"],
211
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
212
+ },
213
+ VerifiedAuthorizationRequest: {
214
+ type: "object",
215
+ properties: {
216
+ payload: {
220
217
  type: "object",
221
218
  properties: {
222
- payload: {
223
- type: "object",
224
- properties: {
225
- additionalProperties: true
226
- }
227
- },
228
- presentationDefinitions: {
229
- type: "object",
230
- properties: {
231
- additionalProperties: true
232
- }
233
- },
234
- verifyOpts: {
235
- type: "object",
236
- properties: {
237
- additionalProperties: true
238
- }
239
- },
240
- additionalProperties: false
241
- },
242
- required: ["payload", "verifyOpts"],
243
- description: "Result of {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
219
+ additionalProperties: true
220
+ }
244
221
  },
245
- ISendSiopAuthenticationResponseArgs: {
222
+ presentationDefinitions: {
246
223
  type: "object",
247
224
  properties: {
248
- sessionId: {
249
- type: "string"
250
- },
251
- verifiedAuthenticationRequest: {
252
- type: "object",
253
- properties: {
254
- additionalProperties: true
255
- }
256
- },
257
- verifiablePresentationResponse: {
258
- type: "object",
259
- properties: {
260
- additionalProperties: true
261
- }
262
- },
263
- additionalProperties: false
264
- },
265
- required: ["sessionId", "verifiedAuthenticationRequest"],
266
- description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
267
- }
268
- },
269
- methods: {
270
- getSessionForSiop: {
271
- description: "Get SIOP session",
272
- arguments: {
273
- $ref: "#/components/schemas/IGetSiopSessionArgs"
274
- },
275
- returnType: "object"
276
- },
277
- registerSessionForSiop: {
278
- description: "Register SIOP session",
279
- arguments: {
280
- $ref: "#/components/schemas/IRegisterSiopSessionArgs"
281
- },
282
- returnType: "object"
283
- },
284
- removeSessionForSiop: {
285
- description: "Remove SIOP session",
286
- arguments: {
287
- $ref: "#/components/schemas/IRemoveSiopSessionArgs"
288
- },
289
- returnType: "boolean"
290
- },
291
- authenticateWithSiop: {
292
- description: "Authenticate using DID Auth SIOP",
293
- arguments: {
294
- $ref: "#/components/schemas/IAuthenticateWithSiopArgs"
295
- },
296
- returnType: {
297
- $ref: "#/components/schemas/Response"
225
+ additionalProperties: true
298
226
  }
299
227
  },
300
- getSiopAuthenticationRequestFromRP: {
301
- description: "Get authentication request from RP",
302
- arguments: {
303
- $ref: "#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs"
304
- },
305
- returnType: {
306
- $ref: "#/components/schemas/ParsedAuthenticationRequestURI"
228
+ verifyOpts: {
229
+ type: "object",
230
+ properties: {
231
+ additionalProperties: true
307
232
  }
308
233
  },
309
- getSiopAuthenticationRequestDetails: {
310
- description: "Get authentication request details",
311
- arguments: {
312
- $ref: "#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs"
313
- },
314
- returnType: {
315
- $ref: "#/components/schemas/IAuthRequestDetails"
316
- }
234
+ additionalProperties: false
235
+ },
236
+ required: ["payload", "verifyOpts"],
237
+ description: "Result of {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
238
+ },
239
+ ISendSiopAuthenticationResponseArgs: {
240
+ type: "object",
241
+ properties: {
242
+ sessionId: {
243
+ type: "string"
317
244
  },
318
- verifySiopAuthenticationRequestURI: {
319
- description: "Verify authentication request URI",
320
- arguments: {
321
- $ref: "#/components/schemas/IVerifySiopAuthenticationRequestUriArgs"
322
- },
323
- returnType: {
324
- $ref: "#/components/schemas/VerifiedAuthorizationRequest"
245
+ verifiedAuthenticationRequest: {
246
+ type: "object",
247
+ properties: {
248
+ additionalProperties: true
325
249
  }
326
250
  },
327
- sendSiopAuthenticationResponse: {
328
- description: "Send authentication response",
329
- arguments: {
330
- $ref: "#/components/schemas/ISendSiopAuthenticationResponseArgs"
331
- },
332
- returnType: {
333
- $ref: "#/components/schemas/IRequiredContext"
251
+ verifiablePresentationResponse: {
252
+ type: "object",
253
+ properties: {
254
+ additionalProperties: true
334
255
  }
335
- }
256
+ },
257
+ additionalProperties: false
258
+ },
259
+ required: ["sessionId", "verifiedAuthenticationRequest"],
260
+ description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
261
+ }
262
+ },
263
+ methods: {
264
+ getSessionForSiop: {
265
+ description: "Get SIOP session",
266
+ arguments: {
267
+ $ref: "#/components/schemas/IGetSiopSessionArgs"
268
+ },
269
+ returnType: "object"
270
+ },
271
+ registerSessionForSiop: {
272
+ description: "Register SIOP session",
273
+ arguments: {
274
+ $ref: "#/components/schemas/IRegisterSiopSessionArgs"
275
+ },
276
+ returnType: "object"
277
+ },
278
+ removeSessionForSiop: {
279
+ description: "Remove SIOP session",
280
+ arguments: {
281
+ $ref: "#/components/schemas/IRemoveSiopSessionArgs"
282
+ },
283
+ returnType: "boolean"
284
+ },
285
+ authenticateWithSiop: {
286
+ description: "Authenticate using DID Auth SIOP",
287
+ arguments: {
288
+ $ref: "#/components/schemas/IAuthenticateWithSiopArgs"
289
+ },
290
+ returnType: {
291
+ $ref: "#/components/schemas/Response"
292
+ }
293
+ },
294
+ getSiopAuthenticationRequestFromRP: {
295
+ description: "Get authentication request from RP",
296
+ arguments: {
297
+ $ref: "#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs"
298
+ },
299
+ returnType: {
300
+ $ref: "#/components/schemas/ParsedAuthenticationRequestURI"
301
+ }
302
+ },
303
+ getSiopAuthenticationRequestDetails: {
304
+ description: "Get authentication request details",
305
+ arguments: {
306
+ $ref: "#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs"
307
+ },
308
+ returnType: {
309
+ $ref: "#/components/schemas/IAuthRequestDetails"
310
+ }
311
+ },
312
+ verifySiopAuthenticationRequestURI: {
313
+ description: "Verify authentication request URI",
314
+ arguments: {
315
+ $ref: "#/components/schemas/IVerifySiopAuthenticationRequestUriArgs"
316
+ },
317
+ returnType: {
318
+ $ref: "#/components/schemas/VerifiedAuthorizationRequest"
319
+ }
320
+ },
321
+ sendSiopAuthenticationResponse: {
322
+ description: "Send authentication response",
323
+ arguments: {
324
+ $ref: "#/components/schemas/ISendSiopAuthenticationResponseArgs"
325
+ },
326
+ returnType: {
327
+ $ref: "#/components/schemas/IRequiredContext"
336
328
  }
337
329
  }
338
330
  }
339
- };
331
+ }
340
332
  }
341
- });
333
+ };
342
334
 
343
335
  // src/agent/SIOPv2RP.ts
344
336
  import { AuthorizationResponseStateStatus, decodeUriAsJson } from "@sphereon/did-auth-siop";
@@ -416,11 +408,11 @@ async function createRPBuilder(args) {
416
408
  const { identifierOpts } = rpOpts;
417
409
  let definition = args.definition;
418
410
  let dcqlQuery = args.dcql;
419
- if (!definition && pexOpts && pexOpts.definitionId) {
411
+ if (!definition && pexOpts && pexOpts.queryId) {
420
412
  const presentationDefinitionItems = await context.agent.pdmGetDefinitions({
421
413
  filter: [
422
414
  {
423
- definitionId: pexOpts.definitionId,
415
+ definitionId: pexOpts.queryId,
424
416
  version: pexOpts.version,
425
417
  tenantId: pexOpts.tenantId
426
418
  }
@@ -602,7 +594,7 @@ var RPInstance = class {
602
594
  return this.definitionId !== void 0;
603
595
  }
604
596
  get definitionId() {
605
- return this.pexOptions?.definitionId;
597
+ return this.pexOptions?.queryId;
606
598
  }
607
599
  async getPresentationDefinition(context) {
608
600
  return this.definitionId ? await context.agent.pexStoreGetDefinition({
@@ -611,7 +603,7 @@ var RPInstance = class {
611
603
  }) : void 0;
612
604
  }
613
605
  async createAuthorizationRequestURI(createArgs, context) {
614
- const { correlationId, claims, requestByReferenceURI, responseURI, responseURIType } = createArgs;
606
+ const { correlationId, queryId, claims, requestByReferenceURI, responseURI, responseURIType, callback } = createArgs;
615
607
  const nonce = createArgs.nonce ?? uuidv4();
616
608
  const state = createArgs.state ?? correlationId;
617
609
  let jwtIssuer;
@@ -639,13 +631,15 @@ var RPInstance = class {
639
631
  return await this.get(context).then((rp) => rp.createAuthorizationRequestURI({
640
632
  version: getRequestVersion(this.rpOptions),
641
633
  correlationId,
634
+ queryId,
642
635
  nonce,
643
636
  state,
644
637
  claims,
645
638
  requestByReferenceURI,
646
639
  responseURI,
647
640
  responseURIType,
648
- jwtIssuer
641
+ jwtIssuer,
642
+ callback
649
643
  }));
650
644
  }
651
645
  async createAuthorizationRequest(createArgs, context) {
@@ -694,7 +688,7 @@ var SIOPv2RP = class _SIOPv2RP {
694
688
  opts;
695
689
  static _DEFAULT_OPTS_KEY = "_default";
696
690
  instances = /* @__PURE__ */ new Map();
697
- schema = schema.IDidAuthSiopOpAuthenticator;
691
+ schema = plugin_schema_default.IDidAuthSiopOpAuthenticator;
698
692
  methods = {
699
693
  siopCreateAuthRequestURI: this.createAuthorizationRequestURI.bind(this),
700
694
  siopCreateAuthRequestPayloads: this.createAuthorizationRequestPayloads.bind(this),
@@ -724,30 +718,32 @@ var SIOPv2RP = class _SIOPv2RP {
724
718
  }
725
719
  async createAuthorizationRequestURI(createArgs, context) {
726
720
  return await this.getRPInstance({
727
- definitionId: createArgs.definitionId,
728
- responseRedirectURI: createArgs.responseRedirectURI
721
+ responseRedirectURI: createArgs.responseRedirectURI,
722
+ ...createArgs.useQueryIdInstance === true && {
723
+ queryId: createArgs.queryId
724
+ }
729
725
  }, context).then((rp) => rp.createAuthorizationRequestURI(createArgs, context)).then((URI) => URI.encodedUri);
730
726
  }
731
727
  async createAuthorizationRequestPayloads(createArgs, context) {
732
728
  return await this.getRPInstance({
733
- definitionId: createArgs.definitionId
729
+ queryId: createArgs.queryId
734
730
  }, context).then((rp) => rp.createAuthorizationRequest(createArgs, context)).then(async (request) => {
735
731
  const authRequest = {
736
732
  authorizationRequest: request.payload,
737
733
  requestObject: await request.requestObjectJwt(),
738
- requestObjectDecoded: await request.requestObject?.getPayload()
734
+ requestObjectDecoded: request.requestObject?.getPayload()
739
735
  };
740
736
  return authRequest;
741
737
  });
742
738
  }
743
739
  async siopGetRequestState(args, context) {
744
740
  return await this.getRPInstance({
745
- definitionId: args.definitionId
741
+ queryId: args.queryId
746
742
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.getRequestStateByCorrelationId(args.correlationId, args.errorOnNotFound)));
747
743
  }
748
744
  async siopGetResponseState(args, context) {
749
745
  const rpInstance = await this.getRPInstance({
750
- definitionId: args.definitionId
746
+ queryId: args.queryId
751
747
  }, context);
752
748
  const authorizationResponseState = await rpInstance.get(context).then((rp) => rp.sessionManager.getResponseStateByCorrelationId(args.correlationId, args.errorOnNotFound));
753
749
  if (authorizationResponseState === void 0) {
@@ -800,11 +796,11 @@ var SIOPv2RP = class _SIOPv2RP {
800
796
  }
801
797
  presentationOrClaimsFrom = /* @__PURE__ */ __name((presentationDecoded) => CredentialMapper2.isSdJwtDecodedCredential(presentationDecoded) ? presentationDecoded.decodedPayload : CredentialMapper2.toUniformPresentation(presentationDecoded), "presentationOrClaimsFrom");
802
798
  async siopUpdateRequestState(args, context) {
803
- if (args.state !== "sent") {
804
- throw Error(`Only 'sent' status is supported for this method at this point`);
799
+ if (args.state !== "authorization_request_created") {
800
+ throw Error(`Only 'authorization_request_created' status is supported for this method at this point`);
805
801
  }
806
802
  return await this.getRPInstance({
807
- definitionId: args.definitionId
803
+ queryId: args.queryId
808
804
  }, context).then((rp) => rp.get(context).then(async (rp2) => {
809
805
  await rp2.signalAuthRequestRetrieved({
810
806
  correlationId: args.correlationId,
@@ -815,7 +811,7 @@ var SIOPv2RP = class _SIOPv2RP {
815
811
  }
816
812
  async siopDeleteState(args, context) {
817
813
  return await this.getRPInstance({
818
- definitionId: args.definitionId
814
+ queryId: args.queryId
819
815
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.deleteStateForCorrelationId(args.correlationId))).then(() => true);
820
816
  }
821
817
  async siopVerifyAuthResponse(args, context) {
@@ -824,7 +820,7 @@ var SIOPv2RP = class _SIOPv2RP {
824
820
  }
825
821
  const authResponse = typeof args.authorizationResponse === "string" ? decodeUriAsJson(args.authorizationResponse) : args.authorizationResponse;
826
822
  return await this.getRPInstance({
827
- definitionId: args.definitionId
823
+ queryId: args.queryId
828
824
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.verifyAuthorizationResponse(authResponse, {
829
825
  correlationId: args.correlationId,
830
826
  ...args.dcqlQueryPayload ? {
@@ -834,8 +830,8 @@ var SIOPv2RP = class _SIOPv2RP {
834
830
  })));
835
831
  }
836
832
  async siopImportDefinitions(args, context) {
837
- const { definitions, tenantId, version, versionControlMode } = args;
838
- await Promise.all(definitions.map(async (definitionPair) => {
833
+ const { queries, tenantId, version, versionControlMode } = args;
834
+ await Promise.all(queries.map(async (definitionPair) => {
839
835
  const definitionPayload = definitionPair.definitionPayload;
840
836
  if (!definitionPayload && !definitionPair.dcqlPayload) {
841
837
  return Promise.reject(Error("Either dcqlPayload or definitionPayload must be suppplied"));
@@ -868,7 +864,7 @@ var SIOPv2RP = class _SIOPv2RP {
868
864
  }));
869
865
  }
870
866
  async siopGetRedirectURI(args, context) {
871
- const instanceId = args.definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
867
+ const instanceId = args.queryId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
872
868
  if (this.instances.has(instanceId)) {
873
869
  const rpInstance = this.instances.get(instanceId);
874
870
  if (rpInstance !== void 0) {
@@ -884,12 +880,12 @@ var SIOPv2RP = class _SIOPv2RP {
884
880
  }
885
881
  return void 0;
886
882
  }
887
- async getRPInstance({ definitionId, responseRedirectURI }, context) {
888
- const instanceId = definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
883
+ async getRPInstance({ queryId, responseRedirectURI }, context) {
884
+ const instanceId = queryId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
889
885
  if (!this.instances.has(instanceId)) {
890
- const instanceOpts = this.getInstanceOpts(definitionId);
886
+ const instanceOpts = this.getInstanceOpts(queryId);
891
887
  const rpOpts = await this.getRPOptions(context, {
892
- definitionId,
888
+ queryId,
893
889
  responseRedirectURI
894
890
  });
895
891
  if (!rpOpts.identifierOpts.resolveOpts?.resolver || typeof rpOpts.identifierOpts.resolveOpts.resolver.resolve !== "function") {
@@ -901,7 +897,7 @@ var SIOPv2RP = class _SIOPv2RP {
901
897
  ...rpOpts.identifierOpts.resolveOpts
902
898
  };
903
899
  }
904
- console.log("Using agent DID resolver for RP instance with definition id " + definitionId);
900
+ console.log("Using agent DID resolver for RP instance with definition id " + queryId);
905
901
  rpOpts.identifierOpts.resolveOpts.resolver = getAgentResolver2(context, {
906
902
  uniresolverResolution: true,
907
903
  localResolution: true,
@@ -920,10 +916,10 @@ var SIOPv2RP = class _SIOPv2RP {
920
916
  return rpInstance;
921
917
  }
922
918
  async getRPOptions(context, opts) {
923
- const { definitionId, responseRedirectURI } = opts;
924
- const options = this.getInstanceOpts(definitionId)?.rpOpts ?? this.opts.defaultOpts;
919
+ const { queryId, responseRedirectURI } = opts;
920
+ const options = this.getInstanceOpts(queryId)?.rpOpts ?? this.opts.defaultOpts;
925
921
  if (!options) {
926
- throw Error(`Could not get specific nor default options for definition ${definitionId}`);
922
+ throw Error(`Could not get specific nor default options for definition ${queryId}`);
927
923
  }
928
924
  if (this.opts.defaultOpts) {
929
925
  if (!options.identifierOpts) {
@@ -957,18 +953,18 @@ var SIOPv2RP = class _SIOPv2RP {
957
953
  }
958
954
  getInstanceOpts(definitionId) {
959
955
  if (!this.opts.instanceOpts) return void 0;
960
- const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.definitionId === definitionId) : void 0;
956
+ const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.queryId === definitionId) : void 0;
961
957
  return instanceOpt ?? this.getDefaultOptions(definitionId);
962
958
  }
963
959
  getDefaultOptions(definitionId) {
964
960
  if (!this.opts.instanceOpts) return void 0;
965
- const defaultOptions = this.opts.instanceOpts.find((i) => i.definitionId === "default");
961
+ const defaultOptions = this.opts.instanceOpts.find((i) => i.queryId === "default");
966
962
  if (defaultOptions) {
967
963
  const clonedOptions = {
968
964
  ...defaultOptions
969
965
  };
970
966
  if (definitionId !== void 0) {
971
- clonedOptions.definitionId = definitionId;
967
+ clonedOptions.queryId = definitionId;
972
968
  }
973
969
  return clonedOptions;
974
970
  }
@@ -983,12 +979,9 @@ var VerifiedDataMode = /* @__PURE__ */ (function(VerifiedDataMode2) {
983
979
  VerifiedDataMode2["CREDENTIAL_SUBJECT_FLATTENED"] = "cs-flat";
984
980
  return VerifiedDataMode2;
985
981
  })({});
986
-
987
- // src/index.ts
988
- var schema = require_plugin_schema();
989
982
  export {
990
983
  SIOPv2RP,
991
984
  VerifiedDataMode,
992
- schema
985
+ plugin_schema_default as schema
993
986
  };
994
987
  //# sourceMappingURL=index.js.map