@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth 0.34.1-feature.SSISDK.45.94 → 0.34.1-feature.SSISDK.46.41

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,22 +1,22 @@
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';
3
- import { CheckLinkedDomain } from '@sphereon/did-auth-siop-adapter';
2
+ import { ResponseURIType, ClaimPayloadCommonOpts, AuthorizationRequestPayload, RequestObjectPayload, AuthorizationRequestState, AuthorizationResponseState, AuthorizationResponsePayload, PresentationDefinitionWithLocation, VerifiedAuthorizationResponse, ResponseMode, SupportedVersion, IRPSessionManager, ClientMetadataOpts, VerifyJwtCallback, PresentationVerificationCallback, VPTokenLocation, VerifiablePresentationTypeFormat, RP, URI, AuthorizationRequest } from '@sphereon/did-auth-siop';
3
+ import { IIdentifierResolution, ManagedIdentifierOptsOrResult, ExternalIdentifierOIDFEntityIdOpts } from '@sphereon/ssi-sdk-ext.identifier-resolution';
4
+ import { AdditionalClaims, DcqlQueryREST, HasherSync, W3CVerifiablePresentation } from '@sphereon/ssi-types';
5
+ import { Resolvable } from 'did-resolver';
4
6
  import { DIDDocument } from '@sphereon/did-uni-client';
5
- import { JwtIssuer } from '@sphereon/oid4vc-common';
7
+ import { EventEmitter } from 'events';
6
8
  import { IPresentationDefinition } from '@sphereon/pex';
7
9
  import { IDIDOptions } from '@sphereon/ssi-sdk-ext.did-utils';
8
- import { IIdentifierResolution, ManagedIdentifierOptsOrResult, ExternalIdentifierOIDFEntityIdOpts } from '@sphereon/ssi-sdk-ext.identifier-resolution';
9
- import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
10
- import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation';
11
- import { ImDLMdoc } from '@sphereon/ssi-sdk.mdl-mdoc';
12
- import { IPDManager, VersionControlMode } from '@sphereon/ssi-sdk.pd-manager';
13
10
  import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange';
14
- import { ISDJwtPlugin } from '@sphereon/ssi-sdk.sd-jwt';
15
- import { AuthorizationRequestStateStatus } from '@sphereon/ssi-sdk.siopv2-oid4vp-common';
16
- import { AdditionalClaims, DcqlQueryREST, HasherSync } from '@sphereon/ssi-types';
17
11
  import { VerifyCallback } from '@sphereon/wellknown-dids-client';
18
- import { Resolvable } from 'did-resolver';
19
- import { EventEmitter } from 'events';
12
+ import { AuthorizationRequestStateStatus } from '@sphereon/ssi-sdk.siopv2-oid4vp-common';
13
+ import { IPDManager, VersionControlMode } from '@sphereon/ssi-sdk.pd-manager';
14
+ import { CheckLinkedDomain } from '@sphereon/did-auth-siop-adapter';
15
+ import { ISDJwtPlugin } from '@sphereon/ssi-sdk.sd-jwt';
16
+ import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
17
+ import { JwtIssuer } from '@sphereon/oid4vc-common';
18
+ import { ImDLMdoc } from '@sphereon/ssi-sdk.mdl-mdoc';
19
+ import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation';
20
20
 
21
21
  declare enum VerifiedDataMode {
22
22
  NONE = "none",
@@ -41,8 +41,9 @@ interface ISiopv2RPOpts {
41
41
  interface IRPDefaultOpts extends IRPOptions {
42
42
  }
43
43
  interface ICreateAuthRequestArgs {
44
- definitionId: string;
44
+ queryId: string;
45
45
  correlationId: string;
46
+ useQueryIdInstance?: boolean;
46
47
  responseURIType: ResponseURIType;
47
48
  responseURI: string;
48
49
  responseRedirectURI?: string;
@@ -54,31 +55,32 @@ interface ICreateAuthRequestArgs {
54
55
  }
55
56
  interface IGetAuthRequestStateArgs {
56
57
  correlationId: string;
57
- definitionId: string;
58
+ queryId?: string;
58
59
  errorOnNotFound?: boolean;
59
60
  }
60
61
  interface IGetAuthResponseStateArgs {
61
62
  correlationId: string;
62
- definitionId: string;
63
+ queryId?: string;
63
64
  errorOnNotFound?: boolean;
64
65
  progressRequestStateTo?: AuthorizationRequestStateStatus;
65
66
  includeVerifiedData?: VerifiedDataMode;
66
67
  }
67
68
  interface IUpdateRequestStateArgs {
68
- definitionId: string;
69
+ queryId: string;
69
70
  correlationId: string;
70
71
  state: AuthorizationRequestStateStatus;
71
72
  error?: string;
72
73
  }
73
74
  interface IDeleteAuthStateArgs {
74
75
  correlationId: string;
75
- definitionId: string;
76
+ queryId?: string;
76
77
  }
77
78
  interface IVerifyAuthResponseStateArgs {
78
79
  authorizationResponse: string | AuthorizationResponsePayload;
79
- definitionId?: string;
80
+ queryId?: string;
80
81
  correlationId: string;
81
82
  audience?: string;
83
+ presentationDefinitions?: PresentationDefinitionWithLocation | PresentationDefinitionWithLocation[];
82
84
  dcqlQuery?: DcqlQueryREST;
83
85
  }
84
86
  interface IDefinitionPair {
@@ -86,14 +88,14 @@ interface IDefinitionPair {
86
88
  dcqlPayload?: DcqlQueryREST;
87
89
  }
88
90
  interface ImportDefinitionsArgs {
89
- definitions: Array<IDefinitionPair>;
91
+ queries: Array<IDefinitionPair>;
90
92
  tenantId?: string;
91
93
  version?: string;
92
94
  versionControlMode?: VersionControlMode;
93
95
  }
94
96
  interface IGetRedirectUriArgs {
95
97
  correlationId: string;
96
- definitionId?: string;
98
+ queryId?: string;
97
99
  state?: string;
98
100
  }
99
101
  interface IAuthorizationRequestPayloads {
@@ -106,7 +108,7 @@ interface IPEXDefinitionPersistArgs extends IPEXInstanceOptions {
106
108
  ttl?: number;
107
109
  }
108
110
  interface ISiopRPInstanceArgs {
109
- definitionId?: string;
111
+ queryId?: string;
110
112
  responseRedirectURI?: string;
111
113
  }
112
114
  interface IPEXInstanceOptions extends IPEXOptions {
@@ -127,7 +129,7 @@ interface IRPOptions {
127
129
  }
128
130
  interface IPEXOptions {
129
131
  presentationVerifyCallback?: PresentationVerificationCallback;
130
- definitionId: string;
132
+ queryId: string;
131
133
  version?: string;
132
134
  tenantId?: string;
133
135
  }
@@ -141,8 +143,15 @@ interface PerDidResolver {
141
143
  interface IAuthRequestDetails {
142
144
  rpDIDDocument?: DIDDocument;
143
145
  id: string;
146
+ verifiablePresentationMatches: IPresentationWithDefinition[];
144
147
  alsoKnownAs?: string[];
145
148
  }
149
+ interface IPresentationWithDefinition {
150
+ location: VPTokenLocation;
151
+ definition: PresentationDefinitionWithLocation;
152
+ format: VerifiablePresentationTypeFormat;
153
+ presentation: W3CVerifiablePresentation;
154
+ }
146
155
  interface ISIOPIdentifierOptions extends Omit<IDIDOptions, 'idOpts'> {
147
156
  idOpts: ManagedIdentifierOptsOrResult;
148
157
  oidfOpts?: ExternalIdentifierOIDFEntityIdOpts;
@@ -171,8 +180,8 @@ declare class RPInstance {
171
180
  hasDefinition(): boolean;
172
181
  get definitionId(): string | undefined;
173
182
  getPresentationDefinition(context: IRequiredContext): Promise<IPresentationDefinition | undefined>;
174
- createAuthorizationRequestURI(createArgs: Omit<ICreateAuthRequestArgs, 'definitionId'>, context: IRequiredContext): Promise<URI>;
175
- createAuthorizationRequest(createArgs: Omit<ICreateAuthRequestArgs, 'definitionId'>, context: IRequiredContext): Promise<AuthorizationRequest>;
183
+ createAuthorizationRequestURI(createArgs: Omit<ICreateAuthRequestArgs, 'queryId'>, context: IRequiredContext): Promise<URI>;
184
+ createAuthorizationRequest(createArgs: Omit<ICreateAuthRequestArgs, 'queryId'>, context: IRequiredContext): Promise<AuthorizationRequest>;
176
185
  }
177
186
 
178
187
  declare class SIOPv2RP implements IAgentPlugin {
@@ -193,9 +202,9 @@ declare class SIOPv2RP implements IAgentPlugin {
193
202
  private siopVerifyAuthResponse;
194
203
  private siopImportDefinitions;
195
204
  private siopGetRedirectURI;
196
- getRPInstance({ definitionId, responseRedirectURI }: ISiopRPInstanceArgs, context: IRequiredContext): Promise<RPInstance>;
205
+ getRPInstance({ queryId, responseRedirectURI }: ISiopRPInstanceArgs, context: IRequiredContext): Promise<RPInstance>;
197
206
  getRPOptions(context: IRequiredContext, opts: {
198
- definitionId?: string;
207
+ queryId?: string;
199
208
  responseRedirectURI?: string;
200
209
  }): Promise<IRPOptions>;
201
210
  getInstanceOpts(definitionId?: string): IPEXInstanceOptions | undefined;
@@ -207,4 +216,4 @@ declare class SIOPv2RP implements IAgentPlugin {
207
216
  */
208
217
  declare const schema: any;
209
218
 
210
- 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, schema };
219
+ 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 IPresentationWithDefinition, 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, schema };
package/dist/index.d.ts CHANGED
@@ -1,22 +1,22 @@
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';
3
- import { CheckLinkedDomain } from '@sphereon/did-auth-siop-adapter';
2
+ import { ResponseURIType, ClaimPayloadCommonOpts, AuthorizationRequestPayload, RequestObjectPayload, AuthorizationRequestState, AuthorizationResponseState, AuthorizationResponsePayload, PresentationDefinitionWithLocation, VerifiedAuthorizationResponse, ResponseMode, SupportedVersion, IRPSessionManager, ClientMetadataOpts, VerifyJwtCallback, PresentationVerificationCallback, VPTokenLocation, VerifiablePresentationTypeFormat, RP, URI, AuthorizationRequest } from '@sphereon/did-auth-siop';
3
+ import { IIdentifierResolution, ManagedIdentifierOptsOrResult, ExternalIdentifierOIDFEntityIdOpts } from '@sphereon/ssi-sdk-ext.identifier-resolution';
4
+ import { AdditionalClaims, DcqlQueryREST, HasherSync, W3CVerifiablePresentation } from '@sphereon/ssi-types';
5
+ import { Resolvable } from 'did-resolver';
4
6
  import { DIDDocument } from '@sphereon/did-uni-client';
5
- import { JwtIssuer } from '@sphereon/oid4vc-common';
7
+ import { EventEmitter } from 'events';
6
8
  import { IPresentationDefinition } from '@sphereon/pex';
7
9
  import { IDIDOptions } from '@sphereon/ssi-sdk-ext.did-utils';
8
- import { IIdentifierResolution, ManagedIdentifierOptsOrResult, ExternalIdentifierOIDFEntityIdOpts } from '@sphereon/ssi-sdk-ext.identifier-resolution';
9
- import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
10
- import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation';
11
- import { ImDLMdoc } from '@sphereon/ssi-sdk.mdl-mdoc';
12
- import { IPDManager, VersionControlMode } from '@sphereon/ssi-sdk.pd-manager';
13
10
  import { IPresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange';
14
- import { ISDJwtPlugin } from '@sphereon/ssi-sdk.sd-jwt';
15
- import { AuthorizationRequestStateStatus } from '@sphereon/ssi-sdk.siopv2-oid4vp-common';
16
- import { AdditionalClaims, DcqlQueryREST, HasherSync } from '@sphereon/ssi-types';
17
11
  import { VerifyCallback } from '@sphereon/wellknown-dids-client';
18
- import { Resolvable } from 'did-resolver';
19
- import { EventEmitter } from 'events';
12
+ import { AuthorizationRequestStateStatus } from '@sphereon/ssi-sdk.siopv2-oid4vp-common';
13
+ import { IPDManager, VersionControlMode } from '@sphereon/ssi-sdk.pd-manager';
14
+ import { CheckLinkedDomain } from '@sphereon/did-auth-siop-adapter';
15
+ import { ISDJwtPlugin } from '@sphereon/ssi-sdk.sd-jwt';
16
+ import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
17
+ import { JwtIssuer } from '@sphereon/oid4vc-common';
18
+ import { ImDLMdoc } from '@sphereon/ssi-sdk.mdl-mdoc';
19
+ import { ICredentialValidation, SchemaValidation } from '@sphereon/ssi-sdk.credential-validation';
20
20
 
21
21
  declare enum VerifiedDataMode {
22
22
  NONE = "none",
@@ -41,8 +41,9 @@ interface ISiopv2RPOpts {
41
41
  interface IRPDefaultOpts extends IRPOptions {
42
42
  }
43
43
  interface ICreateAuthRequestArgs {
44
- definitionId: string;
44
+ queryId: string;
45
45
  correlationId: string;
46
+ useQueryIdInstance?: boolean;
46
47
  responseURIType: ResponseURIType;
47
48
  responseURI: string;
48
49
  responseRedirectURI?: string;
@@ -54,31 +55,32 @@ interface ICreateAuthRequestArgs {
54
55
  }
55
56
  interface IGetAuthRequestStateArgs {
56
57
  correlationId: string;
57
- definitionId: string;
58
+ queryId?: string;
58
59
  errorOnNotFound?: boolean;
59
60
  }
60
61
  interface IGetAuthResponseStateArgs {
61
62
  correlationId: string;
62
- definitionId: string;
63
+ queryId?: string;
63
64
  errorOnNotFound?: boolean;
64
65
  progressRequestStateTo?: AuthorizationRequestStateStatus;
65
66
  includeVerifiedData?: VerifiedDataMode;
66
67
  }
67
68
  interface IUpdateRequestStateArgs {
68
- definitionId: string;
69
+ queryId: string;
69
70
  correlationId: string;
70
71
  state: AuthorizationRequestStateStatus;
71
72
  error?: string;
72
73
  }
73
74
  interface IDeleteAuthStateArgs {
74
75
  correlationId: string;
75
- definitionId: string;
76
+ queryId?: string;
76
77
  }
77
78
  interface IVerifyAuthResponseStateArgs {
78
79
  authorizationResponse: string | AuthorizationResponsePayload;
79
- definitionId?: string;
80
+ queryId?: string;
80
81
  correlationId: string;
81
82
  audience?: string;
83
+ presentationDefinitions?: PresentationDefinitionWithLocation | PresentationDefinitionWithLocation[];
82
84
  dcqlQuery?: DcqlQueryREST;
83
85
  }
84
86
  interface IDefinitionPair {
@@ -86,14 +88,14 @@ interface IDefinitionPair {
86
88
  dcqlPayload?: DcqlQueryREST;
87
89
  }
88
90
  interface ImportDefinitionsArgs {
89
- definitions: Array<IDefinitionPair>;
91
+ queries: Array<IDefinitionPair>;
90
92
  tenantId?: string;
91
93
  version?: string;
92
94
  versionControlMode?: VersionControlMode;
93
95
  }
94
96
  interface IGetRedirectUriArgs {
95
97
  correlationId: string;
96
- definitionId?: string;
98
+ queryId?: string;
97
99
  state?: string;
98
100
  }
99
101
  interface IAuthorizationRequestPayloads {
@@ -106,7 +108,7 @@ interface IPEXDefinitionPersistArgs extends IPEXInstanceOptions {
106
108
  ttl?: number;
107
109
  }
108
110
  interface ISiopRPInstanceArgs {
109
- definitionId?: string;
111
+ queryId?: string;
110
112
  responseRedirectURI?: string;
111
113
  }
112
114
  interface IPEXInstanceOptions extends IPEXOptions {
@@ -127,7 +129,7 @@ interface IRPOptions {
127
129
  }
128
130
  interface IPEXOptions {
129
131
  presentationVerifyCallback?: PresentationVerificationCallback;
130
- definitionId: string;
132
+ queryId: string;
131
133
  version?: string;
132
134
  tenantId?: string;
133
135
  }
@@ -141,8 +143,15 @@ interface PerDidResolver {
141
143
  interface IAuthRequestDetails {
142
144
  rpDIDDocument?: DIDDocument;
143
145
  id: string;
146
+ verifiablePresentationMatches: IPresentationWithDefinition[];
144
147
  alsoKnownAs?: string[];
145
148
  }
149
+ interface IPresentationWithDefinition {
150
+ location: VPTokenLocation;
151
+ definition: PresentationDefinitionWithLocation;
152
+ format: VerifiablePresentationTypeFormat;
153
+ presentation: W3CVerifiablePresentation;
154
+ }
146
155
  interface ISIOPIdentifierOptions extends Omit<IDIDOptions, 'idOpts'> {
147
156
  idOpts: ManagedIdentifierOptsOrResult;
148
157
  oidfOpts?: ExternalIdentifierOIDFEntityIdOpts;
@@ -171,8 +180,8 @@ declare class RPInstance {
171
180
  hasDefinition(): boolean;
172
181
  get definitionId(): string | undefined;
173
182
  getPresentationDefinition(context: IRequiredContext): Promise<IPresentationDefinition | undefined>;
174
- createAuthorizationRequestURI(createArgs: Omit<ICreateAuthRequestArgs, 'definitionId'>, context: IRequiredContext): Promise<URI>;
175
- createAuthorizationRequest(createArgs: Omit<ICreateAuthRequestArgs, 'definitionId'>, context: IRequiredContext): Promise<AuthorizationRequest>;
183
+ createAuthorizationRequestURI(createArgs: Omit<ICreateAuthRequestArgs, 'queryId'>, context: IRequiredContext): Promise<URI>;
184
+ createAuthorizationRequest(createArgs: Omit<ICreateAuthRequestArgs, 'queryId'>, context: IRequiredContext): Promise<AuthorizationRequest>;
176
185
  }
177
186
 
178
187
  declare class SIOPv2RP implements IAgentPlugin {
@@ -193,9 +202,9 @@ declare class SIOPv2RP implements IAgentPlugin {
193
202
  private siopVerifyAuthResponse;
194
203
  private siopImportDefinitions;
195
204
  private siopGetRedirectURI;
196
- getRPInstance({ definitionId, responseRedirectURI }: ISiopRPInstanceArgs, context: IRequiredContext): Promise<RPInstance>;
205
+ getRPInstance({ queryId, responseRedirectURI }: ISiopRPInstanceArgs, context: IRequiredContext): Promise<RPInstance>;
197
206
  getRPOptions(context: IRequiredContext, opts: {
198
- definitionId?: string;
207
+ queryId?: string;
199
208
  responseRedirectURI?: string;
200
209
  }): Promise<IRPOptions>;
201
210
  getInstanceOpts(definitionId?: string): IPEXInstanceOptions | undefined;
@@ -207,4 +216,4 @@ declare class SIOPv2RP implements IAgentPlugin {
207
216
  */
208
217
  declare const schema: any;
209
218
 
210
- 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, schema };
219
+ 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 IPresentationWithDefinition, 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, schema };
package/dist/index.js CHANGED
@@ -416,11 +416,11 @@ async function createRPBuilder(args) {
416
416
  const { identifierOpts } = rpOpts;
417
417
  let definition = args.definition;
418
418
  let dcqlQuery = args.dcql;
419
- if (!definition && pexOpts && pexOpts.definitionId) {
419
+ if (!definition && pexOpts && pexOpts.queryId) {
420
420
  const presentationDefinitionItems = await context.agent.pdmGetDefinitions({
421
421
  filter: [
422
422
  {
423
- definitionId: pexOpts.definitionId,
423
+ definitionId: pexOpts.queryId,
424
424
  version: pexOpts.version,
425
425
  tenantId: pexOpts.tenantId
426
426
  }
@@ -608,7 +608,7 @@ var RPInstance = class {
608
608
  return this.definitionId !== void 0;
609
609
  }
610
610
  get definitionId() {
611
- return this.pexOptions?.definitionId;
611
+ return this.pexOptions?.queryId;
612
612
  }
613
613
  async getPresentationDefinition(context) {
614
614
  return this.definitionId ? await context.agent.pexStoreGetDefinition({
@@ -730,30 +730,32 @@ var SIOPv2RP = class _SIOPv2RP {
730
730
  }
731
731
  async createAuthorizationRequestURI(createArgs, context) {
732
732
  return await this.getRPInstance({
733
- definitionId: createArgs.definitionId,
734
- responseRedirectURI: createArgs.responseRedirectURI
733
+ responseRedirectURI: createArgs.responseRedirectURI,
734
+ ...createArgs.useQueryIdInstance === true && {
735
+ queryId: createArgs.queryId
736
+ }
735
737
  }, context).then((rp) => rp.createAuthorizationRequestURI(createArgs, context)).then((URI) => URI.encodedUri);
736
738
  }
737
739
  async createAuthorizationRequestPayloads(createArgs, context) {
738
740
  return await this.getRPInstance({
739
- definitionId: createArgs.definitionId
741
+ queryId: createArgs.queryId
740
742
  }, context).then((rp) => rp.createAuthorizationRequest(createArgs, context)).then(async (request) => {
741
743
  const authRequest = {
742
744
  authorizationRequest: request.payload,
743
745
  requestObject: await request.requestObjectJwt(),
744
- requestObjectDecoded: await request.requestObject?.getPayload()
746
+ requestObjectDecoded: request.requestObject?.getPayload()
745
747
  };
746
748
  return authRequest;
747
749
  });
748
750
  }
749
751
  async siopGetRequestState(args, context) {
750
752
  return await this.getRPInstance({
751
- definitionId: args.definitionId
753
+ queryId: args.queryId
752
754
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.getRequestStateByCorrelationId(args.correlationId, args.errorOnNotFound)));
753
755
  }
754
756
  async siopGetResponseState(args, context) {
755
757
  const rpInstance = await this.getRPInstance({
756
- definitionId: args.definitionId
758
+ queryId: args.queryId
757
759
  }, context);
758
760
  const authorizationResponseState = await rpInstance.get(context).then((rp) => rp.sessionManager.getResponseStateByCorrelationId(args.correlationId, args.errorOnNotFound));
759
761
  if (authorizationResponseState === void 0) {
@@ -806,11 +808,11 @@ var SIOPv2RP = class _SIOPv2RP {
806
808
  }
807
809
  presentationOrClaimsFrom = /* @__PURE__ */ __name((presentationDecoded) => CredentialMapper2.isSdJwtDecodedCredential(presentationDecoded) ? presentationDecoded.decodedPayload : CredentialMapper2.toUniformPresentation(presentationDecoded), "presentationOrClaimsFrom");
808
810
  async siopUpdateRequestState(args, context) {
809
- if (args.state !== "sent") {
810
- throw Error(`Only 'sent' status is supported for this method at this point`);
811
+ if (args.state !== "authorization_request_created") {
812
+ throw Error(`Only 'authorization_request_created' status is supported for this method at this point`);
811
813
  }
812
814
  return await this.getRPInstance({
813
- definitionId: args.definitionId
815
+ queryId: args.queryId
814
816
  }, context).then((rp) => rp.get(context).then(async (rp2) => {
815
817
  await rp2.signalAuthRequestRetrieved({
816
818
  correlationId: args.correlationId,
@@ -821,7 +823,7 @@ var SIOPv2RP = class _SIOPv2RP {
821
823
  }
822
824
  async siopDeleteState(args, context) {
823
825
  return await this.getRPInstance({
824
- definitionId: args.definitionId
826
+ queryId: args.queryId
825
827
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.deleteStateForCorrelationId(args.correlationId))).then(() => true);
826
828
  }
827
829
  async siopVerifyAuthResponse(args, context) {
@@ -830,9 +832,12 @@ var SIOPv2RP = class _SIOPv2RP {
830
832
  }
831
833
  const authResponse = typeof args.authorizationResponse === "string" ? decodeUriAsJson(args.authorizationResponse) : args.authorizationResponse;
832
834
  return await this.getRPInstance({
833
- definitionId: args.definitionId
835
+ queryId: args.queryId
834
836
  }, context).then((rp) => rp.get(context).then((rp2) => rp2.verifyAuthorizationResponse(authResponse, {
835
837
  correlationId: args.correlationId,
838
+ ...args.presentationDefinitions && !args.dcqlQuery ? {
839
+ presentationDefinitions: args.presentationDefinitions
840
+ } : {},
836
841
  ...args.dcqlQuery ? {
837
842
  dcqlQuery: args.dcqlQuery
838
843
  } : {},
@@ -840,8 +845,8 @@ var SIOPv2RP = class _SIOPv2RP {
840
845
  })));
841
846
  }
842
847
  async siopImportDefinitions(args, context) {
843
- const { definitions, tenantId, version, versionControlMode } = args;
844
- await Promise.all(definitions.map(async (definitionPair) => {
848
+ const { queries, tenantId, version, versionControlMode } = args;
849
+ await Promise.all(queries.map(async (definitionPair) => {
845
850
  const definitionPayload = definitionPair.definitionPayload;
846
851
  await context.agent.pexValidateDefinition({
847
852
  definition: definitionPayload
@@ -861,7 +866,7 @@ var SIOPv2RP = class _SIOPv2RP {
861
866
  }));
862
867
  }
863
868
  async siopGetRedirectURI(args, context) {
864
- const instanceId = args.definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
869
+ const instanceId = args.queryId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
865
870
  if (this.instances.has(instanceId)) {
866
871
  const rpInstance = this.instances.get(instanceId);
867
872
  if (rpInstance !== void 0) {
@@ -877,12 +882,12 @@ var SIOPv2RP = class _SIOPv2RP {
877
882
  }
878
883
  return void 0;
879
884
  }
880
- async getRPInstance({ definitionId, responseRedirectURI }, context) {
881
- const instanceId = definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
885
+ async getRPInstance({ queryId, responseRedirectURI }, context) {
886
+ const instanceId = queryId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
882
887
  if (!this.instances.has(instanceId)) {
883
- const instanceOpts = this.getInstanceOpts(definitionId);
888
+ const instanceOpts = this.getInstanceOpts(queryId);
884
889
  const rpOpts = await this.getRPOptions(context, {
885
- definitionId,
890
+ queryId,
886
891
  responseRedirectURI
887
892
  });
888
893
  if (!rpOpts.identifierOpts.resolveOpts?.resolver || typeof rpOpts.identifierOpts.resolveOpts.resolver.resolve !== "function") {
@@ -894,7 +899,7 @@ var SIOPv2RP = class _SIOPv2RP {
894
899
  ...rpOpts.identifierOpts.resolveOpts
895
900
  };
896
901
  }
897
- console.log("Using agent DID resolver for RP instance with definition id " + definitionId);
902
+ console.log("Using agent DID resolver for RP instance with definition id " + queryId);
898
903
  rpOpts.identifierOpts.resolveOpts.resolver = getAgentResolver2(context, {
899
904
  uniresolverResolution: true,
900
905
  localResolution: true,
@@ -913,10 +918,10 @@ var SIOPv2RP = class _SIOPv2RP {
913
918
  return rpInstance;
914
919
  }
915
920
  async getRPOptions(context, opts) {
916
- const { definitionId, responseRedirectURI } = opts;
917
- const options = this.getInstanceOpts(definitionId)?.rpOpts ?? this.opts.defaultOpts;
921
+ const { queryId, responseRedirectURI } = opts;
922
+ const options = this.getInstanceOpts(queryId)?.rpOpts ?? this.opts.defaultOpts;
918
923
  if (!options) {
919
- throw Error(`Could not get specific nor default options for definition ${definitionId}`);
924
+ throw Error(`Could not get specific nor default options for definition ${queryId}`);
920
925
  }
921
926
  if (this.opts.defaultOpts) {
922
927
  if (!options.identifierOpts) {
@@ -950,18 +955,18 @@ var SIOPv2RP = class _SIOPv2RP {
950
955
  }
951
956
  getInstanceOpts(definitionId) {
952
957
  if (!this.opts.instanceOpts) return void 0;
953
- const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.definitionId === definitionId) : void 0;
958
+ const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.queryId === definitionId) : void 0;
954
959
  return instanceOpt ?? this.getDefaultOptions(definitionId);
955
960
  }
956
961
  getDefaultOptions(definitionId) {
957
962
  if (!this.opts.instanceOpts) return void 0;
958
- const defaultOptions = this.opts.instanceOpts.find((i) => i.definitionId === "default");
963
+ const defaultOptions = this.opts.instanceOpts.find((i) => i.queryId === "default");
959
964
  if (defaultOptions) {
960
965
  const clonedOptions = {
961
966
  ...defaultOptions
962
967
  };
963
968
  if (definitionId !== void 0) {
964
- clonedOptions.definitionId = definitionId;
969
+ clonedOptions.queryId = definitionId;
965
970
  }
966
971
  return clonedOptions;
967
972
  }
@@ -970,12 +975,12 @@ var SIOPv2RP = class _SIOPv2RP {
970
975
  };
971
976
 
972
977
  // src/types/ISIOPv2RP.ts
973
- var VerifiedDataMode = /* @__PURE__ */ function(VerifiedDataMode2) {
978
+ var VerifiedDataMode = /* @__PURE__ */ (function(VerifiedDataMode2) {
974
979
  VerifiedDataMode2["NONE"] = "none";
975
980
  VerifiedDataMode2["VERIFIED_PRESENTATION"] = "vp";
976
981
  VerifiedDataMode2["CREDENTIAL_SUBJECT_FLATTENED"] = "cs-flat";
977
982
  return VerifiedDataMode2;
978
- }({});
983
+ })({});
979
984
 
980
985
  // src/index.ts
981
986
  var schema = require_plugin_schema();