@credo-ts/openid4vc 0.5.0-alpha.153 → 0.5.0-alpha.155
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/build/openid4vc-holder/OpenId4VciHolderService.js +3 -1
- package/build/openid4vc-holder/OpenId4VciHolderService.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.d.ts +9 -0
- package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.js +14 -0
- package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.js.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.d.ts +12 -19
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.js +15 -27
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerEvents.d.ts +13 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerEvents.js +8 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerEvents.js.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js +3 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.d.ts +7 -9
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js +11 -33
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerService.d.ts +24 -10
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js +76 -65
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts +1 -11
- package/build/openid4vc-issuer/index.d.ts +2 -0
- package/build/openid4vc-issuer/index.js +2 -0
- package/build/openid4vc-issuer/index.js.map +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcCNonceStateManager.d.ts +17 -0
- package/build/openid4vc-issuer/repository/OpenId4VcCNonceStateManager.js +90 -0
- package/build/openid4vc-issuer/repository/OpenId4VcCNonceStateManager.js.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcCredentialOfferSessionStateManager.d.ts +21 -0
- package/build/openid4vc-issuer/repository/OpenId4VcCredentialOfferSessionStateManager.js +182 -0
- package/build/openid4vc-issuer/repository/OpenId4VcCredentialOfferSessionStateManager.js.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcCredentialOfferUriStateManager.d.ts +17 -0
- package/build/openid4vc-issuer/repository/OpenId4VcCredentialOfferUriStateManager.js +68 -0
- package/build/openid4vc-issuer/repository/OpenId4VcCredentialOfferUriStateManager.js.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.d.ts +79 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js +39 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.d.ts +5 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.js +29 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.js.map +1 -0
- package/build/openid4vc-issuer/repository/index.d.ts +2 -0
- package/build/openid4vc-issuer/repository/index.js +2 -0
- package/build/openid4vc-issuer/repository/index.js.map +1 -1
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js +15 -10
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/credentialEndpoint.js +22 -4
- package/build/openid4vc-issuer/router/credentialEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/credentialOfferEndpoint.d.ts +11 -0
- package/build/openid4vc-issuer/router/credentialOfferEndpoint.js +54 -0
- package/build/openid4vc-issuer/router/credentialOfferEndpoint.js.map +1 -0
- package/build/openid4vc-issuer/router/index.d.ts +1 -0
- package/build/openid4vc-issuer/router/index.js +3 -1
- package/build/openid4vc-issuer/router/index.js.map +1 -1
- package/build/openid4vc-issuer/router/verifyAccessToken.d.ts +3 -0
- package/build/openid4vc-issuer/router/verifyAccessToken.js +33 -0
- package/build/openid4vc-issuer/router/verifyAccessToken.js.map +1 -0
- package/build/openid4vc-issuer/util/credentialRequest.d.ts +5 -0
- package/build/openid4vc-issuer/util/credentialRequest.js +18 -0
- package/build/openid4vc-issuer/util/credentialRequest.js.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.d.ts +22 -6
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js +137 -57
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.d.ts +5 -4
- package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.d.ts +6 -0
- package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.js +11 -0
- package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.js.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.ts +17 -5
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js +19 -6
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierEvents.d.ts +13 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierEvents.js +8 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierEvents.js.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js +6 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.d.ts +4 -7
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js +6 -23
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js.map +1 -1
- package/build/openid4vc-verifier/index.d.ts +2 -0
- package/build/openid4vc-verifier/index.js +2 -0
- package/build/openid4vc-verifier/index.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.d.ts +50 -0
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js +229 -0
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.d.ts +19 -0
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js +146 -0
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.d.ts +61 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js +45 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.d.ts +5 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.js +29 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.js.map +1 -0
- package/build/openid4vc-verifier/repository/index.d.ts +2 -0
- package/build/openid4vc-verifier/repository/index.js +2 -0
- package/build/openid4vc-verifier/repository/index.js.map +1 -1
- package/build/openid4vc-verifier/router/authorizationEndpoint.js +9 -2
- package/build/openid4vc-verifier/router/authorizationEndpoint.js.map +1 -1
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.d.ts +11 -0
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js +59 -0
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js.map +1 -0
- package/build/shared/models/index.js.map +1 -1
- package/package.json +10 -9
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type { OpenId4VcSiopCreateAuthorizationRequestOptions, OpenId4VcSiopVerifyAuthorizationResponseOptions, OpenId4VcSiopCreateAuthorizationRequestReturn,
|
|
1
|
+
import type { OpenId4VcSiopCreateAuthorizationRequestOptions, OpenId4VcSiopVerifyAuthorizationResponseOptions, OpenId4VcSiopCreateAuthorizationRequestReturn, OpenId4VcSiopCreateVerifierOptions } from './OpenId4VcSiopVerifierServiceOptions';
|
|
2
|
+
import type { OpenId4VcVerificationSessionRecord } from './repository';
|
|
3
|
+
import type { OpenId4VcSiopAuthorizationResponsePayload } from '../shared';
|
|
4
|
+
import type { Query } from '@credo-ts/core';
|
|
2
5
|
import { AgentContext } from '@credo-ts/core';
|
|
3
6
|
import { OpenId4VcSiopVerifierService } from './OpenId4VcSiopVerifierService';
|
|
4
7
|
import { OpenId4VcVerifierModuleConfig } from './OpenId4VcVerifierModuleConfig';
|
|
@@ -17,11 +20,13 @@ export declare class OpenId4VcVerifierApi {
|
|
|
17
20
|
/**
|
|
18
21
|
* Retrieve a verifier record from storage by its verified id
|
|
19
22
|
*/
|
|
20
|
-
|
|
23
|
+
getVerifierByVerifierId(verifierId: string): Promise<import("./repository").OpenId4VcVerifierRecord>;
|
|
21
24
|
/**
|
|
22
25
|
* Create a new verifier and store the new verifier record.
|
|
23
26
|
*/
|
|
24
27
|
createVerifier(options?: OpenId4VcSiopCreateVerifierOptions): Promise<import("./repository").OpenId4VcVerifierRecord>;
|
|
28
|
+
findVerificationSessionsByQuery(query: Query<OpenId4VcVerificationSessionRecord>): Promise<OpenId4VcVerificationSessionRecord[]>;
|
|
29
|
+
getVerificationSessionById(verificationSessionId: string): Promise<OpenId4VcVerificationSessionRecord>;
|
|
25
30
|
/**
|
|
26
31
|
* Create an authorization request, acting as a Relying Party (RP).
|
|
27
32
|
*
|
|
@@ -42,7 +47,14 @@ export declare class OpenId4VcVerifierApi {
|
|
|
42
47
|
* It validates the ID Token, VP Token and the signature(s) of the received Verifiable Presentation(s)
|
|
43
48
|
* as well as that the structure of the Verifiable Presentation matches the provided presentation definition.
|
|
44
49
|
*/
|
|
45
|
-
verifyAuthorizationResponse({
|
|
46
|
-
|
|
47
|
-
}): Promise<OpenId4VcSiopVerifiedAuthorizationResponse
|
|
50
|
+
verifyAuthorizationResponse({ verificationSessionId, ...otherOptions }: OpenId4VcSiopVerifyAuthorizationResponseOptions & {
|
|
51
|
+
verificationSessionId: string;
|
|
52
|
+
}): Promise<import("./OpenId4VcSiopVerifierServiceOptions").OpenId4VcSiopVerifiedAuthorizationResponse & {
|
|
53
|
+
verificationSession: OpenId4VcVerificationSessionRecord;
|
|
54
|
+
}>;
|
|
55
|
+
getVerifiedAuthorizationResponse(verificationSessionId: string): Promise<import("./OpenId4VcSiopVerifierServiceOptions").OpenId4VcSiopVerifiedAuthorizationResponse>;
|
|
56
|
+
findVerificationSessionForAuthorizationResponse(options: {
|
|
57
|
+
authorizationResponse: OpenId4VcSiopAuthorizationResponsePayload;
|
|
58
|
+
verifierId?: string;
|
|
59
|
+
}): Promise<OpenId4VcVerificationSessionRecord | null>;
|
|
48
60
|
}
|
|
@@ -42,8 +42,8 @@ let OpenId4VcVerifierApi = class OpenId4VcVerifierApi {
|
|
|
42
42
|
/**
|
|
43
43
|
* Retrieve a verifier record from storage by its verified id
|
|
44
44
|
*/
|
|
45
|
-
async
|
|
46
|
-
return this.openId4VcSiopVerifierService.
|
|
45
|
+
async getVerifierByVerifierId(verifierId) {
|
|
46
|
+
return this.openId4VcSiopVerifierService.getVerifierByVerifierId(this.agentContext, verifierId);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Create a new verifier and store the new verifier record.
|
|
@@ -51,6 +51,12 @@ let OpenId4VcVerifierApi = class OpenId4VcVerifierApi {
|
|
|
51
51
|
async createVerifier(options) {
|
|
52
52
|
return this.openId4VcSiopVerifierService.createVerifier(this.agentContext, options);
|
|
53
53
|
}
|
|
54
|
+
async findVerificationSessionsByQuery(query) {
|
|
55
|
+
return this.openId4VcSiopVerifierService.findVerificationSessionsByQuery(this.agentContext, query);
|
|
56
|
+
}
|
|
57
|
+
async getVerificationSessionById(verificationSessionId) {
|
|
58
|
+
return this.openId4VcSiopVerifierService.getVerificationSessionById(this.agentContext, verificationSessionId);
|
|
59
|
+
}
|
|
54
60
|
/**
|
|
55
61
|
* Create an authorization request, acting as a Relying Party (RP).
|
|
56
62
|
*
|
|
@@ -64,7 +70,7 @@ let OpenId4VcVerifierApi = class OpenId4VcVerifierApi {
|
|
|
64
70
|
*/
|
|
65
71
|
async createAuthorizationRequest(_a) {
|
|
66
72
|
var { verifierId } = _a, otherOptions = __rest(_a, ["verifierId"]);
|
|
67
|
-
const verifier = await this.
|
|
73
|
+
const verifier = await this.getVerifierByVerifierId(verifierId);
|
|
68
74
|
return await this.openId4VcSiopVerifierService.createAuthorizationRequest(this.agentContext, Object.assign(Object.assign({}, otherOptions), { verifier }));
|
|
69
75
|
}
|
|
70
76
|
/**
|
|
@@ -74,9 +80,16 @@ let OpenId4VcVerifierApi = class OpenId4VcVerifierApi {
|
|
|
74
80
|
* as well as that the structure of the Verifiable Presentation matches the provided presentation definition.
|
|
75
81
|
*/
|
|
76
82
|
async verifyAuthorizationResponse(_a) {
|
|
77
|
-
var {
|
|
78
|
-
const
|
|
79
|
-
return await this.openId4VcSiopVerifierService.verifyAuthorizationResponse(this.agentContext, Object.assign(Object.assign({}, otherOptions), {
|
|
83
|
+
var { verificationSessionId } = _a, otherOptions = __rest(_a, ["verificationSessionId"]);
|
|
84
|
+
const verificationSession = await this.getVerificationSessionById(verificationSessionId);
|
|
85
|
+
return await this.openId4VcSiopVerifierService.verifyAuthorizationResponse(this.agentContext, Object.assign(Object.assign({}, otherOptions), { verificationSession }));
|
|
86
|
+
}
|
|
87
|
+
async getVerifiedAuthorizationResponse(verificationSessionId) {
|
|
88
|
+
const verificationSession = await this.getVerificationSessionById(verificationSessionId);
|
|
89
|
+
return this.openId4VcSiopVerifierService.getVerifiedAuthorizationResponse(verificationSession);
|
|
90
|
+
}
|
|
91
|
+
async findVerificationSessionForAuthorizationResponse(options) {
|
|
92
|
+
return this.openId4VcSiopVerifierService.findVerificationSessionForAuthorizationResponse(this.agentContext, options);
|
|
80
93
|
}
|
|
81
94
|
};
|
|
82
95
|
OpenId4VcVerifierApi = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenId4VcVerifierApi.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"OpenId4VcVerifierApi.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUA,yCAAyD;AAEzD,iFAA6E;AAC7E,mFAA+E;AAE/E;;GAEG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YACkB,MAAqC,EAC7C,YAA0B,EAC1B,4BAA0D;QAFlD,WAAM,GAAN,MAAM,CAA+B;QAC7C,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iCAA4B,GAA5B,4BAA4B,CAA8B;IACjE,CAAC;IAEJ;;OAEG;IACI,KAAK,CAAC,eAAe;QAC1B,OAAO,IAAI,CAAC,4BAA4B,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IAC7E,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,uBAAuB,CAAC,UAAkB;QACrD,OAAO,IAAI,CAAC,4BAA4B,CAAC,uBAAuB,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;IACjG,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,cAAc,CAAC,OAA4C;QACtE,OAAO,IAAI,CAAC,4BAA4B,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IACrF,CAAC;IAEM,KAAK,CAAC,+BAA+B,CAAC,KAAgD;QAC3F,OAAO,IAAI,CAAC,4BAA4B,CAAC,+BAA+B,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAA;IACpG,CAAC;IAEM,KAAK,CAAC,0BAA0B,CAAC,qBAA6B;QACnE,OAAO,IAAI,CAAC,4BAA4B,C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|
|
1
|
+
import type { OpenId4VcVerificationSessionState } from './OpenId4VcVerificationSessionState';
|
|
2
|
+
import type { OpenId4VcVerificationSessionRecord } from './repository';
|
|
3
|
+
import type { BaseEvent } from '@credo-ts/core';
|
|
4
|
+
export declare enum OpenId4VcVerifierEvents {
|
|
5
|
+
VerificationSessionStateChanged = "OpenId4VcVerifier.VerificationSessionStateChanged"
|
|
6
|
+
}
|
|
7
|
+
export interface OpenId4VcVerificationSessionStateChangedEvent extends BaseEvent {
|
|
8
|
+
type: typeof OpenId4VcVerifierEvents.VerificationSessionStateChanged;
|
|
9
|
+
payload: {
|
|
10
|
+
verificationSession: OpenId4VcVerificationSessionRecord;
|
|
11
|
+
previousState: OpenId4VcVerificationSessionState | null;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenId4VcVerifierEvents = void 0;
|
|
4
|
+
var OpenId4VcVerifierEvents;
|
|
5
|
+
(function (OpenId4VcVerifierEvents) {
|
|
6
|
+
OpenId4VcVerifierEvents["VerificationSessionStateChanged"] = "OpenId4VcVerifier.VerificationSessionStateChanged";
|
|
7
|
+
})(OpenId4VcVerifierEvents = exports.OpenId4VcVerifierEvents || (exports.OpenId4VcVerifierEvents = {}));
|
|
8
|
+
//# sourceMappingURL=OpenId4VcVerifierEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VcVerifierEvents.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierEvents.ts"],"names":[],"mappings":";;;AAIA,IAAY,uBAEX;AAFD,WAAY,uBAAuB;IACjC,gHAAqF,CAAA;AACvF,CAAC,EAFW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAElC"}
|
|
@@ -7,7 +7,9 @@ const OpenId4VcSiopVerifierService_1 = require("./OpenId4VcSiopVerifierService")
|
|
|
7
7
|
const OpenId4VcVerifierApi_1 = require("./OpenId4VcVerifierApi");
|
|
8
8
|
const OpenId4VcVerifierModuleConfig_1 = require("./OpenId4VcVerifierModuleConfig");
|
|
9
9
|
const repository_1 = require("./repository");
|
|
10
|
+
const OpenId4VcRelyingPartyEventEmitter_1 = require("./repository/OpenId4VcRelyingPartyEventEmitter");
|
|
10
11
|
const router_2 = require("./router");
|
|
12
|
+
const authorizationRequestEndpoint_1 = require("./router/authorizationRequestEndpoint");
|
|
11
13
|
/**
|
|
12
14
|
* @public
|
|
13
15
|
*/
|
|
@@ -29,6 +31,8 @@ class OpenId4VcVerifierModule {
|
|
|
29
31
|
dependencyManager.registerSingleton(OpenId4VcSiopVerifierService_1.OpenId4VcSiopVerifierService);
|
|
30
32
|
// Repository
|
|
31
33
|
dependencyManager.registerSingleton(repository_1.OpenId4VcVerifierRepository);
|
|
34
|
+
// Global event emitter
|
|
35
|
+
dependencyManager.registerSingleton(OpenId4VcRelyingPartyEventEmitter_1.OpenId4VcRelyingPartyEventHandler);
|
|
32
36
|
}
|
|
33
37
|
async initialize(rootAgentContext) {
|
|
34
38
|
this.configureRouter(rootAgentContext);
|
|
@@ -61,7 +65,7 @@ class OpenId4VcVerifierModule {
|
|
|
61
65
|
try {
|
|
62
66
|
agentContext = await (0, router_1.getAgentContextForActorId)(rootAgentContext, verifierId);
|
|
63
67
|
const verifierApi = agentContext.dependencyManager.resolve(OpenId4VcVerifierApi_1.OpenId4VcVerifierApi);
|
|
64
|
-
const verifier = await verifierApi.
|
|
68
|
+
const verifier = await verifierApi.getVerifierByVerifierId(verifierId);
|
|
65
69
|
req.requestContext = {
|
|
66
70
|
agentContext,
|
|
67
71
|
verifier,
|
|
@@ -80,6 +84,7 @@ class OpenId4VcVerifierModule {
|
|
|
80
84
|
contextRouter.use('/:verifierId', endpointRouter);
|
|
81
85
|
// Configure endpoints
|
|
82
86
|
(0, router_2.configureAuthorizationEndpoint)(endpointRouter, this.config.authorizationEndpoint);
|
|
87
|
+
(0, authorizationRequestEndpoint_1.configureAuthorizationRequestEndpoint)(endpointRouter, this.config.authorizationRequestEndpoint);
|
|
83
88
|
// First one will be called for all requests (when next is called)
|
|
84
89
|
contextRouter.use(async (req, _res, next) => {
|
|
85
90
|
const { agentContext } = (0, router_1.getRequestContext)(req);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenId4VcVerifierModule.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierModule.ts"],"names":[],"mappings":";;;AAKA,yCAA4C;AAE5C,6CAA8F;AAE9F,iFAA6E;AAC7E,iEAA6D;AAC7D,mFAA+E;AAC/E,6CAA0D;AAC1D,qCAAyD;
|
|
1
|
+
{"version":3,"file":"OpenId4VcVerifierModule.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierModule.ts"],"names":[],"mappings":";;;AAKA,yCAA4C;AAE5C,6CAA8F;AAE9F,iFAA6E;AAC7E,iEAA6D;AAC7D,mFAA+E;AAC/E,6CAA0D;AAC1D,sGAAkG;AAClG,qCAAyD;AACzD,wFAA6F;AAE7F;;GAEG;AACH,MAAa,uBAAuB;IAIlC,YAAmB,OAA6C;QAHhD,QAAG,GAAG,2CAAoB,CAAA;QAIxC,IAAI,CAAC,MAAM,GAAG,IAAI,6DAA6B,CAAC,OAAO,CAAC,CAAA;IAC1D,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,iBAAoC;QAClD,iCAAiC;QACjC,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,kBAAW,CAAC,CAAC,MAAM,CAAA;QAC5D,MAAM,CAAC,IAAI,CACT,4LAA4L,CAC7L,CAAA;QAED,kBAAkB;QAClB,iBAAiB,CAAC,gBAAgB,CAAC,6DAA6B,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAE9E,WAAW;QACX,iBAAiB,CAAC,iBAAiB,CAAC,2DAA4B,CAAC,CAAA;QAEjE,aAAa;QACb,iB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GAAG,IAAA,0BAAiB,EAAC,GAAG,CAAC,CAAA;YAC/C,MAAM,YAAY,CAAC,UAAU,EAAE,CAAA;YAC/B,IAAI,EAAE,CAAA;QACR,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAhHD,0DAgHC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { OpenId4VcSiopAuthorizationEndpointConfig } from './router/authorizationEndpoint';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
2
|
+
import type { OpenId4VcSiopAuthorizationRequestEndpointConfig } from './router/authorizationRequestEndpoint';
|
|
3
|
+
import type { Optional } from '@credo-ts/core';
|
|
5
4
|
import type { Router } from 'express';
|
|
6
5
|
export interface OpenId4VcVerifierModuleConfigOptions {
|
|
7
6
|
/**
|
|
@@ -19,16 +18,14 @@ export interface OpenId4VcVerifierModuleConfigOptions {
|
|
|
19
18
|
router?: Router;
|
|
20
19
|
endpoints?: {
|
|
21
20
|
authorization?: Optional<OpenId4VcSiopAuthorizationEndpointConfig, 'endpointPath'>;
|
|
21
|
+
authorizationRequest?: Optional<OpenId4VcSiopAuthorizationRequestEndpointConfig, 'endpointPath'>;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
export declare class OpenId4VcVerifierModuleConfig {
|
|
25
25
|
private options;
|
|
26
26
|
readonly router: Router;
|
|
27
|
-
private eventEmitterMap;
|
|
28
|
-
private sessionManagerMap;
|
|
29
27
|
constructor(options: OpenId4VcVerifierModuleConfigOptions);
|
|
30
28
|
get baseUrl(): string;
|
|
29
|
+
get authorizationRequestEndpoint(): OpenId4VcSiopAuthorizationRequestEndpointConfig;
|
|
31
30
|
get authorizationEndpoint(): OpenId4VcSiopAuthorizationEndpointConfig;
|
|
32
|
-
getSessionManager(agentContext: AgentContext): IRPSessionManager;
|
|
33
|
-
getEventEmitter(agentContext: AgentContext): import("events");
|
|
34
31
|
}
|
|
@@ -1,45 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OpenId4VcVerifierModuleConfig = void 0;
|
|
4
|
-
const did_auth_siop_1 = require("@sphereon/did-auth-siop");
|
|
5
4
|
const router_1 = require("../shared/router");
|
|
6
5
|
class OpenId4VcVerifierModuleConfig {
|
|
7
6
|
constructor(options) {
|
|
8
7
|
var _a;
|
|
9
8
|
this.options = options;
|
|
10
|
-
this.sessionManagerMap = new Map();
|
|
11
|
-
this.eventEmitterMap = new Map();
|
|
12
9
|
this.router = (_a = options.router) !== null && _a !== void 0 ? _a : (0, router_1.importExpress)().Router();
|
|
13
10
|
}
|
|
14
11
|
get baseUrl() {
|
|
15
12
|
return this.options.baseUrl;
|
|
16
13
|
}
|
|
14
|
+
get authorizationRequestEndpoint() {
|
|
15
|
+
var _a, _b, _c, _d;
|
|
16
|
+
// Use user supplied options, or return defaults.
|
|
17
|
+
const userOptions = (_a = this.options.endpoints) === null || _a === void 0 ? void 0 : _a.authorizationRequest;
|
|
18
|
+
return Object.assign(Object.assign({}, userOptions), { endpointPath: (_d = (_c = (_b = this.options.endpoints) === null || _b === void 0 ? void 0 : _b.authorizationRequest) === null || _c === void 0 ? void 0 : _c.endpointPath) !== null && _d !== void 0 ? _d : '/authorization-requests' });
|
|
19
|
+
}
|
|
17
20
|
get authorizationEndpoint() {
|
|
18
21
|
var _a, _b;
|
|
19
22
|
// Use user supplied options, or return defaults.
|
|
20
23
|
const userOptions = (_a = this.options.endpoints) === null || _a === void 0 ? void 0 : _a.authorization;
|
|
21
24
|
return Object.assign(Object.assign({}, userOptions), { endpointPath: (_b = userOptions === null || userOptions === void 0 ? void 0 : userOptions.endpointPath) !== null && _b !== void 0 ? _b : '/authorize' });
|
|
22
25
|
}
|
|
23
|
-
// FIXME: rework (no in-memory)
|
|
24
|
-
getSessionManager(agentContext) {
|
|
25
|
-
const val = this.sessionManagerMap.get(agentContext.contextCorrelationId);
|
|
26
|
-
if (val)
|
|
27
|
-
return val;
|
|
28
|
-
const eventEmitter = this.getEventEmitter(agentContext);
|
|
29
|
-
const newVal = new did_auth_siop_1.InMemoryRPSessionManager(eventEmitter);
|
|
30
|
-
this.sessionManagerMap.set(agentContext.contextCorrelationId, newVal);
|
|
31
|
-
return newVal;
|
|
32
|
-
}
|
|
33
|
-
// FIXME: rework (no-memory)
|
|
34
|
-
getEventEmitter(agentContext) {
|
|
35
|
-
const EventEmitterClass = agentContext.config.agentDependencies.EventEmitterClass;
|
|
36
|
-
const val = this.eventEmitterMap.get(agentContext.contextCorrelationId);
|
|
37
|
-
if (val)
|
|
38
|
-
return val;
|
|
39
|
-
const newVal = new EventEmitterClass();
|
|
40
|
-
this.eventEmitterMap.set(agentContext.contextCorrelationId, newVal);
|
|
41
|
-
return newVal;
|
|
42
|
-
}
|
|
43
26
|
}
|
|
44
27
|
exports.OpenId4VcVerifierModuleConfig = OpenId4VcVerifierModuleConfig;
|
|
45
28
|
//# sourceMappingURL=OpenId4VcVerifierModuleConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenId4VcVerifierModuleConfig.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierModuleConfig.ts"],"names":[],"mappings":";;;AAKA,
|
|
1
|
+
{"version":3,"file":"OpenId4VcVerifierModuleConfig.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierModuleConfig.ts"],"names":[],"mappings":";;;AAKA,6CAAgD;AAwBhD,MAAa,6BAA6B;IAIxC,YAAmB,OAA6C;;QAC9D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QAEtB,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAA,sBAAa,GAAE,CAAC,MAAM,EAAE,CAAA;IAC1D,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAA;IAC7B,CAAC;IAED,IAAW,4BAA4B;;QACrC,iDAAiD;QACjD,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,SAAS,0CAAE,oBAAoB,CAAA;QAEhE,uCACK,WAAW,KACd,YAAY,EAAE,MAAA,MAAA,MAAA,IAAI,CAAC,OAAO,CAAC,SAAS,0CAAE,oBAAoB,0CAAE,YAAY,mCAAI,yBAAyB,IACtG;IACH,CAAC;IAED,IAAW,qBAAqB;;QAC9B,iDAAiD;QACjD,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,SAAS,0CAAE,aAAa,CAAA;QAEzD,uCACK,WAAW,KACd,YAAY,EAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,YAAY,mCAAI,YAAY,IACxD;IACH,CAAC;CACF;AAjCD,sEAiCC"}
|
|
@@ -4,3 +4,5 @@ export * from './OpenId4VcSiopVerifierService';
|
|
|
4
4
|
export * from './OpenId4VcSiopVerifierServiceOptions';
|
|
5
5
|
export * from './OpenId4VcVerifierModuleConfig';
|
|
6
6
|
export * from './repository';
|
|
7
|
+
export * from './OpenId4VcVerificationSessionState';
|
|
8
|
+
export * from './OpenId4VcVerifierEvents';
|
|
@@ -20,4 +20,6 @@ __exportStar(require("./OpenId4VcSiopVerifierService"), exports);
|
|
|
20
20
|
__exportStar(require("./OpenId4VcSiopVerifierServiceOptions"), exports);
|
|
21
21
|
__exportStar(require("./OpenId4VcVerifierModuleConfig"), exports);
|
|
22
22
|
__exportStar(require("./repository"), exports);
|
|
23
|
+
__exportStar(require("./OpenId4VcVerificationSessionState"), exports);
|
|
24
|
+
__exportStar(require("./OpenId4VcVerifierEvents"), exports);
|
|
23
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC;AACtC,4DAAyC;AACzC,iEAA8C;AAC9C,wEAAqD;AACrD,kEAA+C;AAC/C,+CAA4B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC;AACtC,4DAAyC;AACzC,iEAA8C;AAC9C,wEAAqD;AACrD,kEAA+C;AAC/C,+CAA4B;AAC5B,sEAAmD;AACnD,4DAAyC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { AgentContext } from '@credo-ts/core';
|
|
3
|
+
import { AgentContextProvider, AgentDependencies } from '@credo-ts/core';
|
|
4
|
+
import { EventEmitter as NativeEventEmitter } from 'events';
|
|
5
|
+
import { OpenId4VcVerificationSessionState } from '../OpenId4VcVerificationSessionState';
|
|
6
|
+
import { OpenId4VcVerificationSessionRecord } from './OpenId4VcVerificationSessionRecord';
|
|
7
|
+
export declare class OpenId4VcRelyingPartyEventHandler {
|
|
8
|
+
private agentContextProvider;
|
|
9
|
+
readonly nativeEventEmitter: NativeEventEmitter;
|
|
10
|
+
constructor(agentContextProvider: AgentContextProvider, agentDependencies: AgentDependencies);
|
|
11
|
+
getEventEmitterForVerifier(contextCorrelationId: string, verifierId: string): OpenId4VcRelyingPartyEventEmitter;
|
|
12
|
+
private onAuthorizationRequestCreatedSuccess;
|
|
13
|
+
private onAuthorizationRequestSentSuccess;
|
|
14
|
+
private onAuthorizationResponseReceivedFailed;
|
|
15
|
+
private onAuthorizationResponseVerifiedSuccess;
|
|
16
|
+
private onAuthorizationResponseVerifiedFailed;
|
|
17
|
+
private withSession;
|
|
18
|
+
protected emitStateChangedEvent(agentContext: AgentContext, verificationSession: OpenId4VcVerificationSessionRecord, previousState: OpenId4VcVerificationSessionState | null): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Custom implementation of the event emitter so we can associate the contextCorrelationId
|
|
22
|
+
* and the verifierId with the events that are emitted. This allows us to only create one
|
|
23
|
+
* event emitter and thus not have endless event emitters and listeners for each active RP.
|
|
24
|
+
*
|
|
25
|
+
* We only modify the emit method, and add the verifierId and contextCorrelationId to the event
|
|
26
|
+
* this allows the listener to know which tenant and which verifier the event is associated with.
|
|
27
|
+
*/
|
|
28
|
+
declare class OpenId4VcRelyingPartyEventEmitter implements NativeEventEmitter {
|
|
29
|
+
private nativeEventEmitter;
|
|
30
|
+
private contextCorrelationId;
|
|
31
|
+
private verifierId;
|
|
32
|
+
constructor(nativeEventEmitter: NativeEventEmitter, contextCorrelationId: string, verifierId: string);
|
|
33
|
+
emit(eventName: string | symbol, ...args: any[]): boolean;
|
|
34
|
+
[NativeEventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
|
|
35
|
+
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
36
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
37
|
+
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
38
|
+
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
39
|
+
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
40
|
+
removeAllListeners(event?: string | symbol | undefined): this;
|
|
41
|
+
setMaxListeners(n: number): this;
|
|
42
|
+
getMaxListeners(): number;
|
|
43
|
+
listeners(eventName: string | symbol): Function[];
|
|
44
|
+
rawListeners(eventName: string | symbol): Function[];
|
|
45
|
+
listenerCount(eventName: string | symbol, listener?: Function | undefined): number;
|
|
46
|
+
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
47
|
+
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
48
|
+
eventNames(): (string | symbol)[];
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.OpenId4VcRelyingPartyEventHandler = void 0;
|
|
16
|
+
const core_1 = require("@credo-ts/core");
|
|
17
|
+
const did_auth_siop_1 = require("@sphereon/did-auth-siop");
|
|
18
|
+
const events_1 = require("events");
|
|
19
|
+
const OpenId4VcVerificationSessionState_1 = require("../OpenId4VcVerificationSessionState");
|
|
20
|
+
const OpenId4VcVerifierEvents_1 = require("../OpenId4VcVerifierEvents");
|
|
21
|
+
const OpenId4VcVerificationSessionRecord_1 = require("./OpenId4VcVerificationSessionRecord");
|
|
22
|
+
const OpenId4VcVerificationSessionRepository_1 = require("./OpenId4VcVerificationSessionRepository");
|
|
23
|
+
let OpenId4VcRelyingPartyEventHandler = class OpenId4VcRelyingPartyEventHandler {
|
|
24
|
+
constructor(agentContextProvider, agentDependencies) {
|
|
25
|
+
this.agentContextProvider = agentContextProvider;
|
|
26
|
+
this.onAuthorizationRequestCreatedSuccess = async (event, context) => {
|
|
27
|
+
const authorizationRequestJwt = await event.subject.requestObjectJwt();
|
|
28
|
+
if (!authorizationRequestJwt) {
|
|
29
|
+
throw new core_1.CredoError('Authorization request object JWT is missing');
|
|
30
|
+
}
|
|
31
|
+
const authorizationRequestUri = event.subject.payload.request_uri;
|
|
32
|
+
if (!authorizationRequestUri) {
|
|
33
|
+
throw new core_1.CredoError('Authorization request URI is missing');
|
|
34
|
+
}
|
|
35
|
+
const verificationSession = new OpenId4VcVerificationSessionRecord_1.OpenId4VcVerificationSessionRecord({
|
|
36
|
+
id: event.correlationId,
|
|
37
|
+
authorizationRequestJwt,
|
|
38
|
+
authorizationRequestUri,
|
|
39
|
+
state: OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestCreated,
|
|
40
|
+
verifierId: context.verifierId,
|
|
41
|
+
});
|
|
42
|
+
await this.withSession(context.contextCorrelationId, async (agentContext, verificationSessionRepository) => {
|
|
43
|
+
await verificationSessionRepository.save(agentContext, verificationSession);
|
|
44
|
+
this.emitStateChangedEvent(agentContext, verificationSession, null);
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
this.onAuthorizationRequestSentSuccess = async (event, context) => {
|
|
48
|
+
await this.withSession(context.contextCorrelationId, async (agentContext, verificationSessionRepository) => {
|
|
49
|
+
const verificationSession = await verificationSessionRepository.getById(agentContext, event.correlationId);
|
|
50
|
+
// In all other cases it doesn't make sense to update the state, as the state is already advanced beyond
|
|
51
|
+
// this state.
|
|
52
|
+
if (verificationSession.state === OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestCreated) {
|
|
53
|
+
verificationSession.state = OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestUriRetrieved;
|
|
54
|
+
await verificationSessionRepository.update(agentContext, verificationSession);
|
|
55
|
+
this.emitStateChangedEvent(agentContext, verificationSession, OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestCreated);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
this.onAuthorizationResponseReceivedFailed = async (event, context) => {
|
|
60
|
+
await this.withSession(context.contextCorrelationId, async (agentContext, verificationSessionRepository) => {
|
|
61
|
+
const verificationSession = await verificationSessionRepository.getById(agentContext, event.correlationId);
|
|
62
|
+
const previousState = verificationSession.state;
|
|
63
|
+
verificationSession.state = OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.Error;
|
|
64
|
+
verificationSession.authorizationResponsePayload = event.subject.payload;
|
|
65
|
+
verificationSession.errorMessage = event.error.message;
|
|
66
|
+
await verificationSessionRepository.update(agentContext, verificationSession);
|
|
67
|
+
this.emitStateChangedEvent(agentContext, verificationSession, previousState);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
this.onAuthorizationResponseVerifiedSuccess = async (event, context) => {
|
|
71
|
+
await this.withSession(context.contextCorrelationId, async (agentContext, verificationSessionRepository) => {
|
|
72
|
+
const verificationSession = await verificationSessionRepository.getById(agentContext, event.correlationId);
|
|
73
|
+
if (verificationSession.state === OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestUriRetrieved) {
|
|
74
|
+
const previousState = verificationSession.state;
|
|
75
|
+
verificationSession.authorizationResponsePayload = event.subject.payload;
|
|
76
|
+
verificationSession.state = OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.ResponseVerified;
|
|
77
|
+
await verificationSessionRepository.update(agentContext, verificationSession);
|
|
78
|
+
this.emitStateChangedEvent(agentContext, verificationSession, previousState);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
this.onAuthorizationResponseVerifiedFailed = async (event, context) => {
|
|
83
|
+
await this.withSession(context.contextCorrelationId, async (agentContext, verificationSessionRepository) => {
|
|
84
|
+
const verificationSession = await verificationSessionRepository.getById(agentContext, event.correlationId);
|
|
85
|
+
const previousState = verificationSession.state;
|
|
86
|
+
verificationSession.state = OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.Error;
|
|
87
|
+
verificationSession.errorMessage = event.error.message;
|
|
88
|
+
await verificationSessionRepository.update(agentContext, verificationSession);
|
|
89
|
+
this.emitStateChangedEvent(agentContext, verificationSession, previousState);
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
this.nativeEventEmitter = new agentDependencies.EventEmitterClass();
|
|
93
|
+
this.nativeEventEmitter.on(did_auth_siop_1.AuthorizationEvents.ON_AUTH_REQUEST_CREATED_SUCCESS, this.onAuthorizationRequestCreatedSuccess);
|
|
94
|
+
// We don't want to do anything currently when a request creation failed, as then the method that
|
|
95
|
+
// is called to create it will throw and we won't create a session
|
|
96
|
+
// AuthorizationEvents.ON_AUTH_REQUEST_CREATED_FAILED,
|
|
97
|
+
this.nativeEventEmitter.on(did_auth_siop_1.AuthorizationEvents.ON_AUTH_REQUEST_SENT_SUCCESS, this.onAuthorizationRequestSentSuccess);
|
|
98
|
+
// We manually call when the request is retrieved, and there's not really a case where it can fail, and
|
|
99
|
+
// not really sure how to represent it in the verification session. So not doing anything here.
|
|
100
|
+
// AuthorizationEvents.ON_AUTH_REQUEST_SENT_FAILED
|
|
101
|
+
// NOTE: the response received and response verified states are fired in such rapid succession
|
|
102
|
+
// that the verification session record is not updated yet to received before the verified event is
|
|
103
|
+
// emitted. For now we only track the verified / failed event. Otherwise we need to use record locking, which we don't have in-place yet
|
|
104
|
+
// AuthorizationEvents.ON_AUTH_RESPONSE_RECEIVED_SUCCESS,
|
|
105
|
+
this.nativeEventEmitter.on(did_auth_siop_1.AuthorizationEvents.ON_AUTH_RESPONSE_RECEIVED_FAILED, this.onAuthorizationResponseReceivedFailed);
|
|
106
|
+
this.nativeEventEmitter.on(did_auth_siop_1.AuthorizationEvents.ON_AUTH_RESPONSE_VERIFIED_SUCCESS, this.onAuthorizationResponseVerifiedSuccess);
|
|
107
|
+
this.nativeEventEmitter.on(did_auth_siop_1.AuthorizationEvents.ON_AUTH_RESPONSE_VERIFIED_FAILED, this.onAuthorizationResponseVerifiedFailed);
|
|
108
|
+
}
|
|
109
|
+
getEventEmitterForVerifier(contextCorrelationId, verifierId) {
|
|
110
|
+
return new OpenId4VcRelyingPartyEventEmitter(this.nativeEventEmitter, contextCorrelationId, verifierId);
|
|
111
|
+
}
|
|
112
|
+
async withSession(contextCorrelationId, callback) {
|
|
113
|
+
const agentContext = await this.agentContextProvider.getAgentContextForContextCorrelationId(contextCorrelationId);
|
|
114
|
+
try {
|
|
115
|
+
const verificationSessionRepository = agentContext.dependencyManager.resolve(OpenId4VcVerificationSessionRepository_1.OpenId4VcVerificationSessionRepository);
|
|
116
|
+
const result = await callback(agentContext, verificationSessionRepository);
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
await agentContext.endSession();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
emitStateChangedEvent(agentContext, verificationSession, previousState) {
|
|
124
|
+
const eventEmitter = agentContext.dependencyManager.resolve(core_1.EventEmitter);
|
|
125
|
+
eventEmitter.emit(agentContext, {
|
|
126
|
+
type: OpenId4VcVerifierEvents_1.OpenId4VcVerifierEvents.VerificationSessionStateChanged,
|
|
127
|
+
payload: {
|
|
128
|
+
verificationSession: verificationSession.clone(),
|
|
129
|
+
previousState,
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
OpenId4VcRelyingPartyEventHandler = __decorate([
|
|
135
|
+
(0, core_1.injectable)(),
|
|
136
|
+
__param(0, (0, core_1.inject)(core_1.InjectionSymbols.AgentContextProvider)),
|
|
137
|
+
__param(1, (0, core_1.inject)(core_1.InjectionSymbols.AgentDependencies)),
|
|
138
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
139
|
+
], OpenId4VcRelyingPartyEventHandler);
|
|
140
|
+
exports.OpenId4VcRelyingPartyEventHandler = OpenId4VcRelyingPartyEventHandler;
|
|
141
|
+
/**
|
|
142
|
+
* Custom implementation of the event emitter so we can associate the contextCorrelationId
|
|
143
|
+
* and the verifierId with the events that are emitted. This allows us to only create one
|
|
144
|
+
* event emitter and thus not have endless event emitters and listeners for each active RP.
|
|
145
|
+
*
|
|
146
|
+
* We only modify the emit method, and add the verifierId and contextCorrelationId to the event
|
|
147
|
+
* this allows the listener to know which tenant and which verifier the event is associated with.
|
|
148
|
+
*/
|
|
149
|
+
class OpenId4VcRelyingPartyEventEmitter {
|
|
150
|
+
constructor(nativeEventEmitter, contextCorrelationId, verifierId) {
|
|
151
|
+
this.nativeEventEmitter = nativeEventEmitter;
|
|
152
|
+
this.contextCorrelationId = contextCorrelationId;
|
|
153
|
+
this.verifierId = verifierId;
|
|
154
|
+
}
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
156
|
+
emit(eventName, ...args) {
|
|
157
|
+
return this.nativeEventEmitter.emit(eventName, ...args, {
|
|
158
|
+
contextCorrelationId: this.contextCorrelationId,
|
|
159
|
+
verifierId: this.verifierId,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
163
|
+
[events_1.EventEmitter.captureRejectionSymbol](error, event, ...args) {
|
|
164
|
+
var _a, _b;
|
|
165
|
+
return (_b = (_a = this.nativeEventEmitter)[events_1.EventEmitter.captureRejectionSymbol]) === null || _b === void 0 ? void 0 : _b.call(_a, error, event, ...args);
|
|
166
|
+
}
|
|
167
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
168
|
+
addListener(eventName, listener) {
|
|
169
|
+
this.nativeEventEmitter.addListener(eventName, listener);
|
|
170
|
+
return this;
|
|
171
|
+
}
|
|
172
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
173
|
+
on(eventName, listener) {
|
|
174
|
+
this.nativeEventEmitter.on(eventName, listener);
|
|
175
|
+
return this;
|
|
176
|
+
}
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
178
|
+
once(eventName, listener) {
|
|
179
|
+
this.nativeEventEmitter.once(eventName, listener);
|
|
180
|
+
return this;
|
|
181
|
+
}
|
|
182
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
183
|
+
removeListener(eventName, listener) {
|
|
184
|
+
this.nativeEventEmitter.removeListener(eventName, listener);
|
|
185
|
+
return this;
|
|
186
|
+
}
|
|
187
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
188
|
+
off(eventName, listener) {
|
|
189
|
+
this.nativeEventEmitter.off(eventName, listener);
|
|
190
|
+
return this;
|
|
191
|
+
}
|
|
192
|
+
removeAllListeners(event) {
|
|
193
|
+
this.nativeEventEmitter.removeAllListeners(event);
|
|
194
|
+
return this;
|
|
195
|
+
}
|
|
196
|
+
setMaxListeners(n) {
|
|
197
|
+
this.nativeEventEmitter.setMaxListeners(n);
|
|
198
|
+
return this;
|
|
199
|
+
}
|
|
200
|
+
getMaxListeners() {
|
|
201
|
+
return this.nativeEventEmitter.getMaxListeners();
|
|
202
|
+
}
|
|
203
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
204
|
+
listeners(eventName) {
|
|
205
|
+
return this.nativeEventEmitter.listeners(eventName);
|
|
206
|
+
}
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
208
|
+
rawListeners(eventName) {
|
|
209
|
+
return this.nativeEventEmitter.rawListeners(eventName);
|
|
210
|
+
}
|
|
211
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
212
|
+
listenerCount(eventName, listener) {
|
|
213
|
+
return this.nativeEventEmitter.listenerCount(eventName, listener);
|
|
214
|
+
}
|
|
215
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
216
|
+
prependListener(eventName, listener) {
|
|
217
|
+
this.nativeEventEmitter.prependListener(eventName, listener);
|
|
218
|
+
return this;
|
|
219
|
+
}
|
|
220
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
221
|
+
prependOnceListener(eventName, listener) {
|
|
222
|
+
this.nativeEventEmitter.prependOnceListener(eventName, listener);
|
|
223
|
+
return this;
|
|
224
|
+
}
|
|
225
|
+
eventNames() {
|
|
226
|
+
return this.nativeEventEmitter.eventNames();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=OpenId4VcRelyingPartyEventEmitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VcRelyingPartyEventEmitter.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAIA,yCAQuB;AACvB,2DAA6D;AAC7D,mCAA2D;AAE3D,4FAAwF;AACxF,wEAAoE;AAEpE,6FAAyF;AACzF,qGAAiG;AAQ1F,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;IAG5C,YACyD,oBAA0C,EACrD,iBAAoC;QADzB,yBAAoB,GAApB,oBAAoB,CAAsB;QA4C3F,yCAAoC,GAAG,KAAK,EAClD,KAA+C,EAC/C,OAAwC,EACzB,EAAE;YACjB,MAAM,uBAAuB,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAA;YACtE,IAAI,CAAC,uBAAuB,EAAE;gBAC5B,MAAM,IAAI,iBAAU,CAAC,6CAA6C,CAAC,CAAA;aACpE;YAED,MAAM,uBAAuB,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAA;YACjE,IAAI,CAAC,uBAAuB,EAAE;gBAC5B,MAAM,IAAI,iBAAU,CAAC,sCAAsC,CAAC,CAAA;aAC7D;YAED,MAAM,mBAAmB,GAAG,IAAI,uEAAkC,CAAC;gBACjE,EAAE,EAAE,KAAK,CAAC,aAAa;gBACvB,uBAAuB;gBACvB,uBAAuB;gBACvB,KAAK,EAAE,qEAAiC,CAAC,cAAc;gBACvD,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAA;YAEF,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,EAAE,YAAY,EAAE,6BAA6B,EAAE,EAAE;gBACzG,MAAM,6BAA6B,CAAC,IAAI,CAAC,YAAY,EAAE,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C,kBAAkB,CAAC,UAAU,EAAE,CAAA;IAC7C,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AgentContext } from '@credo-ts/core';
|
|
2
|
+
import type { AuthorizationRequestState, AuthorizationResponseState, IRPSessionManager } from '@sphereon/did-auth-siop';
|
|
3
|
+
export declare class OpenId4VcRelyingPartySessionManager implements IRPSessionManager {
|
|
4
|
+
private agentContext;
|
|
5
|
+
private verifierId;
|
|
6
|
+
private openId4VcVerificationSessionRepository;
|
|
7
|
+
constructor(agentContext: AgentContext, verifierId: string);
|
|
8
|
+
getRequestStateByCorrelationId(correlationId: string, errorOnNotFound?: boolean): Promise<AuthorizationRequestState | undefined>;
|
|
9
|
+
getRequestStateByNonce(nonce: string, errorOnNotFound?: boolean): Promise<AuthorizationRequestState | undefined>;
|
|
10
|
+
getRequestStateByState(state: string, errorOnNotFound?: boolean): Promise<AuthorizationRequestState | undefined>;
|
|
11
|
+
getResponseStateByCorrelationId(correlationId: string, errorOnNotFound?: boolean): Promise<AuthorizationResponseState | undefined>;
|
|
12
|
+
getResponseStateByNonce(nonce: string, errorOnNotFound?: boolean): Promise<AuthorizationResponseState | undefined>;
|
|
13
|
+
getResponseStateByState(state: string, errorOnNotFound?: boolean): Promise<AuthorizationResponseState | undefined>;
|
|
14
|
+
getCorrelationIdByNonce(nonce: string, errorOnNotFound?: boolean): Promise<string | undefined>;
|
|
15
|
+
getCorrelationIdByState(state: string, errorOnNotFound?: boolean): Promise<string | undefined>;
|
|
16
|
+
deleteStateForCorrelationId(): Promise<void>;
|
|
17
|
+
private getRequestStateFromSessionRecord;
|
|
18
|
+
private getResponseStateFromSessionRecord;
|
|
19
|
+
}
|