@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth 0.34.1-fix.148 → 0.34.1-fix.161

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.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IPluginMethodMap, IAgentContext, IResolver, IDIDManager, IKeyManager, ICredentialIssuer, ICredentialVerifier, IAgentPlugin } from '@veramo/core';
2
- import { ResponseURIType, ClaimPayloadCommonOpts, AuthorizationRequestPayload, RequestObjectPayload, AuthorizationRequestState, AuthorizationResponseState, AuthorizationResponsePayload, VerifiedAuthorizationResponse, ResponseMode, SupportedVersion, IRPSessionManager, ClientMetadataOpts, VerifyJwtCallback, PresentationVerificationCallback, RP, URI, AuthorizationRequest } from '@sphereon/did-auth-siop';
2
+ import { ResponseURIType, ClaimPayloadCommonOpts, CallbackOpts, AuthorizationRequestPayload, RequestObjectPayload, AuthorizationRequestState, AuthorizationResponseStateWithVerifiedData, AuthorizationResponsePayload, VerifiedAuthorizationResponse, ResponseMode, SupportedVersion, IRPSessionManager, ClientMetadataOpts, VerifyJwtCallback, PresentationVerificationCallback, RP, URI, AuthorizationRequest } from '@sphereon/did-auth-siop';
3
3
  import { CheckLinkedDomain } from '@sphereon/did-auth-siop-adapter';
4
4
  import { DIDDocument } from '@sphereon/did-uni-client';
5
5
  import { JwtIssuer } from '@sphereon/oid4vc-common';
@@ -13,7 +13,7 @@ import { IPDManager, 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 { AdditionalClaims, DcqlQueryPayload, HasherSync } from '@sphereon/ssi-types';
16
+ import { DcqlQueryPayload, HasherSync } from '@sphereon/ssi-types';
17
17
  import { VerifyCallback } from '@sphereon/wellknown-dids-client';
18
18
  import { Resolvable } from 'did-resolver';
19
19
  import { EventEmitter } from 'events';
@@ -412,8 +412,9 @@ interface ISiopv2RPOpts {
412
412
  interface IRPDefaultOpts extends IRPOptions {
413
413
  }
414
414
  interface ICreateAuthRequestArgs {
415
- definitionId: string;
415
+ queryId: string;
416
416
  correlationId: string;
417
+ useQueryIdInstance?: boolean;
417
418
  responseURIType: ResponseURIType;
418
419
  responseURI: string;
419
420
  responseRedirectURI?: string;
@@ -422,32 +423,33 @@ interface ICreateAuthRequestArgs {
422
423
  nonce?: string;
423
424
  state?: string;
424
425
  claims?: ClaimPayloadCommonOpts;
426
+ callback?: CallbackOpts;
425
427
  }
426
428
  interface IGetAuthRequestStateArgs {
427
429
  correlationId: string;
428
- definitionId: string;
430
+ queryId?: string;
429
431
  errorOnNotFound?: boolean;
430
432
  }
431
433
  interface IGetAuthResponseStateArgs {
432
434
  correlationId: string;
433
- definitionId: string;
435
+ queryId?: string;
434
436
  errorOnNotFound?: boolean;
435
437
  progressRequestStateTo?: AuthorizationRequestStateStatus;
436
438
  includeVerifiedData?: VerifiedDataMode;
437
439
  }
438
440
  interface IUpdateRequestStateArgs {
439
- definitionId: string;
441
+ queryId: string;
440
442
  correlationId: string;
441
443
  state: AuthorizationRequestStateStatus;
442
444
  error?: string;
443
445
  }
444
446
  interface IDeleteAuthStateArgs {
445
447
  correlationId: string;
446
- definitionId: string;
448
+ queryId?: string;
447
449
  }
448
450
  interface IVerifyAuthResponseStateArgs {
449
451
  authorizationResponse: string | AuthorizationResponsePayload;
450
- definitionId?: string;
452
+ queryId?: string;
451
453
  correlationId: string;
452
454
  audience?: string;
453
455
  dcqlQueryPayload?: DcqlQueryPayload;
@@ -457,14 +459,14 @@ interface IDefinitionPair {
457
459
  dcqlPayload?: DcqlQueryPayload;
458
460
  }
459
461
  interface ImportDefinitionsArgs {
460
- definitions: Array<IDefinitionPair>;
462
+ queries: Array<IDefinitionPair>;
461
463
  tenantId?: string;
462
464
  version?: string;
463
465
  versionControlMode?: VersionControlMode;
464
466
  }
465
467
  interface IGetRedirectUriArgs {
466
468
  correlationId: string;
467
- definitionId?: string;
469
+ queryId?: string;
468
470
  state?: string;
469
471
  }
470
472
  interface IAuthorizationRequestPayloads {
@@ -477,7 +479,7 @@ interface IPEXDefinitionPersistArgs extends IPEXInstanceOptions {
477
479
  ttl?: number;
478
480
  }
479
481
  interface ISiopRPInstanceArgs {
480
- definitionId?: string;
482
+ queryId?: string;
481
483
  responseRedirectURI?: string;
482
484
  }
483
485
  interface IPEXInstanceOptions extends IPEXOptions {
@@ -498,7 +500,7 @@ interface IRPOptions {
498
500
  }
499
501
  interface IPEXOptions {
500
502
  presentationVerifyCallback?: PresentationVerificationCallback;
501
- definitionId: string;
503
+ queryId: string;
502
504
  version?: string;
503
505
  tenantId?: string;
504
506
  }
@@ -523,9 +525,6 @@ interface ISIOPIdentifierOptions extends Omit<IDIDOptions, 'idOpts'> {
523
525
  type CredentialOpts = {
524
526
  hasher?: HasherSync;
525
527
  };
526
- interface AuthorizationResponseStateWithVerifiedData extends AuthorizationResponseState {
527
- verifiedData?: AdditionalClaims;
528
- }
529
528
  type IRequiredContext = IAgentContext<IResolver & IDIDManager & IKeyManager & IIdentifierResolution & ICredentialIssuer & ICredentialValidation & ICredentialVerifier & IPresentationExchange & IPDManager & ISDJwtPlugin & IJwtService & ImDLMdoc>;
530
529
 
531
530
  declare class RPInstance {
@@ -542,8 +541,8 @@ declare class RPInstance {
542
541
  hasDefinition(): boolean;
543
542
  get definitionId(): string | undefined;
544
543
  getPresentationDefinition(context: IRequiredContext): Promise<IPresentationDefinition | undefined>;
545
- createAuthorizationRequestURI(createArgs: Omit<ICreateAuthRequestArgs, 'definitionId'>, context: IRequiredContext): Promise<URI>;
546
- createAuthorizationRequest(createArgs: Omit<ICreateAuthRequestArgs, 'definitionId'>, context: IRequiredContext): Promise<AuthorizationRequest>;
544
+ createAuthorizationRequestURI(createArgs: ICreateAuthRequestArgs, context: IRequiredContext): Promise<URI>;
545
+ createAuthorizationRequest(createArgs: Omit<ICreateAuthRequestArgs, 'queryId'>, context: IRequiredContext): Promise<AuthorizationRequest>;
547
546
  }
548
547
 
549
548
  declare class SIOPv2RP implements IAgentPlugin {
@@ -890,13 +889,13 @@ declare class SIOPv2RP implements IAgentPlugin {
890
889
  private siopVerifyAuthResponse;
891
890
  private siopImportDefinitions;
892
891
  private siopGetRedirectURI;
893
- getRPInstance({ definitionId, responseRedirectURI }: ISiopRPInstanceArgs, context: IRequiredContext): Promise<RPInstance>;
892
+ getRPInstance({ queryId, responseRedirectURI }: ISiopRPInstanceArgs, context: IRequiredContext): Promise<RPInstance>;
894
893
  getRPOptions(context: IRequiredContext, opts: {
895
- definitionId?: string;
894
+ queryId?: string;
896
895
  responseRedirectURI?: string;
897
896
  }): Promise<IRPOptions>;
898
897
  getInstanceOpts(definitionId?: string): IPEXInstanceOptions | undefined;
899
898
  private getDefaultOptions;
900
899
  }
901
900
 
902
- export { type AuthorizationResponseStateWithVerifiedData, 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 };
901
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IPluginMethodMap, IAgentContext, IResolver, IDIDManager, IKeyManager, ICredentialIssuer, ICredentialVerifier, IAgentPlugin } from '@veramo/core';
2
- import { ResponseURIType, ClaimPayloadCommonOpts, AuthorizationRequestPayload, RequestObjectPayload, AuthorizationRequestState, AuthorizationResponseState, AuthorizationResponsePayload, VerifiedAuthorizationResponse, ResponseMode, SupportedVersion, IRPSessionManager, ClientMetadataOpts, VerifyJwtCallback, PresentationVerificationCallback, RP, URI, AuthorizationRequest } from '@sphereon/did-auth-siop';
2
+ import { ResponseURIType, ClaimPayloadCommonOpts, CallbackOpts, AuthorizationRequestPayload, RequestObjectPayload, AuthorizationRequestState, AuthorizationResponseStateWithVerifiedData, AuthorizationResponsePayload, VerifiedAuthorizationResponse, ResponseMode, SupportedVersion, IRPSessionManager, ClientMetadataOpts, VerifyJwtCallback, PresentationVerificationCallback, RP, URI, AuthorizationRequest } from '@sphereon/did-auth-siop';
3
3
  import { CheckLinkedDomain } from '@sphereon/did-auth-siop-adapter';
4
4
  import { DIDDocument } from '@sphereon/did-uni-client';
5
5
  import { JwtIssuer } from '@sphereon/oid4vc-common';
@@ -13,7 +13,7 @@ import { IPDManager, 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 { AdditionalClaims, DcqlQueryPayload, HasherSync } from '@sphereon/ssi-types';
16
+ import { DcqlQueryPayload, HasherSync } from '@sphereon/ssi-types';
17
17
  import { VerifyCallback } from '@sphereon/wellknown-dids-client';
18
18
  import { Resolvable } from 'did-resolver';
19
19
  import { EventEmitter } from 'events';
@@ -412,8 +412,9 @@ interface ISiopv2RPOpts {
412
412
  interface IRPDefaultOpts extends IRPOptions {
413
413
  }
414
414
  interface ICreateAuthRequestArgs {
415
- definitionId: string;
415
+ queryId: string;
416
416
  correlationId: string;
417
+ useQueryIdInstance?: boolean;
417
418
  responseURIType: ResponseURIType;
418
419
  responseURI: string;
419
420
  responseRedirectURI?: string;
@@ -422,32 +423,33 @@ interface ICreateAuthRequestArgs {
422
423
  nonce?: string;
423
424
  state?: string;
424
425
  claims?: ClaimPayloadCommonOpts;
426
+ callback?: CallbackOpts;
425
427
  }
426
428
  interface IGetAuthRequestStateArgs {
427
429
  correlationId: string;
428
- definitionId: string;
430
+ queryId?: string;
429
431
  errorOnNotFound?: boolean;
430
432
  }
431
433
  interface IGetAuthResponseStateArgs {
432
434
  correlationId: string;
433
- definitionId: string;
435
+ queryId?: string;
434
436
  errorOnNotFound?: boolean;
435
437
  progressRequestStateTo?: AuthorizationRequestStateStatus;
436
438
  includeVerifiedData?: VerifiedDataMode;
437
439
  }
438
440
  interface IUpdateRequestStateArgs {
439
- definitionId: string;
441
+ queryId: string;
440
442
  correlationId: string;
441
443
  state: AuthorizationRequestStateStatus;
442
444
  error?: string;
443
445
  }
444
446
  interface IDeleteAuthStateArgs {
445
447
  correlationId: string;
446
- definitionId: string;
448
+ queryId?: string;
447
449
  }
448
450
  interface IVerifyAuthResponseStateArgs {
449
451
  authorizationResponse: string | AuthorizationResponsePayload;
450
- definitionId?: string;
452
+ queryId?: string;
451
453
  correlationId: string;
452
454
  audience?: string;
453
455
  dcqlQueryPayload?: DcqlQueryPayload;
@@ -457,14 +459,14 @@ interface IDefinitionPair {
457
459
  dcqlPayload?: DcqlQueryPayload;
458
460
  }
459
461
  interface ImportDefinitionsArgs {
460
- definitions: Array<IDefinitionPair>;
462
+ queries: Array<IDefinitionPair>;
461
463
  tenantId?: string;
462
464
  version?: string;
463
465
  versionControlMode?: VersionControlMode;
464
466
  }
465
467
  interface IGetRedirectUriArgs {
466
468
  correlationId: string;
467
- definitionId?: string;
469
+ queryId?: string;
468
470
  state?: string;
469
471
  }
470
472
  interface IAuthorizationRequestPayloads {
@@ -477,7 +479,7 @@ interface IPEXDefinitionPersistArgs extends IPEXInstanceOptions {
477
479
  ttl?: number;
478
480
  }
479
481
  interface ISiopRPInstanceArgs {
480
- definitionId?: string;
482
+ queryId?: string;
481
483
  responseRedirectURI?: string;
482
484
  }
483
485
  interface IPEXInstanceOptions extends IPEXOptions {
@@ -498,7 +500,7 @@ interface IRPOptions {
498
500
  }
499
501
  interface IPEXOptions {
500
502
  presentationVerifyCallback?: PresentationVerificationCallback;
501
- definitionId: string;
503
+ queryId: string;
502
504
  version?: string;
503
505
  tenantId?: string;
504
506
  }
@@ -523,9 +525,6 @@ interface ISIOPIdentifierOptions extends Omit<IDIDOptions, 'idOpts'> {
523
525
  type CredentialOpts = {
524
526
  hasher?: HasherSync;
525
527
  };
526
- interface AuthorizationResponseStateWithVerifiedData extends AuthorizationResponseState {
527
- verifiedData?: AdditionalClaims;
528
- }
529
528
  type IRequiredContext = IAgentContext<IResolver & IDIDManager & IKeyManager & IIdentifierResolution & ICredentialIssuer & ICredentialValidation & ICredentialVerifier & IPresentationExchange & IPDManager & ISDJwtPlugin & IJwtService & ImDLMdoc>;
530
529
 
531
530
  declare class RPInstance {
@@ -542,8 +541,8 @@ declare class RPInstance {
542
541
  hasDefinition(): boolean;
543
542
  get definitionId(): string | undefined;
544
543
  getPresentationDefinition(context: IRequiredContext): Promise<IPresentationDefinition | undefined>;
545
- createAuthorizationRequestURI(createArgs: Omit<ICreateAuthRequestArgs, 'definitionId'>, context: IRequiredContext): Promise<URI>;
546
- createAuthorizationRequest(createArgs: Omit<ICreateAuthRequestArgs, 'definitionId'>, context: IRequiredContext): Promise<AuthorizationRequest>;
544
+ createAuthorizationRequestURI(createArgs: ICreateAuthRequestArgs, context: IRequiredContext): Promise<URI>;
545
+ createAuthorizationRequest(createArgs: Omit<ICreateAuthRequestArgs, 'queryId'>, context: IRequiredContext): Promise<AuthorizationRequest>;
547
546
  }
548
547
 
549
548
  declare class SIOPv2RP implements IAgentPlugin {
@@ -890,13 +889,13 @@ declare class SIOPv2RP implements IAgentPlugin {
890
889
  private siopVerifyAuthResponse;
891
890
  private siopImportDefinitions;
892
891
  private siopGetRedirectURI;
893
- getRPInstance({ definitionId, responseRedirectURI }: ISiopRPInstanceArgs, context: IRequiredContext): Promise<RPInstance>;
892
+ getRPInstance({ queryId, responseRedirectURI }: ISiopRPInstanceArgs, context: IRequiredContext): Promise<RPInstance>;
894
893
  getRPOptions(context: IRequiredContext, opts: {
895
- definitionId?: string;
894
+ queryId?: string;
896
895
  responseRedirectURI?: string;
897
896
  }): Promise<IRPOptions>;
898
897
  getInstanceOpts(definitionId?: string): IPEXInstanceOptions | undefined;
899
898
  private getDefaultOptions;
900
899
  }
901
900
 
902
- export { type AuthorizationResponseStateWithVerifiedData, 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 };
901
+ 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 };
package/dist/index.js CHANGED
@@ -409,11 +409,11 @@ async function createRPBuilder(args) {
409
409
  const { identifierOpts } = rpOpts;
410
410
  let definition = args.definition;
411
411
  let dcqlQuery = args.dcql;
412
- if (!definition && pexOpts && pexOpts.definitionId) {
412
+ if (!definition && pexOpts && pexOpts.queryId) {
413
413
  const presentationDefinitionItems = await context.agent.pdmGetDefinitions({
414
414
  filter: [
415
415
  {
416
- definitionId: pexOpts.definitionId,
416
+ definitionId: pexOpts.queryId,
417
417
  version: pexOpts.version,
418
418
  tenantId: pexOpts.tenantId
419
419
  }
@@ -604,7 +604,7 @@ var RPInstance = class {
604
604
  return this.definitionId !== void 0;
605
605
  }
606
606
  get definitionId() {
607
- return this.pexOptions?.definitionId;
607
+ return this.pexOptions?.queryId;
608
608
  }
609
609
  async getPresentationDefinition(context) {
610
610
  return this.definitionId ? await context.agent.pexStoreGetDefinition({
@@ -613,7 +613,7 @@ var RPInstance = class {
613
613
  }) : void 0;
614
614
  }
615
615
  async createAuthorizationRequestURI(createArgs, context) {
616
- const { correlationId, claims, requestByReferenceURI, responseURI, responseURIType } = createArgs;
616
+ const { correlationId, queryId, claims, requestByReferenceURI, responseURI, responseURIType, callback } = createArgs;
617
617
  const nonce = createArgs.nonce ?? uuidv4();
618
618
  const state = createArgs.state ?? correlationId;
619
619
  let jwtIssuer;
@@ -641,13 +641,15 @@ var RPInstance = class {
641
641
  return await this.get(context).then((rp) => rp.createAuthorizationRequestURI({
642
642
  version: getRequestVersion(this.rpOptions),
643
643
  correlationId,
644
+ queryId,
644
645
  nonce,
645
646
  state,
646
647
  claims,
647
648
  requestByReferenceURI,
648
649
  responseURI,
649
650
  responseURIType,
650
- jwtIssuer
651
+ jwtIssuer,
652
+ callback
651
653
  }));
652
654
  }
653
655
  async createAuthorizationRequest(createArgs, context) {
@@ -725,13 +727,15 @@ var SIOPv2RP = class _SIOPv2RP {
725
727
  }
726
728
  async createAuthorizationRequestURI(createArgs, context) {
727
729
  return await this.getRPInstance({
728
- definitionId: createArgs.definitionId,
729
- responseRedirectURI: createArgs.responseRedirectURI
730
+ responseRedirectURI: createArgs.responseRedirectURI,
731
+ ...createArgs.useQueryIdInstance === true && {
732
+ queryId: createArgs.queryId
733
+ }
730
734
  }, context).then((rp) => rp.createAuthorizationRequestURI(createArgs, context)).then((URI) => URI.encodedUri);
731
735
  }
732
736
  async createAuthorizationRequestPayloads(createArgs, context) {
733
737
  return await this.getRPInstance({
734
- definitionId: createArgs.definitionId
738
+ queryId: createArgs.queryId
735
739
  }, context).then((rp) => rp.createAuthorizationRequest(createArgs, context)).then(async (request) => {
736
740
  const authRequest = {
737
741
  authorizationRequest: request.payload,
@@ -743,12 +747,12 @@ var SIOPv2RP = class _SIOPv2RP {
743
747
  }
744
748
  async siopGetRequestState(args, context) {
745
749
  return await this.getRPInstance({
746
- definitionId: args.definitionId
750
+ queryId: args.queryId
747
751
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.getRequestStateByCorrelationId(args.correlationId, args.errorOnNotFound)));
748
752
  }
749
753
  async siopGetResponseState(args, context) {
750
754
  const rpInstance = await this.getRPInstance({
751
- definitionId: args.definitionId
755
+ queryId: args.queryId
752
756
  }, context);
753
757
  const authorizationResponseState = await rpInstance.get(context).then((rp) => rp.sessionManager.getResponseStateByCorrelationId(args.correlationId, args.errorOnNotFound));
754
758
  if (authorizationResponseState === void 0) {
@@ -801,11 +805,11 @@ var SIOPv2RP = class _SIOPv2RP {
801
805
  }
802
806
  presentationOrClaimsFrom = /* @__PURE__ */ __name((presentationDecoded) => CredentialMapper2.isSdJwtDecodedCredential(presentationDecoded) ? presentationDecoded.decodedPayload : CredentialMapper2.toUniformPresentation(presentationDecoded), "presentationOrClaimsFrom");
803
807
  async siopUpdateRequestState(args, context) {
804
- if (args.state !== "sent") {
805
- throw Error(`Only 'sent' status is supported for this method at this point`);
808
+ if (args.state !== "authorization_request_created") {
809
+ throw Error(`Only 'authorization_request_created' status is supported for this method at this point`);
806
810
  }
807
811
  return await this.getRPInstance({
808
- definitionId: args.definitionId
812
+ queryId: args.queryId
809
813
  }, context).then((rp) => rp.get(context).then(async (rp2) => {
810
814
  await rp2.signalAuthRequestRetrieved({
811
815
  correlationId: args.correlationId,
@@ -816,7 +820,7 @@ var SIOPv2RP = class _SIOPv2RP {
816
820
  }
817
821
  async siopDeleteState(args, context) {
818
822
  return await this.getRPInstance({
819
- definitionId: args.definitionId
823
+ queryId: args.queryId
820
824
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.deleteStateForCorrelationId(args.correlationId))).then(() => true);
821
825
  }
822
826
  async siopVerifyAuthResponse(args, context) {
@@ -825,7 +829,7 @@ var SIOPv2RP = class _SIOPv2RP {
825
829
  }
826
830
  const authResponse = typeof args.authorizationResponse === "string" ? decodeUriAsJson(args.authorizationResponse) : args.authorizationResponse;
827
831
  return await this.getRPInstance({
828
- definitionId: args.definitionId
832
+ queryId: args.queryId
829
833
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.verifyAuthorizationResponse(authResponse, {
830
834
  correlationId: args.correlationId,
831
835
  ...args.dcqlQueryPayload ? {
@@ -835,8 +839,8 @@ var SIOPv2RP = class _SIOPv2RP {
835
839
  })));
836
840
  }
837
841
  async siopImportDefinitions(args, context) {
838
- const { definitions, tenantId, version, versionControlMode } = args;
839
- await Promise.all(definitions.map(async (definitionPair) => {
842
+ const { queries, tenantId, version, versionControlMode } = args;
843
+ await Promise.all(queries.map(async (definitionPair) => {
840
844
  const definitionPayload = definitionPair.definitionPayload;
841
845
  if (!definitionPayload && !definitionPair.dcqlPayload) {
842
846
  return Promise.reject(Error("Either dcqlPayload or definitionPayload must be suppplied"));
@@ -869,7 +873,7 @@ var SIOPv2RP = class _SIOPv2RP {
869
873
  }));
870
874
  }
871
875
  async siopGetRedirectURI(args, context) {
872
- const instanceId = args.definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
876
+ const instanceId = args.queryId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
873
877
  if (this.instances.has(instanceId)) {
874
878
  const rpInstance = this.instances.get(instanceId);
875
879
  if (rpInstance !== void 0) {
@@ -885,12 +889,12 @@ var SIOPv2RP = class _SIOPv2RP {
885
889
  }
886
890
  return void 0;
887
891
  }
888
- async getRPInstance({ definitionId, responseRedirectURI }, context) {
889
- const instanceId = definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
892
+ async getRPInstance({ queryId, responseRedirectURI }, context) {
893
+ const instanceId = queryId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
890
894
  if (!this.instances.has(instanceId)) {
891
- const instanceOpts = this.getInstanceOpts(definitionId);
895
+ const instanceOpts = this.getInstanceOpts(queryId);
892
896
  const rpOpts = await this.getRPOptions(context, {
893
- definitionId,
897
+ queryId,
894
898
  responseRedirectURI
895
899
  });
896
900
  if (!rpOpts.identifierOpts.resolveOpts?.resolver || typeof rpOpts.identifierOpts.resolveOpts.resolver.resolve !== "function") {
@@ -902,7 +906,7 @@ var SIOPv2RP = class _SIOPv2RP {
902
906
  ...rpOpts.identifierOpts.resolveOpts
903
907
  };
904
908
  }
905
- console.log("Using agent DID resolver for RP instance with definition id " + definitionId);
909
+ console.log("Using agent DID resolver for RP instance with definition id " + queryId);
906
910
  rpOpts.identifierOpts.resolveOpts.resolver = getAgentResolver2(context, {
907
911
  uniresolverResolution: true,
908
912
  localResolution: true,
@@ -921,10 +925,10 @@ var SIOPv2RP = class _SIOPv2RP {
921
925
  return rpInstance;
922
926
  }
923
927
  async getRPOptions(context, opts) {
924
- const { definitionId, responseRedirectURI } = opts;
925
- const options = this.getInstanceOpts(definitionId)?.rpOpts ?? this.opts.defaultOpts;
928
+ const { queryId, responseRedirectURI } = opts;
929
+ const options = this.getInstanceOpts(queryId)?.rpOpts ?? this.opts.defaultOpts;
926
930
  if (!options) {
927
- throw Error(`Could not get specific nor default options for definition ${definitionId}`);
931
+ throw Error(`Could not get specific nor default options for definition ${queryId}`);
928
932
  }
929
933
  if (this.opts.defaultOpts) {
930
934
  if (!options.identifierOpts) {
@@ -958,18 +962,18 @@ var SIOPv2RP = class _SIOPv2RP {
958
962
  }
959
963
  getInstanceOpts(definitionId) {
960
964
  if (!this.opts.instanceOpts) return void 0;
961
- const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.definitionId === definitionId) : void 0;
965
+ const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.queryId === definitionId) : void 0;
962
966
  return instanceOpt ?? this.getDefaultOptions(definitionId);
963
967
  }
964
968
  getDefaultOptions(definitionId) {
965
969
  if (!this.opts.instanceOpts) return void 0;
966
- const defaultOptions = this.opts.instanceOpts.find((i) => i.definitionId === "default");
970
+ const defaultOptions = this.opts.instanceOpts.find((i) => i.queryId === "default");
967
971
  if (defaultOptions) {
968
972
  const clonedOptions = {
969
973
  ...defaultOptions
970
974
  };
971
975
  if (definitionId !== void 0) {
972
- clonedOptions.definitionId = definitionId;
976
+ clonedOptions.queryId = definitionId;
973
977
  }
974
978
  return clonedOptions;
975
979
  }