@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth 0.34.1-fix.171 → 0.34.1-fix.223

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.d.ts CHANGED
@@ -9,12 +9,13 @@ import { IIdentifierResolution, ManagedIdentifierOptsOrResult, ExternalIdentifie
9
9
  import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
10
10
  import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation';
11
11
  import { ImDLMdoc } from '@sphereon/ssi-sdk.mdl-mdoc';
12
- import { IPDManager, VersionControlMode } from '@sphereon/ssi-sdk.pd-manager';
12
+ import { IPDManager, ImportDcqlQueryItem, VersionControlMode } from '@sphereon/ssi-sdk.pd-manager';
13
13
  import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange';
14
14
  import { ISDJwtPlugin } from '@sphereon/ssi-sdk.sd-jwt';
15
15
  import { AuthorizationRequestStateStatus } from '@sphereon/ssi-sdk.siopv2-oid4vp-common';
16
- import { DcqlQueryPayload, HasherSync } from '@sphereon/ssi-types';
16
+ import { HasherSync } from '@sphereon/ssi-types';
17
17
  import { VerifyCallback } from '@sphereon/wellknown-dids-client';
18
+ import { DcqlQuery } from 'dcql';
18
19
  import { Resolvable } from 'did-resolver';
19
20
  import { EventEmitter } from 'events';
20
21
 
@@ -389,11 +390,6 @@ var plugin_schema = {
389
390
  IDidAuthSiopOpAuthenticator: IDidAuthSiopOpAuthenticator
390
391
  };
391
392
 
392
- declare enum VerifiedDataMode {
393
- NONE = "none",
394
- VERIFIED_PRESENTATION = "vp",
395
- CREDENTIAL_SUBJECT_FLATTENED = "cs-flat"
396
- }
397
393
  interface ISIOPv2RP extends IPluginMethodMap {
398
394
  siopCreateAuthRequestURI(createArgs: ICreateAuthRequestArgs, context: IRequiredContext): Promise<string>;
399
395
  siopCreateAuthRequestPayloads(createArgs: ICreateAuthRequestArgs, context: IRequiredContext): Promise<IAuthorizationRequestPayloads>;
@@ -451,14 +447,10 @@ interface IVerifyAuthResponseStateArgs {
451
447
  queryId?: string;
452
448
  correlationId: string;
453
449
  audience?: string;
454
- dcqlQueryPayload?: DcqlQueryPayload;
455
- }
456
- interface IDefinitionPair {
457
- definitionPayload?: IPresentationDefinition;
458
- dcqlPayload?: DcqlQueryPayload;
450
+ dcqlQuery?: DcqlQuery;
459
451
  }
460
452
  interface ImportDefinitionsArgs {
461
- queries: Array<IDefinitionPair>;
453
+ importItems: Array<ImportDcqlQueryItem>;
462
454
  tenantId?: string;
463
455
  version?: string;
464
456
  versionControlMode?: VersionControlMode;
@@ -478,10 +470,11 @@ interface IPEXDefinitionPersistArgs extends IPEXInstanceOptions {
478
470
  ttl?: number;
479
471
  }
480
472
  interface ISiopRPInstanceArgs {
473
+ createWhenNotPresent: boolean;
481
474
  queryId?: string;
482
475
  responseRedirectURI?: string;
483
476
  }
484
- interface IPEXInstanceOptions extends IPEXOptions {
477
+ interface IPEXInstanceOptions extends IPresentationOptions {
485
478
  rpOpts?: IRPOptions;
486
479
  }
487
480
  interface IRPOptions {
@@ -497,11 +490,9 @@ interface IRPOptions {
497
490
  verifyJwtCallback?: VerifyJwtCallback;
498
491
  responseRedirectUri?: string;
499
492
  }
500
- interface IPEXOptions {
501
- presentationVerifyCallback?: PresentationVerificationCallback;
493
+ interface IPresentationOptions {
502
494
  queryId: string;
503
- version?: string;
504
- tenantId?: string;
495
+ presentationVerifyCallback?: PresentationVerificationCallback;
505
496
  }
506
497
  type VerificationPolicies = {
507
498
  schemaValidation: SchemaValidation;
@@ -528,18 +519,15 @@ type IRequiredContext = IAgentContext<IResolver & IDIDManager & IKeyManager & II
528
519
 
529
520
  declare class RPInstance {
530
521
  private _rp;
531
- private readonly _pexOptions;
522
+ private readonly _presentationOptions;
532
523
  private readonly _rpOptions;
533
524
  constructor({ rpOpts, pexOpts }: {
534
525
  rpOpts: IRPOptions;
535
- pexOpts?: IPEXOptions;
526
+ pexOpts?: IPresentationOptions;
536
527
  });
537
528
  get(context: IRequiredContext): Promise<RP>;
538
529
  get rpOptions(): IRPOptions;
539
- get pexOptions(): IPEXOptions | undefined;
540
- hasDefinition(): boolean;
541
- get definitionId(): string | undefined;
542
- getPresentationDefinition(context: IRequiredContext): Promise<IPresentationDefinition | undefined>;
530
+ get presentationOptions(): IPresentationOptions | undefined;
543
531
  createAuthorizationRequestURI(createArgs: ICreateAuthRequestArgs, context: IRequiredContext): Promise<URI>;
544
532
  createAuthorizationRequest(createArgs: Omit<ICreateAuthRequestArgs, 'queryId'>, context: IRequiredContext): Promise<AuthorizationRequest>;
545
533
  }
@@ -888,13 +876,13 @@ declare class SIOPv2RP implements IAgentPlugin {
888
876
  private siopVerifyAuthResponse;
889
877
  private siopImportDefinitions;
890
878
  private siopGetRedirectURI;
891
- getRPInstance({ queryId, responseRedirectURI }: ISiopRPInstanceArgs, context: IRequiredContext): Promise<RPInstance>;
879
+ getRPInstance({ createWhenNotPresent, queryId, responseRedirectURI }: ISiopRPInstanceArgs, context: IRequiredContext): Promise<RPInstance>;
892
880
  getRPOptions(context: IRequiredContext, opts: {
893
881
  queryId?: string;
894
882
  responseRedirectURI?: string;
895
883
  }): Promise<IRPOptions>;
896
- getInstanceOpts(definitionId?: string): IPEXInstanceOptions | undefined;
884
+ getInstanceOpts(queryId?: string): IPEXInstanceOptions | undefined;
897
885
  private getDefaultOptions;
898
886
  }
899
887
 
900
- export { type CredentialOpts, type IAuthRequestDetails, type IAuthorizationRequestPayloads, type ICreateAuthRequestArgs, type IDefinitionPair, type IDeleteAuthStateArgs, type IGetAuthRequestStateArgs, type IGetAuthResponseStateArgs, type IGetRedirectUriArgs, type IPEXDefinitionPersistArgs, type IPEXInstanceOptions, type IPEXOptions, type IRPDefaultOpts, type IRPOptions, type IRequiredContext, type ISIOPIdentifierOptions, type ISIOPv2RP, type ISiopRPInstanceArgs, type ISiopv2RPOpts, type IUpdateRequestStateArgs, type IVerifyAuthResponseStateArgs, type ImportDefinitionsArgs, type PerDidResolver, SIOPv2RP, type VerificationPolicies, VerifiedDataMode, plugin_schema as schema };
888
+ export { type CredentialOpts, type IAuthRequestDetails, type IAuthorizationRequestPayloads, type ICreateAuthRequestArgs, type IDeleteAuthStateArgs, type IGetAuthRequestStateArgs, type IGetAuthResponseStateArgs, type IGetRedirectUriArgs, type IPEXDefinitionPersistArgs, type IPEXInstanceOptions, type IPresentationOptions, type IRPDefaultOpts, type IRPOptions, type IRequiredContext, type ISIOPIdentifierOptions, type ISIOPv2RP, type ISiopRPInstanceArgs, type ISiopv2RPOpts, type IUpdateRequestStateArgs, type IVerifyAuthResponseStateArgs, type ImportDefinitionsArgs, type PerDidResolver, SIOPv2RP, type VerificationPolicies, plugin_schema as schema };
package/dist/index.js CHANGED
@@ -336,8 +336,9 @@ var plugin_schema_default = {
336
336
  import { AuthorizationResponseStateStatus, decodeUriAsJson } from "@sphereon/did-auth-siop";
337
337
  import { getAgentResolver as getAgentResolver2 } from "@sphereon/ssi-sdk-ext.did-utils";
338
338
  import { shaHasher as defaultHasher2 } from "@sphereon/ssi-sdk.core";
339
+ import { validate as isValidUUID } from "uuid";
339
340
  import { CredentialMapper as CredentialMapper2 } from "@sphereon/ssi-types";
340
- import { DcqlPresentation, DcqlQuery } from "dcql";
341
+ import { DcqlQuery } from "dcql";
341
342
 
342
343
  // src/functions.ts
343
344
  import { ClientIdentifierPrefix, InMemoryRPSessionManager, PassBy, PropertyTarget, ResponseMode, ResponseType, RevocationVerification, RP, Scope, SubjectType, SupportedVersion } from "@sphereon/did-auth-siop";
@@ -351,7 +352,7 @@ function getRequestVersion(rpOptions) {
351
352
  if (Array.isArray(rpOptions.supportedVersions) && rpOptions.supportedVersions.length > 0) {
352
353
  return rpOptions.supportedVersions[0];
353
354
  }
354
- return SupportedVersion.JWT_VC_PRESENTATION_PROFILE_v1;
355
+ return SupportedVersion.OID4VP_v1;
355
356
  }
356
357
  __name(getRequestVersion, "getRequestVersion");
357
358
  function getWellKnownDIDVerifyCallback(siopIdentifierOpts, context) {
@@ -366,6 +367,33 @@ function getWellKnownDIDVerifyCallback(siopIdentifierOpts, context) {
366
367
  };
367
368
  }
368
369
  __name(getWellKnownDIDVerifyCallback, "getWellKnownDIDVerifyCallback");
370
+ function getDcqlQueryLookupCallback(context) {
371
+ async function dcqlQueryLookup(queryId, version, tenantId) {
372
+ const result = await context.agent.pdmGetDefinitions({
373
+ filter: [
374
+ {
375
+ queryId,
376
+ ...tenantId && {
377
+ tenantId
378
+ },
379
+ ...version && {
380
+ version
381
+ }
382
+ },
383
+ {
384
+ id: queryId
385
+ }
386
+ ]
387
+ });
388
+ if (result && result.length > 0) {
389
+ return result[0].query;
390
+ }
391
+ return Promise.reject(Error(`No dcql query found for queryId ${queryId}`));
392
+ }
393
+ __name(dcqlQueryLookup, "dcqlQueryLookup");
394
+ return dcqlQueryLookup;
395
+ }
396
+ __name(getDcqlQueryLookupCallback, "getDcqlQueryLookupCallback");
369
397
  function getPresentationVerificationCallback(idOpts, context) {
370
398
  async function presentationVerificationCallback(args, presentationSubmission) {
371
399
  if (CredentialMapper.isSdJwtEncoded(args)) {
@@ -405,27 +433,8 @@ function getPresentationVerificationCallback(idOpts, context) {
405
433
  }
406
434
  __name(getPresentationVerificationCallback, "getPresentationVerificationCallback");
407
435
  async function createRPBuilder(args) {
408
- const { rpOpts, pexOpts, context } = args;
436
+ const { rpOpts, context } = args;
409
437
  const { identifierOpts } = rpOpts;
410
- let definition = args.definition;
411
- let dcqlQuery = args.dcql;
412
- if (!definition && pexOpts && pexOpts.queryId) {
413
- const presentationDefinitionItems = await context.agent.pdmGetDefinitions({
414
- filter: [
415
- {
416
- definitionId: pexOpts.queryId,
417
- version: pexOpts.version,
418
- tenantId: pexOpts.tenantId
419
- }
420
- ]
421
- });
422
- if (presentationDefinitionItems.length > 0) {
423
- const presentationDefinitionItem = presentationDefinitionItems[0];
424
- if (!dcqlQuery && presentationDefinitionItem.dcqlPayload) {
425
- dcqlQuery = presentationDefinitionItem.dcqlPayload.dcqlQuery;
426
- }
427
- }
428
- }
429
438
  const didMethods = identifierOpts.supportedDIDMethods ?? await getAgentDIDMethods(context);
430
439
  const eventEmitter = rpOpts.eventEmitter ?? new EventEmitter();
431
440
  const defaultClientMetadata = {
@@ -480,16 +489,15 @@ async function createRPBuilder(args) {
480
489
  const builder = RP.builder({
481
490
  requestVersion: getRequestVersion(rpOpts)
482
491
  }).withScope("openid", PropertyTarget.REQUEST_OBJECT).withResponseMode(rpOpts.responseMode ?? ResponseMode.POST).withResponseType(ResponseType.VP_TOKEN, PropertyTarget.REQUEST_OBJECT).withSupportedVersions(rpOpts.supportedVersions ?? [
483
- SupportedVersion.JWT_VC_PRESENTATION_PROFILE_v1,
484
- SupportedVersion.SIOPv2_ID1,
485
- SupportedVersion.SIOPv2_D11
492
+ SupportedVersion.OID4VP_v1,
493
+ SupportedVersion.SIOPv2_OID4VP_D28
486
494
  ]).withEventEmitter(eventEmitter).withSessionManager(rpOpts.sessionManager ?? new InMemoryRPSessionManager(eventEmitter)).withClientMetadata(rpOpts.clientMetadataOpts ?? defaultClientMetadata, PropertyTarget.REQUEST_OBJECT).withVerifyJwtCallback(rpOpts.verifyJwtCallback ? rpOpts.verifyJwtCallback : getVerifyJwtCallback({
487
495
  resolver,
488
496
  verifyOpts: {
489
497
  wellknownDIDVerifyCallback: getWellKnownDIDVerifyCallback(rpOpts.identifierOpts, context),
490
498
  checkLinkedDomain: "if_present"
491
499
  }
492
- }, context)).withRevocationVerification(RevocationVerification.NEVER).withPresentationVerification(getPresentationVerificationCallback(identifierOpts.idOpts, context));
500
+ }, context)).withDcqlQueryLookup(getDcqlQueryLookupCallback(context)).withRevocationVerification(RevocationVerification.NEVER).withPresentationVerification(getPresentationVerificationCallback(identifierOpts.idOpts, context));
493
501
  const oidfOpts = identifierOpts.oidfOpts;
494
502
  if (oidfOpts && isExternalIdentifierOIDFEntityIdOpts(oidfOpts)) {
495
503
  builder.withEntityId(oidfOpts.identifier, PropertyTarget.REQUEST_OBJECT);
@@ -502,9 +510,6 @@ async function createRPBuilder(args) {
502
510
  if (hasher) {
503
511
  builder.withHasher(hasher);
504
512
  }
505
- if (dcqlQuery) {
506
- builder.withDcqlQuery(dcqlQuery);
507
- }
508
513
  if (rpOpts.responseRedirectUri) {
509
514
  builder.withResponseRedirectUri(rpOpts.responseRedirectUri);
510
515
  }
@@ -577,17 +582,16 @@ var RPInstance = class {
577
582
  __name(this, "RPInstance");
578
583
  }
579
584
  _rp;
580
- _pexOptions;
585
+ _presentationOptions;
581
586
  _rpOptions;
582
587
  constructor({ rpOpts, pexOpts }) {
583
588
  this._rpOptions = rpOpts;
584
- this._pexOptions = pexOpts;
589
+ this._presentationOptions = pexOpts;
585
590
  }
586
591
  async get(context) {
587
592
  if (!this._rp) {
588
593
  const builder = await createRPBuilder({
589
594
  rpOpts: this._rpOptions,
590
- pexOpts: this._pexOptions,
591
595
  context
592
596
  });
593
597
  this._rp = builder.build();
@@ -597,20 +601,8 @@ var RPInstance = class {
597
601
  get rpOptions() {
598
602
  return this._rpOptions;
599
603
  }
600
- get pexOptions() {
601
- return this._pexOptions;
602
- }
603
- hasDefinition() {
604
- return this.definitionId !== void 0;
605
- }
606
- get definitionId() {
607
- return this.pexOptions?.queryId;
608
- }
609
- async getPresentationDefinition(context) {
610
- return this.definitionId ? await context.agent.pexStoreGetDefinition({
611
- definitionId: this.definitionId,
612
- tenantId: this.pexOptions?.tenantId
613
- }) : void 0;
604
+ get presentationOptions() {
605
+ return this._presentationOptions;
614
606
  }
615
607
  async createAuthorizationRequestURI(createArgs, context) {
616
608
  const { correlationId, queryId, claims, requestByReferenceURI, responseURI, responseURIType, callback } = createArgs;
@@ -727,6 +719,7 @@ var SIOPv2RP = class _SIOPv2RP {
727
719
  }
728
720
  async createAuthorizationRequestURI(createArgs, context) {
729
721
  return await this.getRPInstance({
722
+ createWhenNotPresent: true,
730
723
  responseRedirectURI: createArgs.responseRedirectURI,
731
724
  ...createArgs.useQueryIdInstance === true && {
732
725
  queryId: createArgs.queryId
@@ -735,6 +728,7 @@ var SIOPv2RP = class _SIOPv2RP {
735
728
  }
736
729
  async createAuthorizationRequestPayloads(createArgs, context) {
737
730
  return await this.getRPInstance({
731
+ createWhenNotPresent: true,
738
732
  queryId: createArgs.queryId
739
733
  }, context).then((rp) => rp.createAuthorizationRequest(createArgs, context)).then(async (request) => {
740
734
  const authRequest = {
@@ -747,11 +741,13 @@ var SIOPv2RP = class _SIOPv2RP {
747
741
  }
748
742
  async siopGetRequestState(args, context) {
749
743
  return await this.getRPInstance({
744
+ createWhenNotPresent: false,
750
745
  queryId: args.queryId
751
746
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.getRequestStateByCorrelationId(args.correlationId, args.errorOnNotFound)));
752
747
  }
753
748
  async siopGetResponseState(args, context) {
754
749
  const rpInstance = await this.getRPInstance({
750
+ createWhenNotPresent: false,
755
751
  queryId: args.queryId
756
752
  }, context);
757
753
  const authorizationResponseState = await rpInstance.get(context).then((rp) => rp.sessionManager.getResponseStateByCorrelationId(args.correlationId, args.errorOnNotFound));
@@ -765,8 +761,6 @@ var SIOPv2RP = class _SIOPv2RP {
765
761
  hasher = defaultHasher2;
766
762
  }
767
763
  const vpToken = responseState.response.payload.vp_token && JSON.parse(responseState.response.payload.vp_token);
768
- const xx = DcqlPresentation.parse(vpToken);
769
- console.log(`IS DCQL PRESENTATION: ${JSON.stringify(xx)}`);
770
764
  const claims = [];
771
765
  for (const [key, value] of Object.entries(vpToken)) {
772
766
  const presentationDecoded = CredentialMapper2.decodeVerifiablePresentation(
@@ -834,6 +828,7 @@ var SIOPv2RP = class _SIOPv2RP {
834
828
  throw Error(`Only 'authorization_request_created' status is supported for this method at this point`);
835
829
  }
836
830
  return await this.getRPInstance({
831
+ createWhenNotPresent: false,
837
832
  queryId: args.queryId
838
833
  }, context).then((rp) => rp.get(context).then(async (rp2) => {
839
834
  await rp2.signalAuthRequestRetrieved({
@@ -845,6 +840,7 @@ var SIOPv2RP = class _SIOPv2RP {
845
840
  }
846
841
  async siopDeleteState(args, context) {
847
842
  return await this.getRPInstance({
843
+ createWhenNotPresent: false,
848
844
  queryId: args.queryId
849
845
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.deleteStateForCorrelationId(args.correlationId))).then(() => true);
850
846
  }
@@ -854,42 +850,27 @@ var SIOPv2RP = class _SIOPv2RP {
854
850
  }
855
851
  const authResponse = typeof args.authorizationResponse === "string" ? decodeUriAsJson(args.authorizationResponse) : args.authorizationResponse;
856
852
  return await this.getRPInstance({
853
+ createWhenNotPresent: false,
857
854
  queryId: args.queryId
858
855
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.verifyAuthorizationResponse(authResponse, {
859
856
  correlationId: args.correlationId,
860
- ...args.dcqlQueryPayload ? {
861
- dcqlQuery: args.dcqlQueryPayload.dcqlQuery
862
- } : {},
857
+ ...args.dcqlQuery && {
858
+ dcqlQuery: args.dcqlQuery
859
+ },
863
860
  audience: args.audience
864
861
  })));
865
862
  }
866
863
  async siopImportDefinitions(args, context) {
867
- const { queries, tenantId, version, versionControlMode } = args;
868
- await Promise.all(queries.map(async (definitionPair) => {
869
- const definitionPayload = definitionPair.definitionPayload;
870
- if (!definitionPayload && !definitionPair.dcqlPayload) {
871
- return Promise.reject(Error("Either dcqlPayload or definitionPayload must be suppplied"));
872
- }
873
- let definitionId;
874
- if (definitionPair.dcqlPayload) {
875
- DcqlQuery.validate(definitionPair.dcqlPayload.dcqlQuery);
876
- console.log(`persisting DCQL definition ${definitionPair.dcqlPayload.queryId} with versionControlMode ${versionControlMode}`);
877
- definitionId = definitionPair.dcqlPayload.queryId;
878
- }
879
- if (definitionPayload) {
880
- await context.agent.pexValidateDefinition({
881
- definition: definitionPayload
882
- });
883
- console.log(`persisting PEX definition ${definitionPayload.id} / ${definitionPayload.name} with versionControlMode ${versionControlMode}`);
884
- definitionId = definitionPayload.id;
885
- }
864
+ const { importItems, tenantId, version, versionControlMode } = args;
865
+ await Promise.all(importItems.map(async (importItem) => {
866
+ DcqlQuery.validate(importItem.query);
867
+ console.log(`persisting DCQL definition ${importItem.queryId} with versionControlMode ${versionControlMode}`);
886
868
  return context.agent.pdmPersistDefinition({
887
869
  definitionItem: {
888
- definitionId,
870
+ queryId: importItem.queryId,
889
871
  tenantId,
890
872
  version,
891
- definitionPayload,
892
- dcqlPayload: definitionPair.dcqlPayload
873
+ query: importItem.query
893
874
  },
894
875
  opts: {
895
876
  versionControlMode
@@ -914,9 +895,37 @@ var SIOPv2RP = class _SIOPv2RP {
914
895
  }
915
896
  return void 0;
916
897
  }
917
- async getRPInstance({ queryId, responseRedirectURI }, context) {
918
- const instanceId = queryId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
919
- if (!this.instances.has(instanceId)) {
898
+ async getRPInstance({ createWhenNotPresent, queryId, responseRedirectURI }, context) {
899
+ let rpInstanceId = _SIOPv2RP._DEFAULT_OPTS_KEY;
900
+ let rpInstance;
901
+ if (queryId) {
902
+ if (this.instances.has(queryId)) {
903
+ rpInstanceId = queryId;
904
+ rpInstance = this.instances.get(rpInstanceId);
905
+ } else if (isValidUUID(queryId)) {
906
+ try {
907
+ const pd = await context.agent.pdmGetDefinition({
908
+ itemId: queryId
909
+ });
910
+ if (this.instances.has(pd.queryId)) {
911
+ rpInstanceId = pd.queryId;
912
+ rpInstance = this.instances.get(rpInstanceId);
913
+ }
914
+ } catch (ignore) {
915
+ }
916
+ }
917
+ if (createWhenNotPresent) {
918
+ rpInstanceId = queryId;
919
+ } else {
920
+ rpInstance = this.instances.get(rpInstanceId);
921
+ }
922
+ } else {
923
+ rpInstance = this.instances.get(rpInstanceId);
924
+ }
925
+ if (!rpInstance) {
926
+ if (!createWhenNotPresent) {
927
+ return Promise.reject(`No RP instance found for key ${rpInstanceId}`);
928
+ }
920
929
  const instanceOpts = this.getInstanceOpts(queryId);
921
930
  const rpOpts = await this.getRPOptions(context, {
922
931
  queryId,
@@ -938,12 +947,12 @@ var SIOPv2RP = class _SIOPv2RP {
938
947
  resolverResolution: true
939
948
  });
940
949
  }
941
- this.instances.set(instanceId, new RPInstance({
950
+ rpInstance = new RPInstance({
942
951
  rpOpts,
943
952
  pexOpts: instanceOpts
944
- }));
953
+ });
954
+ this.instances.set(rpInstanceId, rpInstance);
945
955
  }
946
- const rpInstance = this.instances.get(instanceId);
947
956
  if (responseRedirectURI) {
948
957
  rpInstance.rpOptions.responseRedirectUri = responseRedirectURI;
949
958
  }
@@ -985,37 +994,28 @@ var SIOPv2RP = class _SIOPv2RP {
985
994
  }
986
995
  return options;
987
996
  }
988
- getInstanceOpts(definitionId) {
997
+ getInstanceOpts(queryId) {
989
998
  if (!this.opts.instanceOpts) return void 0;
990
- const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.queryId === definitionId) : void 0;
991
- return instanceOpt ?? this.getDefaultOptions(definitionId);
999
+ const instanceOpt = queryId ? this.opts.instanceOpts.find((i) => i.queryId === queryId) : void 0;
1000
+ return instanceOpt ?? this.getDefaultOptions(queryId);
992
1001
  }
993
- getDefaultOptions(definitionId) {
1002
+ getDefaultOptions(queryId) {
994
1003
  if (!this.opts.instanceOpts) return void 0;
995
1004
  const defaultOptions = this.opts.instanceOpts.find((i) => i.queryId === "default");
996
1005
  if (defaultOptions) {
997
1006
  const clonedOptions = {
998
1007
  ...defaultOptions
999
1008
  };
1000
- if (definitionId !== void 0) {
1001
- clonedOptions.queryId = definitionId;
1009
+ if (queryId !== void 0) {
1010
+ clonedOptions.queryId = queryId;
1002
1011
  }
1003
1012
  return clonedOptions;
1004
1013
  }
1005
1014
  return void 0;
1006
1015
  }
1007
1016
  };
1008
-
1009
- // src/types/ISIOPv2RP.ts
1010
- var VerifiedDataMode = /* @__PURE__ */ (function(VerifiedDataMode2) {
1011
- VerifiedDataMode2["NONE"] = "none";
1012
- VerifiedDataMode2["VERIFIED_PRESENTATION"] = "vp";
1013
- VerifiedDataMode2["CREDENTIAL_SUBJECT_FLATTENED"] = "cs-flat";
1014
- return VerifiedDataMode2;
1015
- })({});
1016
1017
  export {
1017
1018
  SIOPv2RP,
1018
- VerifiedDataMode,
1019
1019
  plugin_schema_default as schema
1020
1020
  };
1021
1021
  //# sourceMappingURL=index.js.map