@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth 0.34.1-feature.SSISDK.46.40 → 0.34.1-feature.SSISDK.50.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +50 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -40
- package/dist/index.d.ts +31 -40
- package/dist/index.js +50 -41
- package/dist/index.js.map +1 -1
- package/package.json +19 -19
- package/src/RPInstance.ts +3 -3
- package/src/agent/SIOPv2RP.ts +45 -33
- package/src/functions.ts +2 -2
- package/src/types/ISIOPv2RP.ts +27 -40
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,
|
|
3
|
-
import {
|
|
4
|
-
import { AdditionalClaims, DcqlQueryREST, HasherSync, W3CVerifiablePresentation } from '@sphereon/ssi-types';
|
|
5
|
-
import { Resolvable } from 'did-resolver';
|
|
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';
|
|
6
4
|
import { DIDDocument } from '@sphereon/did-uni-client';
|
|
7
|
-
import {
|
|
5
|
+
import { JwtIssuer } from '@sphereon/oid4vc-common';
|
|
8
6
|
import { IPresentationDefinition } from '@sphereon/pex';
|
|
9
7
|
import { IDIDOptions } from '@sphereon/ssi-sdk-ext.did-utils';
|
|
10
|
-
import {
|
|
11
|
-
import { VerifyCallback } from '@sphereon/wellknown-dids-client';
|
|
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';
|
|
8
|
+
import { IIdentifierResolution, ManagedIdentifierOptsOrResult, ExternalIdentifierOIDFEntityIdOpts } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
16
9
|
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
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
|
+
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, DcqlQueryPayload, HasherSync } from '@sphereon/ssi-types';
|
|
17
|
+
import { VerifyCallback } from '@sphereon/wellknown-dids-client';
|
|
18
|
+
import { Resolvable } from 'did-resolver';
|
|
19
|
+
import { EventEmitter } from 'events';
|
|
20
20
|
|
|
21
21
|
declare enum VerifiedDataMode {
|
|
22
22
|
NONE = "none",
|
|
@@ -41,9 +41,8 @@ interface ISiopv2RPOpts {
|
|
|
41
41
|
interface IRPDefaultOpts extends IRPOptions {
|
|
42
42
|
}
|
|
43
43
|
interface ICreateAuthRequestArgs {
|
|
44
|
-
|
|
44
|
+
definitionId: string;
|
|
45
45
|
correlationId: string;
|
|
46
|
-
useQueryIdInstance?: boolean;
|
|
47
46
|
responseURIType: ResponseURIType;
|
|
48
47
|
responseURI: string;
|
|
49
48
|
responseRedirectURI?: string;
|
|
@@ -55,47 +54,46 @@ interface ICreateAuthRequestArgs {
|
|
|
55
54
|
}
|
|
56
55
|
interface IGetAuthRequestStateArgs {
|
|
57
56
|
correlationId: string;
|
|
58
|
-
|
|
57
|
+
definitionId: string;
|
|
59
58
|
errorOnNotFound?: boolean;
|
|
60
59
|
}
|
|
61
60
|
interface IGetAuthResponseStateArgs {
|
|
62
61
|
correlationId: string;
|
|
63
|
-
|
|
62
|
+
definitionId: string;
|
|
64
63
|
errorOnNotFound?: boolean;
|
|
65
64
|
progressRequestStateTo?: AuthorizationRequestStateStatus;
|
|
66
65
|
includeVerifiedData?: VerifiedDataMode;
|
|
67
66
|
}
|
|
68
67
|
interface IUpdateRequestStateArgs {
|
|
69
|
-
|
|
68
|
+
definitionId: string;
|
|
70
69
|
correlationId: string;
|
|
71
70
|
state: AuthorizationRequestStateStatus;
|
|
72
71
|
error?: string;
|
|
73
72
|
}
|
|
74
73
|
interface IDeleteAuthStateArgs {
|
|
75
74
|
correlationId: string;
|
|
76
|
-
|
|
75
|
+
definitionId: string;
|
|
77
76
|
}
|
|
78
77
|
interface IVerifyAuthResponseStateArgs {
|
|
79
78
|
authorizationResponse: string | AuthorizationResponsePayload;
|
|
80
|
-
|
|
79
|
+
definitionId?: string;
|
|
81
80
|
correlationId: string;
|
|
82
81
|
audience?: string;
|
|
83
|
-
|
|
84
|
-
dcqlQuery?: DcqlQueryREST;
|
|
82
|
+
dcqlQueryPayload?: DcqlQueryPayload;
|
|
85
83
|
}
|
|
86
84
|
interface IDefinitionPair {
|
|
87
|
-
definitionPayload
|
|
88
|
-
dcqlPayload?:
|
|
85
|
+
definitionPayload?: IPresentationDefinition;
|
|
86
|
+
dcqlPayload?: DcqlQueryPayload;
|
|
89
87
|
}
|
|
90
88
|
interface ImportDefinitionsArgs {
|
|
91
|
-
|
|
89
|
+
definitions: Array<IDefinitionPair>;
|
|
92
90
|
tenantId?: string;
|
|
93
91
|
version?: string;
|
|
94
92
|
versionControlMode?: VersionControlMode;
|
|
95
93
|
}
|
|
96
94
|
interface IGetRedirectUriArgs {
|
|
97
95
|
correlationId: string;
|
|
98
|
-
|
|
96
|
+
definitionId?: string;
|
|
99
97
|
state?: string;
|
|
100
98
|
}
|
|
101
99
|
interface IAuthorizationRequestPayloads {
|
|
@@ -108,7 +106,7 @@ interface IPEXDefinitionPersistArgs extends IPEXInstanceOptions {
|
|
|
108
106
|
ttl?: number;
|
|
109
107
|
}
|
|
110
108
|
interface ISiopRPInstanceArgs {
|
|
111
|
-
|
|
109
|
+
definitionId?: string;
|
|
112
110
|
responseRedirectURI?: string;
|
|
113
111
|
}
|
|
114
112
|
interface IPEXInstanceOptions extends IPEXOptions {
|
|
@@ -129,7 +127,7 @@ interface IRPOptions {
|
|
|
129
127
|
}
|
|
130
128
|
interface IPEXOptions {
|
|
131
129
|
presentationVerifyCallback?: PresentationVerificationCallback;
|
|
132
|
-
|
|
130
|
+
definitionId: string;
|
|
133
131
|
version?: string;
|
|
134
132
|
tenantId?: string;
|
|
135
133
|
}
|
|
@@ -143,15 +141,8 @@ interface PerDidResolver {
|
|
|
143
141
|
interface IAuthRequestDetails {
|
|
144
142
|
rpDIDDocument?: DIDDocument;
|
|
145
143
|
id: string;
|
|
146
|
-
verifiablePresentationMatches: IPresentationWithDefinition[];
|
|
147
144
|
alsoKnownAs?: string[];
|
|
148
145
|
}
|
|
149
|
-
interface IPresentationWithDefinition {
|
|
150
|
-
location: VPTokenLocation;
|
|
151
|
-
definition: PresentationDefinitionWithLocation;
|
|
152
|
-
format: VerifiablePresentationTypeFormat;
|
|
153
|
-
presentation: W3CVerifiablePresentation;
|
|
154
|
-
}
|
|
155
146
|
interface ISIOPIdentifierOptions extends Omit<IDIDOptions, 'idOpts'> {
|
|
156
147
|
idOpts: ManagedIdentifierOptsOrResult;
|
|
157
148
|
oidfOpts?: ExternalIdentifierOIDFEntityIdOpts;
|
|
@@ -180,8 +171,8 @@ declare class RPInstance {
|
|
|
180
171
|
hasDefinition(): boolean;
|
|
181
172
|
get definitionId(): string | undefined;
|
|
182
173
|
getPresentationDefinition(context: IRequiredContext): Promise<IPresentationDefinition | undefined>;
|
|
183
|
-
createAuthorizationRequestURI(createArgs: Omit<ICreateAuthRequestArgs, '
|
|
184
|
-
createAuthorizationRequest(createArgs: Omit<ICreateAuthRequestArgs, '
|
|
174
|
+
createAuthorizationRequestURI(createArgs: Omit<ICreateAuthRequestArgs, 'definitionId'>, context: IRequiredContext): Promise<URI>;
|
|
175
|
+
createAuthorizationRequest(createArgs: Omit<ICreateAuthRequestArgs, 'definitionId'>, context: IRequiredContext): Promise<AuthorizationRequest>;
|
|
185
176
|
}
|
|
186
177
|
|
|
187
178
|
declare class SIOPv2RP implements IAgentPlugin {
|
|
@@ -202,9 +193,9 @@ declare class SIOPv2RP implements IAgentPlugin {
|
|
|
202
193
|
private siopVerifyAuthResponse;
|
|
203
194
|
private siopImportDefinitions;
|
|
204
195
|
private siopGetRedirectURI;
|
|
205
|
-
getRPInstance({
|
|
196
|
+
getRPInstance({ definitionId, responseRedirectURI }: ISiopRPInstanceArgs, context: IRequiredContext): Promise<RPInstance>;
|
|
206
197
|
getRPOptions(context: IRequiredContext, opts: {
|
|
207
|
-
|
|
198
|
+
definitionId?: string;
|
|
208
199
|
responseRedirectURI?: string;
|
|
209
200
|
}): Promise<IRPOptions>;
|
|
210
201
|
getInstanceOpts(definitionId?: string): IPEXInstanceOptions | undefined;
|
|
@@ -216,4 +207,4 @@ declare class SIOPv2RP implements IAgentPlugin {
|
|
|
216
207
|
*/
|
|
217
208
|
declare const schema: any;
|
|
218
209
|
|
|
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
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -344,6 +344,7 @@ var require_plugin_schema = __commonJS({
|
|
|
344
344
|
import { AuthorizationResponseStateStatus, decodeUriAsJson } from "@sphereon/did-auth-siop";
|
|
345
345
|
import { getAgentResolver as getAgentResolver2 } from "@sphereon/ssi-sdk-ext.did-utils";
|
|
346
346
|
import { CredentialMapper as CredentialMapper2 } from "@sphereon/ssi-types";
|
|
347
|
+
import { DcqlQuery } from "dcql";
|
|
347
348
|
|
|
348
349
|
// src/functions.ts
|
|
349
350
|
import { InMemoryRPSessionManager, PassBy, PropertyTarget, ResponseMode, ResponseType, RevocationVerification, RP, Scope, SubjectType, SupportedVersion } from "@sphereon/did-auth-siop";
|
|
@@ -416,11 +417,11 @@ async function createRPBuilder(args) {
|
|
|
416
417
|
const { identifierOpts } = rpOpts;
|
|
417
418
|
let definition = args.definition;
|
|
418
419
|
let dcqlQuery = args.dcql;
|
|
419
|
-
if (!definition && pexOpts && pexOpts.
|
|
420
|
+
if (!definition && pexOpts && pexOpts.definitionId) {
|
|
420
421
|
const presentationDefinitionItems = await context.agent.pdmGetDefinitions({
|
|
421
422
|
filter: [
|
|
422
423
|
{
|
|
423
|
-
definitionId: pexOpts.
|
|
424
|
+
definitionId: pexOpts.definitionId,
|
|
424
425
|
version: pexOpts.version,
|
|
425
426
|
tenantId: pexOpts.tenantId
|
|
426
427
|
}
|
|
@@ -608,7 +609,7 @@ var RPInstance = class {
|
|
|
608
609
|
return this.definitionId !== void 0;
|
|
609
610
|
}
|
|
610
611
|
get definitionId() {
|
|
611
|
-
return this.pexOptions?.
|
|
612
|
+
return this.pexOptions?.definitionId;
|
|
612
613
|
}
|
|
613
614
|
async getPresentationDefinition(context) {
|
|
614
615
|
return this.definitionId ? await context.agent.pexStoreGetDefinition({
|
|
@@ -730,32 +731,30 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
730
731
|
}
|
|
731
732
|
async createAuthorizationRequestURI(createArgs, context) {
|
|
732
733
|
return await this.getRPInstance({
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
queryId: createArgs.queryId
|
|
736
|
-
}
|
|
734
|
+
definitionId: createArgs.definitionId,
|
|
735
|
+
responseRedirectURI: createArgs.responseRedirectURI
|
|
737
736
|
}, context).then((rp) => rp.createAuthorizationRequestURI(createArgs, context)).then((URI) => URI.encodedUri);
|
|
738
737
|
}
|
|
739
738
|
async createAuthorizationRequestPayloads(createArgs, context) {
|
|
740
739
|
return await this.getRPInstance({
|
|
741
|
-
|
|
740
|
+
definitionId: createArgs.definitionId
|
|
742
741
|
}, context).then((rp) => rp.createAuthorizationRequest(createArgs, context)).then(async (request) => {
|
|
743
742
|
const authRequest = {
|
|
744
743
|
authorizationRequest: request.payload,
|
|
745
744
|
requestObject: await request.requestObjectJwt(),
|
|
746
|
-
requestObjectDecoded: request.requestObject?.getPayload()
|
|
745
|
+
requestObjectDecoded: await request.requestObject?.getPayload()
|
|
747
746
|
};
|
|
748
747
|
return authRequest;
|
|
749
748
|
});
|
|
750
749
|
}
|
|
751
750
|
async siopGetRequestState(args, context) {
|
|
752
751
|
return await this.getRPInstance({
|
|
753
|
-
|
|
752
|
+
definitionId: args.definitionId
|
|
754
753
|
}, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.getRequestStateByCorrelationId(args.correlationId, args.errorOnNotFound)));
|
|
755
754
|
}
|
|
756
755
|
async siopGetResponseState(args, context) {
|
|
757
756
|
const rpInstance = await this.getRPInstance({
|
|
758
|
-
|
|
757
|
+
definitionId: args.definitionId
|
|
759
758
|
}, context);
|
|
760
759
|
const authorizationResponseState = await rpInstance.get(context).then((rp) => rp.sessionManager.getResponseStateByCorrelationId(args.correlationId, args.errorOnNotFound));
|
|
761
760
|
if (authorizationResponseState === void 0) {
|
|
@@ -808,11 +807,11 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
808
807
|
}
|
|
809
808
|
presentationOrClaimsFrom = /* @__PURE__ */ __name((presentationDecoded) => CredentialMapper2.isSdJwtDecodedCredential(presentationDecoded) ? presentationDecoded.decodedPayload : CredentialMapper2.toUniformPresentation(presentationDecoded), "presentationOrClaimsFrom");
|
|
810
809
|
async siopUpdateRequestState(args, context) {
|
|
811
|
-
if (args.state !== "
|
|
812
|
-
throw Error(`Only '
|
|
810
|
+
if (args.state !== "sent") {
|
|
811
|
+
throw Error(`Only 'sent' status is supported for this method at this point`);
|
|
813
812
|
}
|
|
814
813
|
return await this.getRPInstance({
|
|
815
|
-
|
|
814
|
+
definitionId: args.definitionId
|
|
816
815
|
}, context).then((rp) => rp.get(context).then(async (rp2) => {
|
|
817
816
|
await rp2.signalAuthRequestRetrieved({
|
|
818
817
|
correlationId: args.correlationId,
|
|
@@ -823,7 +822,7 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
823
822
|
}
|
|
824
823
|
async siopDeleteState(args, context) {
|
|
825
824
|
return await this.getRPInstance({
|
|
826
|
-
|
|
825
|
+
definitionId: args.definitionId
|
|
827
826
|
}, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.deleteStateForCorrelationId(args.correlationId))).then(() => true);
|
|
828
827
|
}
|
|
829
828
|
async siopVerifyAuthResponse(args, context) {
|
|
@@ -832,28 +831,38 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
832
831
|
}
|
|
833
832
|
const authResponse = typeof args.authorizationResponse === "string" ? decodeUriAsJson(args.authorizationResponse) : args.authorizationResponse;
|
|
834
833
|
return await this.getRPInstance({
|
|
835
|
-
|
|
834
|
+
definitionId: args.definitionId
|
|
836
835
|
}, context).then((rp) => rp.get(context).then((rp2) => rp2.verifyAuthorizationResponse(authResponse, {
|
|
837
836
|
correlationId: args.correlationId,
|
|
838
|
-
...args.
|
|
839
|
-
|
|
840
|
-
} : {},
|
|
841
|
-
...args.dcqlQuery ? {
|
|
842
|
-
dcqlQuery: args.dcqlQuery
|
|
837
|
+
...args.dcqlQueryPayload ? {
|
|
838
|
+
dcqlQuery: args.dcqlQueryPayload.dcqlQuery
|
|
843
839
|
} : {},
|
|
844
840
|
audience: args.audience
|
|
845
841
|
})));
|
|
846
842
|
}
|
|
847
843
|
async siopImportDefinitions(args, context) {
|
|
848
|
-
const {
|
|
849
|
-
await Promise.all(
|
|
844
|
+
const { definitions, tenantId, version, versionControlMode } = args;
|
|
845
|
+
await Promise.all(definitions.map(async (definitionPair) => {
|
|
850
846
|
const definitionPayload = definitionPair.definitionPayload;
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
}
|
|
854
|
-
|
|
847
|
+
if (!definitionPayload && !definitionPair.dcqlPayload) {
|
|
848
|
+
return Promise.reject(Error("Either dcqlPayload or definitionPayload must be suppplied"));
|
|
849
|
+
}
|
|
850
|
+
let definitionId;
|
|
851
|
+
if (definitionPair.dcqlPayload) {
|
|
852
|
+
DcqlQuery.validate(definitionPair.dcqlPayload.dcqlQuery);
|
|
853
|
+
console.log(`persisting DCQL definition ${definitionPair.dcqlPayload.queryId} with versionControlMode ${versionControlMode}`);
|
|
854
|
+
definitionId = definitionPair.dcqlPayload.queryId;
|
|
855
|
+
}
|
|
856
|
+
if (definitionPayload) {
|
|
857
|
+
await context.agent.pexValidateDefinition({
|
|
858
|
+
definition: definitionPayload
|
|
859
|
+
});
|
|
860
|
+
console.log(`persisting PEX definition ${definitionPayload.id} / ${definitionPayload.name} with versionControlMode ${versionControlMode}`);
|
|
861
|
+
definitionId = definitionPayload.id;
|
|
862
|
+
}
|
|
855
863
|
return context.agent.pdmPersistDefinition({
|
|
856
864
|
definitionItem: {
|
|
865
|
+
definitionId,
|
|
857
866
|
tenantId,
|
|
858
867
|
version,
|
|
859
868
|
definitionPayload,
|
|
@@ -866,7 +875,7 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
866
875
|
}));
|
|
867
876
|
}
|
|
868
877
|
async siopGetRedirectURI(args, context) {
|
|
869
|
-
const instanceId = args.
|
|
878
|
+
const instanceId = args.definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
|
|
870
879
|
if (this.instances.has(instanceId)) {
|
|
871
880
|
const rpInstance = this.instances.get(instanceId);
|
|
872
881
|
if (rpInstance !== void 0) {
|
|
@@ -882,12 +891,12 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
882
891
|
}
|
|
883
892
|
return void 0;
|
|
884
893
|
}
|
|
885
|
-
async getRPInstance({
|
|
886
|
-
const instanceId =
|
|
894
|
+
async getRPInstance({ definitionId, responseRedirectURI }, context) {
|
|
895
|
+
const instanceId = definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
|
|
887
896
|
if (!this.instances.has(instanceId)) {
|
|
888
|
-
const instanceOpts = this.getInstanceOpts(
|
|
897
|
+
const instanceOpts = this.getInstanceOpts(definitionId);
|
|
889
898
|
const rpOpts = await this.getRPOptions(context, {
|
|
890
|
-
|
|
899
|
+
definitionId,
|
|
891
900
|
responseRedirectURI
|
|
892
901
|
});
|
|
893
902
|
if (!rpOpts.identifierOpts.resolveOpts?.resolver || typeof rpOpts.identifierOpts.resolveOpts.resolver.resolve !== "function") {
|
|
@@ -899,7 +908,7 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
899
908
|
...rpOpts.identifierOpts.resolveOpts
|
|
900
909
|
};
|
|
901
910
|
}
|
|
902
|
-
console.log("Using agent DID resolver for RP instance with definition id " +
|
|
911
|
+
console.log("Using agent DID resolver for RP instance with definition id " + definitionId);
|
|
903
912
|
rpOpts.identifierOpts.resolveOpts.resolver = getAgentResolver2(context, {
|
|
904
913
|
uniresolverResolution: true,
|
|
905
914
|
localResolution: true,
|
|
@@ -918,10 +927,10 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
918
927
|
return rpInstance;
|
|
919
928
|
}
|
|
920
929
|
async getRPOptions(context, opts) {
|
|
921
|
-
const {
|
|
922
|
-
const options = this.getInstanceOpts(
|
|
930
|
+
const { definitionId, responseRedirectURI } = opts;
|
|
931
|
+
const options = this.getInstanceOpts(definitionId)?.rpOpts ?? this.opts.defaultOpts;
|
|
923
932
|
if (!options) {
|
|
924
|
-
throw Error(`Could not get specific nor default options for definition ${
|
|
933
|
+
throw Error(`Could not get specific nor default options for definition ${definitionId}`);
|
|
925
934
|
}
|
|
926
935
|
if (this.opts.defaultOpts) {
|
|
927
936
|
if (!options.identifierOpts) {
|
|
@@ -955,18 +964,18 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
955
964
|
}
|
|
956
965
|
getInstanceOpts(definitionId) {
|
|
957
966
|
if (!this.opts.instanceOpts) return void 0;
|
|
958
|
-
const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.
|
|
967
|
+
const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.definitionId === definitionId) : void 0;
|
|
959
968
|
return instanceOpt ?? this.getDefaultOptions(definitionId);
|
|
960
969
|
}
|
|
961
970
|
getDefaultOptions(definitionId) {
|
|
962
971
|
if (!this.opts.instanceOpts) return void 0;
|
|
963
|
-
const defaultOptions = this.opts.instanceOpts.find((i) => i.
|
|
972
|
+
const defaultOptions = this.opts.instanceOpts.find((i) => i.definitionId === "default");
|
|
964
973
|
if (defaultOptions) {
|
|
965
974
|
const clonedOptions = {
|
|
966
975
|
...defaultOptions
|
|
967
976
|
};
|
|
968
977
|
if (definitionId !== void 0) {
|
|
969
|
-
clonedOptions.
|
|
978
|
+
clonedOptions.definitionId = definitionId;
|
|
970
979
|
}
|
|
971
980
|
return clonedOptions;
|
|
972
981
|
}
|
|
@@ -975,12 +984,12 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
975
984
|
};
|
|
976
985
|
|
|
977
986
|
// src/types/ISIOPv2RP.ts
|
|
978
|
-
var VerifiedDataMode = /* @__PURE__ */
|
|
987
|
+
var VerifiedDataMode = /* @__PURE__ */ function(VerifiedDataMode2) {
|
|
979
988
|
VerifiedDataMode2["NONE"] = "none";
|
|
980
989
|
VerifiedDataMode2["VERIFIED_PRESENTATION"] = "vp";
|
|
981
990
|
VerifiedDataMode2["CREDENTIAL_SUBJECT_FLATTENED"] = "cs-flat";
|
|
982
991
|
return VerifiedDataMode2;
|
|
983
|
-
}
|
|
992
|
+
}({});
|
|
984
993
|
|
|
985
994
|
// src/index.ts
|
|
986
995
|
var schema = require_plugin_schema();
|