@credo-ts/openid4vc 0.5.0-alpha.115
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/LICENSE +202 -0
- package/README.md +31 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +21 -0
- package/build/index.js.map +1 -0
- package/build/openid4vc-holder/OpenId4VcHolderApi.d.ts +83 -0
- package/build/openid4vc-holder/OpenId4VcHolderApi.js +115 -0
- package/build/openid4vc-holder/OpenId4VcHolderApi.js.map +1 -0
- package/build/openid4vc-holder/OpenId4VcHolderModule.d.ts +13 -0
- package/build/openid4vc-holder/OpenId4VcHolderModule.js +30 -0
- package/build/openid4vc-holder/OpenId4VcHolderModule.js.map +1 -0
- package/build/openid4vc-holder/OpenId4VciHolderService.d.ts +33 -0
- package/build/openid4vc-holder/OpenId4VciHolderService.js +510 -0
- package/build/openid4vc-holder/OpenId4VciHolderService.js.map +1 -0
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.d.ts +153 -0
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js +11 -0
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js.map +1 -0
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.d.ts +18 -0
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js +228 -0
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js.map +1 -0
- package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.d.ts +43 -0
- package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.js +3 -0
- package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.js.map +1 -0
- package/build/openid4vc-holder/index.d.ts +6 -0
- package/build/openid4vc-holder/index.js +23 -0
- package/build/openid4vc-holder/index.js.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.d.ts +62 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.js +111 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.js.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.d.ts +21 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js +103 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.d.ts +43 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js +68 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerService.d.ts +40 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js +392 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js.map +1 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts +85 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.js +3 -0
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.js.map +1 -0
- package/build/openid4vc-issuer/index.d.ts +6 -0
- package/build/openid4vc-issuer/index.js +25 -0
- package/build/openid4vc-issuer/index.js.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.d.ts +37 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js +31 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js.map +1 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.d.ts +8 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.js +35 -0
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.js.map +1 -0
- package/build/openid4vc-issuer/repository/index.d.ts +2 -0
- package/build/openid4vc-issuer/repository/index.js +19 -0
- package/build/openid4vc-issuer/repository/index.js.map +1 -0
- package/build/openid4vc-issuer/router/accessTokenEndpoint.d.ts +34 -0
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js +97 -0
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js.map +1 -0
- package/build/openid4vc-issuer/router/credentialEndpoint.d.ts +16 -0
- package/build/openid4vc-issuer/router/credentialEndpoint.js +26 -0
- package/build/openid4vc-issuer/router/credentialEndpoint.js.map +1 -0
- package/build/openid4vc-issuer/router/index.d.ts +4 -0
- package/build/openid4vc-issuer/router/index.js +10 -0
- package/build/openid4vc-issuer/router/index.js.map +1 -0
- package/build/openid4vc-issuer/router/metadataEndpoint.d.ts +2 -0
- package/build/openid4vc-issuer/router/metadataEndpoint.js +30 -0
- package/build/openid4vc-issuer/router/metadataEndpoint.js.map +1 -0
- package/build/openid4vc-issuer/router/requestContext.d.ts +5 -0
- package/build/openid4vc-issuer/router/requestContext.js +3 -0
- package/build/openid4vc-issuer/router/requestContext.js.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.d.ts +27 -0
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js +277 -0
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.d.ts +44 -0
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.js +3 -0
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.js.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.ts +48 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js +89 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.d.ts +21 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js +98 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js.map +1 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.d.ts +34 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js +45 -0
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js.map +1 -0
- package/build/openid4vc-verifier/index.d.ts +6 -0
- package/build/openid4vc-verifier/index.js +23 -0
- package/build/openid4vc-verifier/index.js.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.d.ts +26 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.js +28 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.js.map +1 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.d.ts +8 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.js +35 -0
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.js.map +1 -0
- package/build/openid4vc-verifier/repository/index.d.ts +2 -0
- package/build/openid4vc-verifier/repository/index.js +19 -0
- package/build/openid4vc-verifier/repository/index.js.map +1 -0
- package/build/openid4vc-verifier/router/authorizationEndpoint.d.ts +11 -0
- package/build/openid4vc-verifier/router/authorizationEndpoint.js +30 -0
- package/build/openid4vc-verifier/router/authorizationEndpoint.js.map +1 -0
- package/build/openid4vc-verifier/router/index.d.ts +2 -0
- package/build/openid4vc-verifier/router/index.js +6 -0
- package/build/openid4vc-verifier/router/index.js.map +1 -0
- package/build/openid4vc-verifier/router/requestContext.d.ts +5 -0
- package/build/openid4vc-verifier/router/requestContext.js +3 -0
- package/build/openid4vc-verifier/router/requestContext.js.map +1 -0
- package/build/shared/index.d.ts +2 -0
- package/build/shared/index.js +19 -0
- package/build/shared/index.js.map +1 -0
- package/build/shared/issuerMetadataUtils.d.ts +14 -0
- package/build/shared/issuerMetadataUtils.js +69 -0
- package/build/shared/issuerMetadataUtils.js.map +1 -0
- package/build/shared/models/CredentialHolderBinding.d.ts +10 -0
- package/build/shared/models/CredentialHolderBinding.js +3 -0
- package/build/shared/models/CredentialHolderBinding.js.map +1 -0
- package/build/shared/models/OpenId4VcJwtIssuer.d.ts +6 -0
- package/build/shared/models/OpenId4VcJwtIssuer.js +3 -0
- package/build/shared/models/OpenId4VcJwtIssuer.js.map +1 -0
- package/build/shared/models/OpenId4VciCredentialFormatProfile.d.ts +6 -0
- package/build/shared/models/OpenId4VciCredentialFormatProfile.js +11 -0
- package/build/shared/models/OpenId4VciCredentialFormatProfile.js.map +1 -0
- package/build/shared/models/index.d.ts +21 -0
- package/build/shared/models/index.js +20 -0
- package/build/shared/models/index.js.map +1 -0
- package/build/shared/router/context.d.ts +10 -0
- package/build/shared/router/context.js +22 -0
- package/build/shared/router/context.js.map +1 -0
- package/build/shared/router/express.d.ts +2 -0
- package/build/shared/router/express.js +16 -0
- package/build/shared/router/express.js.map +1 -0
- package/build/shared/router/index.d.ts +3 -0
- package/build/shared/router/index.js +20 -0
- package/build/shared/router/index.js.map +1 -0
- package/build/shared/router/tenants.d.ts +13 -0
- package/build/shared/router/tenants.js +50 -0
- package/build/shared/router/tenants.js.map +1 -0
- package/build/shared/transform.d.ts +5 -0
- package/build/shared/transform.js +61 -0
- package/build/shared/transform.js.map +1 -0
- package/build/shared/utils.d.ts +21 -0
- package/build/shared/utils.js +85 -0
- package/build/shared/utils.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VcSiopVerifierService.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcSiopVerifierService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAWA,yCAeuB;AACvB,2DAYgC;AAEhC,6CAAsE;AACtE,mDAAkF;AAClF,2CAIwB;AAExB,mFAA+E;AAC/E,6CAAmF;AAEnF;;GAEG;AAEI,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YAC2C,MAAc,EAC/C,oBAA0C,EAC1C,2BAAwD,EACxD,MAAqC;QAHJ,WAAM,GAAN,MAAM,CAAQ;QAC/C,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,gCAA2B,GAA3B,2BAA2B,CAA6B;QACxD,WAAM,GAAN,MAAM,CAA+B;IAC5C,CAAC;IAEG,KAAK,CAAC,0BAA0B,CACrC,YAA0B,EAC1B,OAA+F;;QAE/F,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,MA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C;iBAAM;gBACL,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,YAAY,EAAE;oBAC1F,YAAY,EAAE,sBAAe,CAAC,QAAQ,CAAC,mBAAmB,EAAE,sCAA+B,CAAC;oBAC5F,SAAS,EAAE,OAAO,CAAC,KAAK;oBACxB,MAAM,EAAE,OAAO,CAAC,QAAQ;iBACzB,CAAC,CAAA;gBAEF,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAA;aACrC;YAED,gFAAgF;YAChF,6EAA6E;YAC7E,+EAA+E;YAC/E,mBAAmB;YACnB,IAAI,CAAC,OAAO,EAAE;gBACZ,MAAM,IAAI,iBAAU,CAAC,mCAAmC,CAAC,CAAA;aAC1D;YAED,OAAO;gBACL,QAAQ,EAAE,OAAO;aAClB,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAA;AAlTY,4BAA4B;IADxC,IAAA,iBAAU,GAAE;IAGR,WAAA,IAAA,aAAM,EAAC,uBAAgB,CAAC,MAAM,CAAC,CAAA;6CACF,2BAAoB;QACb,wCAA2B;QAChD,6DAA6B;GALpC,4BAA4B,CAkTxC;AAlTY,oEAA4B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { OpenId4VcJwtIssuer, OpenId4VcSiopAuthorizationRequestPayload, OpenId4VcSiopAuthorizationResponsePayload, OpenId4VcSiopIdTokenPayload } from '../shared';
|
|
2
|
+
import type { DifPresentationExchangeDefinition, DifPresentationExchangeSubmission, DifPresentationExchangeDefinitionV2, VerifiablePresentation } from '@credo-ts/core';
|
|
3
|
+
export interface OpenId4VcSiopCreateAuthorizationRequestOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Signing information for the request JWT. This will be used to sign the request JWT
|
|
6
|
+
* and to set the client_id for registration of client_metadata.
|
|
7
|
+
*/
|
|
8
|
+
requestSigner: OpenId4VcJwtIssuer;
|
|
9
|
+
/**
|
|
10
|
+
* A DIF Presentation Definition (v2) can be provided to request a Verifiable Presentation using OpenID4VP.
|
|
11
|
+
*/
|
|
12
|
+
presentationExchange?: {
|
|
13
|
+
definition: DifPresentationExchangeDefinitionV2;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface OpenId4VcSiopVerifyAuthorizationResponseOptions {
|
|
17
|
+
/**
|
|
18
|
+
* The authorization response received from the OpenID Provider (OP).
|
|
19
|
+
*/
|
|
20
|
+
authorizationResponse: OpenId4VcSiopAuthorizationResponsePayload;
|
|
21
|
+
}
|
|
22
|
+
export interface OpenId4VcSiopCreateAuthorizationRequestReturn {
|
|
23
|
+
authorizationRequestUri: string;
|
|
24
|
+
authorizationRequestPayload: OpenId4VcSiopAuthorizationRequestPayload;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Either `idToken` and/or `presentationExchange` will be present, but not none.
|
|
28
|
+
*/
|
|
29
|
+
export interface OpenId4VcSiopVerifiedAuthorizationResponse {
|
|
30
|
+
idToken?: {
|
|
31
|
+
payload: OpenId4VcSiopIdTokenPayload;
|
|
32
|
+
};
|
|
33
|
+
presentationExchange?: {
|
|
34
|
+
submission: DifPresentationExchangeSubmission;
|
|
35
|
+
definition: DifPresentationExchangeDefinition;
|
|
36
|
+
presentations: Array<VerifiablePresentation>;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface OpenId4VcSiopCreateVerifierOptions {
|
|
40
|
+
/**
|
|
41
|
+
* Id of the verifier, not the id of the verified record. Will be exposed publicly
|
|
42
|
+
*/
|
|
43
|
+
verifierId?: string;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VcSiopVerifierServiceOptions.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { OpenId4VcSiopCreateAuthorizationRequestOptions, OpenId4VcSiopVerifyAuthorizationResponseOptions, OpenId4VcSiopCreateAuthorizationRequestReturn, OpenId4VcSiopVerifiedAuthorizationResponse, OpenId4VcSiopCreateVerifierOptions } from './OpenId4VcSiopVerifierServiceOptions';
|
|
2
|
+
import { AgentContext } from '@credo-ts/core';
|
|
3
|
+
import { OpenId4VcSiopVerifierService } from './OpenId4VcSiopVerifierService';
|
|
4
|
+
import { OpenId4VcVerifierModuleConfig } from './OpenId4VcVerifierModuleConfig';
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class OpenId4VcVerifierApi {
|
|
9
|
+
readonly config: OpenId4VcVerifierModuleConfig;
|
|
10
|
+
private agentContext;
|
|
11
|
+
private openId4VcSiopVerifierService;
|
|
12
|
+
constructor(config: OpenId4VcVerifierModuleConfig, agentContext: AgentContext, openId4VcSiopVerifierService: OpenId4VcSiopVerifierService);
|
|
13
|
+
/**
|
|
14
|
+
* Retrieve all verifier records from storage
|
|
15
|
+
*/
|
|
16
|
+
getAllVerifiers(): Promise<import("./repository").OpenId4VcVerifierRecord[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Retrieve a verifier record from storage by its verified id
|
|
19
|
+
*/
|
|
20
|
+
getByVerifierId(verifierId: string): Promise<import("./repository").OpenId4VcVerifierRecord>;
|
|
21
|
+
/**
|
|
22
|
+
* Create a new verifier and store the new verifier record.
|
|
23
|
+
*/
|
|
24
|
+
createVerifier(options?: OpenId4VcSiopCreateVerifierOptions): Promise<import("./repository").OpenId4VcVerifierRecord>;
|
|
25
|
+
/**
|
|
26
|
+
* Create an authorization request, acting as a Relying Party (RP).
|
|
27
|
+
*
|
|
28
|
+
* Currently two types of requests are supported:
|
|
29
|
+
* - SIOP Self-Issued ID Token request: request to a Self-Issued OP from an RP
|
|
30
|
+
* - SIOP Verifiable Presentation Request: request to a Self-Issued OP from an RP, requesting a Verifiable Presentation using OpenID4VP
|
|
31
|
+
*
|
|
32
|
+
* Other flows (non-SIOP) are not supported at the moment, but can be added in the future.
|
|
33
|
+
*
|
|
34
|
+
* See {@link OpenId4VcSiopCreateAuthorizationRequestOptions} for detailed documentation on the options.
|
|
35
|
+
*/
|
|
36
|
+
createAuthorizationRequest({ verifierId, ...otherOptions }: OpenId4VcSiopCreateAuthorizationRequestOptions & {
|
|
37
|
+
verifierId: string;
|
|
38
|
+
}): Promise<OpenId4VcSiopCreateAuthorizationRequestReturn>;
|
|
39
|
+
/**
|
|
40
|
+
* Verifies an authorization response, acting as a Relying Party (RP).
|
|
41
|
+
*
|
|
42
|
+
* It validates the ID Token, VP Token and the signature(s) of the received Verifiable Presentation(s)
|
|
43
|
+
* as well as that the structure of the Verifiable Presentation matches the provided presentation definition.
|
|
44
|
+
*/
|
|
45
|
+
verifyAuthorizationResponse({ verifierId, ...otherOptions }: OpenId4VcSiopVerifyAuthorizationResponseOptions & {
|
|
46
|
+
verifierId: string;
|
|
47
|
+
}): Promise<OpenId4VcSiopVerifiedAuthorizationResponse>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.OpenId4VcVerifierApi = void 0;
|
|
24
|
+
const core_1 = require("@credo-ts/core");
|
|
25
|
+
const OpenId4VcSiopVerifierService_1 = require("./OpenId4VcSiopVerifierService");
|
|
26
|
+
const OpenId4VcVerifierModuleConfig_1 = require("./OpenId4VcVerifierModuleConfig");
|
|
27
|
+
/**
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
let OpenId4VcVerifierApi = class OpenId4VcVerifierApi {
|
|
31
|
+
constructor(config, agentContext, openId4VcSiopVerifierService) {
|
|
32
|
+
this.config = config;
|
|
33
|
+
this.agentContext = agentContext;
|
|
34
|
+
this.openId4VcSiopVerifierService = openId4VcSiopVerifierService;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Retrieve all verifier records from storage
|
|
38
|
+
*/
|
|
39
|
+
async getAllVerifiers() {
|
|
40
|
+
return this.openId4VcSiopVerifierService.getAllVerifiers(this.agentContext);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Retrieve a verifier record from storage by its verified id
|
|
44
|
+
*/
|
|
45
|
+
async getByVerifierId(verifierId) {
|
|
46
|
+
return this.openId4VcSiopVerifierService.getByVerifierId(this.agentContext, verifierId);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Create a new verifier and store the new verifier record.
|
|
50
|
+
*/
|
|
51
|
+
async createVerifier(options) {
|
|
52
|
+
return this.openId4VcSiopVerifierService.createVerifier(this.agentContext, options);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create an authorization request, acting as a Relying Party (RP).
|
|
56
|
+
*
|
|
57
|
+
* Currently two types of requests are supported:
|
|
58
|
+
* - SIOP Self-Issued ID Token request: request to a Self-Issued OP from an RP
|
|
59
|
+
* - SIOP Verifiable Presentation Request: request to a Self-Issued OP from an RP, requesting a Verifiable Presentation using OpenID4VP
|
|
60
|
+
*
|
|
61
|
+
* Other flows (non-SIOP) are not supported at the moment, but can be added in the future.
|
|
62
|
+
*
|
|
63
|
+
* See {@link OpenId4VcSiopCreateAuthorizationRequestOptions} for detailed documentation on the options.
|
|
64
|
+
*/
|
|
65
|
+
async createAuthorizationRequest(_a) {
|
|
66
|
+
var { verifierId } = _a, otherOptions = __rest(_a, ["verifierId"]);
|
|
67
|
+
const verifier = await this.getByVerifierId(verifierId);
|
|
68
|
+
return await this.openId4VcSiopVerifierService.createAuthorizationRequest(this.agentContext, Object.assign(Object.assign({}, otherOptions), { verifier }));
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Verifies an authorization response, acting as a Relying Party (RP).
|
|
72
|
+
*
|
|
73
|
+
* It validates the ID Token, VP Token and the signature(s) of the received Verifiable Presentation(s)
|
|
74
|
+
* as well as that the structure of the Verifiable Presentation matches the provided presentation definition.
|
|
75
|
+
*/
|
|
76
|
+
async verifyAuthorizationResponse(_a) {
|
|
77
|
+
var { verifierId } = _a, otherOptions = __rest(_a, ["verifierId"]);
|
|
78
|
+
const verifier = await this.getByVerifierId(verifierId);
|
|
79
|
+
return await this.openId4VcSiopVerifierService.verifyAuthorizationResponse(this.agentContext, Object.assign(Object.assign({}, otherOptions), { verifier }));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
OpenId4VcVerifierApi = __decorate([
|
|
83
|
+
(0, core_1.injectable)(),
|
|
84
|
+
__metadata("design:paramtypes", [OpenId4VcVerifierModuleConfig_1.OpenId4VcVerifierModuleConfig,
|
|
85
|
+
core_1.AgentContext,
|
|
86
|
+
OpenId4VcSiopVerifierService_1.OpenId4VcSiopVerifierService])
|
|
87
|
+
], OpenId4VcVerifierApi);
|
|
88
|
+
exports.OpenId4VcVerifierApi = OpenId4VcVerifierApi;
|
|
89
|
+
//# sourceMappingURL=OpenId4VcVerifierApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VcVerifierApi.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAQA,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,eAAe,CAAC,UAAkB;QAC7C,OAAO,IAAI,CAAC,4BAA4B,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;IACzF,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;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,0BAA0B,CAAC,EAKvC;YALuC,EACtC,UAAU,OAIX,EAHI,YAAY,cAFuB,cAGvC,CADgB;QAIf,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;QACvD,OAAO,MAAM,IAAI,CAAC,4BAA4B,CAAC,0BAA0B,CAAC,IAAI,CAAC,YAAY,kCACtF,YAAY,KACf,QAAQ,IACR,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,2BAA2B,CAAC,EAKxC;YALwC,EACvC,UAAU,OAIX,EAHI,YAAY,cAFwB,cAGxC,CADgB;QAIf,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;QACvD,OAAO,MAAM,IAAI,CAAC,4BAA4B,CAAC,2BAA2B,CAAC,IAAI,CAAC,YAAY,kCACvF,YAAY,KACf,QAAQ,IACR,CAAA;IACJ,CAAC;CACF,CAAA;AAtEY,oBAAoB;IADhC,IAAA,iBAAU,GAAE;qCAGe,6DAA6B;QAC/B,mBAAY;QACI,2DAA4B;GAJzD,oBAAoB,CAsEhC;AAtEY,oDAAoB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OpenId4VcVerifierModuleConfigOptions } from './OpenId4VcVerifierModuleConfig';
|
|
2
|
+
import type { AgentContext, DependencyManager, Module } from '@credo-ts/core';
|
|
3
|
+
import { OpenId4VcVerifierApi } from './OpenId4VcVerifierApi';
|
|
4
|
+
import { OpenId4VcVerifierModuleConfig } from './OpenId4VcVerifierModuleConfig';
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class OpenId4VcVerifierModule implements Module {
|
|
9
|
+
readonly api: typeof OpenId4VcVerifierApi;
|
|
10
|
+
readonly config: OpenId4VcVerifierModuleConfig;
|
|
11
|
+
constructor(options: OpenId4VcVerifierModuleConfigOptions);
|
|
12
|
+
/**
|
|
13
|
+
* Registers the dependencies of the question answer module on the dependency manager.
|
|
14
|
+
*/
|
|
15
|
+
register(dependencyManager: DependencyManager): void;
|
|
16
|
+
initialize(rootAgentContext: AgentContext): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Registers the endpoints on the router passed to this module.
|
|
19
|
+
*/
|
|
20
|
+
private configureRouter;
|
|
21
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenId4VcVerifierModule = void 0;
|
|
4
|
+
const core_1 = require("@credo-ts/core");
|
|
5
|
+
const router_1 = require("../shared/router");
|
|
6
|
+
const OpenId4VcSiopVerifierService_1 = require("./OpenId4VcSiopVerifierService");
|
|
7
|
+
const OpenId4VcVerifierApi_1 = require("./OpenId4VcVerifierApi");
|
|
8
|
+
const OpenId4VcVerifierModuleConfig_1 = require("./OpenId4VcVerifierModuleConfig");
|
|
9
|
+
const repository_1 = require("./repository");
|
|
10
|
+
const router_2 = require("./router");
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
class OpenId4VcVerifierModule {
|
|
15
|
+
constructor(options) {
|
|
16
|
+
this.api = OpenId4VcVerifierApi_1.OpenId4VcVerifierApi;
|
|
17
|
+
this.config = new OpenId4VcVerifierModuleConfig_1.OpenId4VcVerifierModuleConfig(options);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Registers the dependencies of the question answer module on the dependency manager.
|
|
21
|
+
*/
|
|
22
|
+
register(dependencyManager) {
|
|
23
|
+
// Warn about experimental module
|
|
24
|
+
const logger = dependencyManager.resolve(core_1.AgentConfig).logger;
|
|
25
|
+
logger.warn("The '@credo-ts/openid4vc' Verifier module is experimental and could have unexpected breaking changes. When using this module, make sure to use strict versions for all @credo-ts packages.");
|
|
26
|
+
// Register config
|
|
27
|
+
dependencyManager.registerInstance(OpenId4VcVerifierModuleConfig_1.OpenId4VcVerifierModuleConfig, this.config);
|
|
28
|
+
// Services
|
|
29
|
+
dependencyManager.registerSingleton(OpenId4VcSiopVerifierService_1.OpenId4VcSiopVerifierService);
|
|
30
|
+
// Repository
|
|
31
|
+
dependencyManager.registerSingleton(repository_1.OpenId4VcVerifierRepository);
|
|
32
|
+
}
|
|
33
|
+
async initialize(rootAgentContext) {
|
|
34
|
+
this.configureRouter(rootAgentContext);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Registers the endpoints on the router passed to this module.
|
|
38
|
+
*/
|
|
39
|
+
configureRouter(rootAgentContext) {
|
|
40
|
+
const { Router, json, urlencoded } = (0, router_1.importExpress)();
|
|
41
|
+
// FIXME: it is currently not possible to initialize an agent
|
|
42
|
+
// shut it down, and then start it again, as the
|
|
43
|
+
// express router is configured with a specific `AgentContext` instance
|
|
44
|
+
// and dependency manager. One option is to always create a new router
|
|
45
|
+
// but then users cannot pass their own router implementation.
|
|
46
|
+
// We need to find a proper way to fix this.
|
|
47
|
+
// We use separate context router and endpoint router. Context router handles the linking of the request
|
|
48
|
+
// to a specific agent context. Endpoint router only knows about a single context
|
|
49
|
+
const endpointRouter = Router();
|
|
50
|
+
const contextRouter = this.config.router;
|
|
51
|
+
// parse application/x-www-form-urlencoded
|
|
52
|
+
contextRouter.use(urlencoded({ extended: false }));
|
|
53
|
+
// parse application/json
|
|
54
|
+
contextRouter.use(json());
|
|
55
|
+
contextRouter.param('verifierId', async (req, _res, next, verifierId) => {
|
|
56
|
+
if (!verifierId) {
|
|
57
|
+
rootAgentContext.config.logger.debug('No verifierId provided for incoming authorization response, returning 404');
|
|
58
|
+
_res.status(404).send('Not found');
|
|
59
|
+
}
|
|
60
|
+
let agentContext = undefined;
|
|
61
|
+
try {
|
|
62
|
+
agentContext = await (0, router_1.getAgentContextForActorId)(rootAgentContext, verifierId);
|
|
63
|
+
const verifierApi = agentContext.dependencyManager.resolve(OpenId4VcVerifierApi_1.OpenId4VcVerifierApi);
|
|
64
|
+
const verifier = await verifierApi.getByVerifierId(verifierId);
|
|
65
|
+
req.requestContext = {
|
|
66
|
+
agentContext,
|
|
67
|
+
verifier,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
agentContext === null || agentContext === void 0 ? void 0 : agentContext.config.logger.error('Failed to correlate incoming openid request to existing tenant and verifier', {
|
|
72
|
+
error,
|
|
73
|
+
});
|
|
74
|
+
// If the opening failed
|
|
75
|
+
await (agentContext === null || agentContext === void 0 ? void 0 : agentContext.endSession());
|
|
76
|
+
return _res.status(404).send('Not found');
|
|
77
|
+
}
|
|
78
|
+
next();
|
|
79
|
+
});
|
|
80
|
+
contextRouter.use('/:verifierId', endpointRouter);
|
|
81
|
+
// Configure endpoints
|
|
82
|
+
(0, router_2.configureAuthorizationEndpoint)(endpointRouter, this.config.authorizationEndpoint);
|
|
83
|
+
// First one will be called for all requests (when next is called)
|
|
84
|
+
contextRouter.use(async (req, _res, next) => {
|
|
85
|
+
const { agentContext } = (0, router_1.getRequestContext)(req);
|
|
86
|
+
await agentContext.endSession();
|
|
87
|
+
next();
|
|
88
|
+
});
|
|
89
|
+
// This one will be called for all errors that are thrown
|
|
90
|
+
contextRouter.use(async (_error, req, _res, next) => {
|
|
91
|
+
const { agentContext } = (0, router_1.getRequestContext)(req);
|
|
92
|
+
await agentContext.endSession();
|
|
93
|
+
next();
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.OpenId4VcVerifierModule = OpenId4VcVerifierModule;
|
|
98
|
+
//# sourceMappingURL=OpenId4VcVerifierModule.js.map
|
|
@@ -0,0 +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;AAEzD;;GAEG;AACH,MAAa,uBAAuB;IAIlC,YAAmB,OAA6C;QAHhD,QAAG,GAAG,2CAAoB,CAAA;QAIxC,IAAI,C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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;QAEF,yDAAyD;QACzD,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,MAAe,EAAE,GAAiC,EAAE,IAAa,EAAE,IAAkB,EAAE,EAAE;YAChH,MAAM,EAAE,YAAY,EAAE,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;AA5GD,0DA4GC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { OpenId4VcSiopAuthorizationEndpointConfig } from './router/authorizationEndpoint';
|
|
3
|
+
import type { Optional, AgentContext } from '@credo-ts/core';
|
|
4
|
+
import type { IRPSessionManager } from '@sphereon/did-auth-siop';
|
|
5
|
+
import type { Router } from 'express';
|
|
6
|
+
export interface OpenId4VcVerifierModuleConfigOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Base url at which the verifier endpoints will be hosted. All endpoints will be exposed with
|
|
9
|
+
* this path as prefix.
|
|
10
|
+
*/
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
/**
|
|
13
|
+
* Express router on which the verifier endpoints will be registered. If
|
|
14
|
+
* no router is provided, a new one will be created.
|
|
15
|
+
*
|
|
16
|
+
* NOTE: you must manually register the router on your express app and
|
|
17
|
+
* expose this on a public url that is reachable when `baseUrl` is called.
|
|
18
|
+
*/
|
|
19
|
+
router?: Router;
|
|
20
|
+
endpoints?: {
|
|
21
|
+
authorization?: Optional<OpenId4VcSiopAuthorizationEndpointConfig, 'endpointPath'>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare class OpenId4VcVerifierModuleConfig {
|
|
25
|
+
private options;
|
|
26
|
+
readonly router: Router;
|
|
27
|
+
private eventEmitterMap;
|
|
28
|
+
private sessionManagerMap;
|
|
29
|
+
constructor(options: OpenId4VcVerifierModuleConfigOptions);
|
|
30
|
+
get baseUrl(): string;
|
|
31
|
+
get authorizationEndpoint(): OpenId4VcSiopAuthorizationEndpointConfig;
|
|
32
|
+
getSessionManager(agentContext: AgentContext): IRPSessionManager;
|
|
33
|
+
getEventEmitter(agentContext: AgentContext): import("events");
|
|
34
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenId4VcVerifierModuleConfig = void 0;
|
|
4
|
+
const did_auth_siop_1 = require("@sphereon/did-auth-siop");
|
|
5
|
+
const router_1 = require("../shared/router");
|
|
6
|
+
class OpenId4VcVerifierModuleConfig {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
var _a;
|
|
9
|
+
this.options = options;
|
|
10
|
+
this.sessionManagerMap = new Map();
|
|
11
|
+
this.eventEmitterMap = new Map();
|
|
12
|
+
this.router = (_a = options.router) !== null && _a !== void 0 ? _a : (0, router_1.importExpress)().Router();
|
|
13
|
+
}
|
|
14
|
+
get baseUrl() {
|
|
15
|
+
return this.options.baseUrl;
|
|
16
|
+
}
|
|
17
|
+
get authorizationEndpoint() {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
// Use user supplied options, or return defaults.
|
|
20
|
+
const userOptions = (_a = this.options.endpoints) === null || _a === void 0 ? void 0 : _a.authorization;
|
|
21
|
+
return Object.assign(Object.assign({}, userOptions), { endpointPath: (_b = userOptions === null || userOptions === void 0 ? void 0 : userOptions.endpointPath) !== null && _b !== void 0 ? _b : '/authorize' });
|
|
22
|
+
}
|
|
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
|
+
}
|
|
44
|
+
exports.OpenId4VcVerifierModuleConfig = OpenId4VcVerifierModuleConfig;
|
|
45
|
+
//# sourceMappingURL=OpenId4VcVerifierModuleConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VcVerifierModuleConfig.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierModuleConfig.ts"],"names":[],"mappings":";;;AAKA,2DAAkE;AAElE,6CAAgD;AAuBhD,MAAa,6BAA6B;IAOxC,YAAmB,OAA6C;;QAC9D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAA;QAClC,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAE,CAAA;QAEhC,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,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;IAED,+BAA+B;IACxB,iBAAiB,CAAC,YAA0B;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAA;QACzE,IAAI,GAAG;YAAE,OAAO,GAAG,CAAA;QAEnB,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAA;QAEvD,MAAM,MAAM,GAAG,IAAI,wCAAwB,CAAC,YAAY,CAAC,CAAA;QACzD,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAA;QACrE,OAAO,MAAM,CAAA;IACf,CAAC;IAED,4BAA4B;IACrB,eAAe,CAAC,YAA0B;QAC/C,MAAM,iBAAiB,GAAG,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAC,iBAAiB,CAAA;QAEjF,MAAM,GAAG,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAA;QACvE,IAAI,GAAG;YAAE,OAAO,GAAG,CAAA;QAEnB,MAAM,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAA;QACtC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAA;QACnE,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AApDD,sEAoDC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './OpenId4VcVerifierApi';
|
|
2
|
+
export * from './OpenId4VcVerifierModule';
|
|
3
|
+
export * from './OpenId4VcSiopVerifierService';
|
|
4
|
+
export * from './OpenId4VcSiopVerifierServiceOptions';
|
|
5
|
+
export * from './OpenId4VcVerifierModuleConfig';
|
|
6
|
+
export * from './repository';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./OpenId4VcVerifierApi"), exports);
|
|
18
|
+
__exportStar(require("./OpenId4VcVerifierModule"), exports);
|
|
19
|
+
__exportStar(require("./OpenId4VcSiopVerifierService"), exports);
|
|
20
|
+
__exportStar(require("./OpenId4VcSiopVerifierServiceOptions"), exports);
|
|
21
|
+
__exportStar(require("./OpenId4VcVerifierModuleConfig"), exports);
|
|
22
|
+
__exportStar(require("./repository"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { RecordTags, TagsBase } from '@credo-ts/core';
|
|
2
|
+
import { BaseRecord } from '@credo-ts/core';
|
|
3
|
+
export type OpenId4VcVerifierRecordTags = RecordTags<OpenId4VcVerifierRecord>;
|
|
4
|
+
export type DefaultOpenId4VcVerifierRecordTags = {
|
|
5
|
+
verifierId: string;
|
|
6
|
+
};
|
|
7
|
+
export interface OpenId4VcVerifierRecordProps {
|
|
8
|
+
id?: string;
|
|
9
|
+
createdAt?: Date;
|
|
10
|
+
tags?: TagsBase;
|
|
11
|
+
verifierId: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* For OID4VC you need to expos metadata files. Each issuer needs to host this metadata. This is not the case for DIDComm where we can just have one /didcomm endpoint.
|
|
15
|
+
* So we create a record per openid issuer/verifier that you want, and each tenant can create multiple issuers/verifiers which have different endpoints
|
|
16
|
+
* and metadata files
|
|
17
|
+
* */
|
|
18
|
+
export declare class OpenId4VcVerifierRecord extends BaseRecord<DefaultOpenId4VcVerifierRecordTags> {
|
|
19
|
+
static readonly type = "OpenId4VcVerifierRecord";
|
|
20
|
+
readonly type = "OpenId4VcVerifierRecord";
|
|
21
|
+
verifierId: string;
|
|
22
|
+
constructor(props: OpenId4VcVerifierRecordProps);
|
|
23
|
+
getTags(): {
|
|
24
|
+
verifierId: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenId4VcVerifierRecord = void 0;
|
|
4
|
+
const core_1 = require("@credo-ts/core");
|
|
5
|
+
/**
|
|
6
|
+
* For OID4VC you need to expos metadata files. Each issuer needs to host this metadata. This is not the case for DIDComm where we can just have one /didcomm endpoint.
|
|
7
|
+
* So we create a record per openid issuer/verifier that you want, and each tenant can create multiple issuers/verifiers which have different endpoints
|
|
8
|
+
* and metadata files
|
|
9
|
+
* */
|
|
10
|
+
class OpenId4VcVerifierRecord extends core_1.BaseRecord {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
var _a, _b, _c;
|
|
13
|
+
super();
|
|
14
|
+
this.type = OpenId4VcVerifierRecord.type;
|
|
15
|
+
if (props) {
|
|
16
|
+
this.id = (_a = props.id) !== null && _a !== void 0 ? _a : core_1.utils.uuid();
|
|
17
|
+
this.createdAt = (_b = props.createdAt) !== null && _b !== void 0 ? _b : new Date();
|
|
18
|
+
this._tags = (_c = props.tags) !== null && _c !== void 0 ? _c : {};
|
|
19
|
+
this.verifierId = props.verifierId;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
getTags() {
|
|
23
|
+
return Object.assign(Object.assign({}, this._tags), { verifierId: this.verifierId });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.OpenId4VcVerifierRecord = OpenId4VcVerifierRecord;
|
|
27
|
+
OpenId4VcVerifierRecord.type = 'OpenId4VcVerifierRecord';
|
|
28
|
+
//# sourceMappingURL=OpenId4VcVerifierRecord.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VcVerifierRecord.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/repository/OpenId4VcVerifierRecord.ts"],"names":[],"mappings":";;;AAEA,yCAAkD;AAgBlD;;;;KAIK;AACL,MAAa,uBAAwB,SAAQ,iBAA8C;IAMzF,YAAmB,KAAmC;;QACpD,KAAK,EAAE,CAAA;QALO,SAAI,GAAG,uBAAuB,CAAC,IAAI,CAAA;QAOjD,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,EAAE,GAAG,MAAA,KAAK,CAAC,EAAE,mCAAI,YAAK,CAAC,IAAI,EAAE,CAAA;YAClC,IAAI,CAAC,SAAS,GAAG,MAAA,KAAK,CAAC,SAAS,mCAAI,IAAI,IAAI,EAAE,CAAA;YAC9C,IAAI,CAAC,KAAK,GAAG,MAAA,KAAK,CAAC,IAAI,mCAAI,EAAE,CAAA;YAE7B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAA;SACnC;IACH,CAAC;IAEM,OAAO;QACZ,uCACK,IAAI,CAAC,KAAK,KACb,UAAU,EAAE,IAAI,CAAC,UAAU,IAC5B;IACH,CAAC;;AAvBH,0DAwBC;AAvBwB,4BAAI,GAAG,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AgentContext } from '@credo-ts/core';
|
|
2
|
+
import { Repository, StorageService, EventEmitter } from '@credo-ts/core';
|
|
3
|
+
import { OpenId4VcVerifierRecord } from './OpenId4VcVerifierRecord';
|
|
4
|
+
export declare class OpenId4VcVerifierRepository extends Repository<OpenId4VcVerifierRecord> {
|
|
5
|
+
constructor(storageService: StorageService<OpenId4VcVerifierRecord>, eventEmitter: EventEmitter);
|
|
6
|
+
findByVerifierId(agentContext: AgentContext, verifierId: string): Promise<OpenId4VcVerifierRecord | null>;
|
|
7
|
+
getByVerifierId(agentContext: AgentContext, verifierId: string): Promise<OpenId4VcVerifierRecord>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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.OpenId4VcVerifierRepository = void 0;
|
|
16
|
+
const core_1 = require("@credo-ts/core");
|
|
17
|
+
const OpenId4VcVerifierRecord_1 = require("./OpenId4VcVerifierRecord");
|
|
18
|
+
let OpenId4VcVerifierRepository = class OpenId4VcVerifierRepository extends core_1.Repository {
|
|
19
|
+
constructor(storageService, eventEmitter) {
|
|
20
|
+
super(OpenId4VcVerifierRecord_1.OpenId4VcVerifierRecord, storageService, eventEmitter);
|
|
21
|
+
}
|
|
22
|
+
findByVerifierId(agentContext, verifierId) {
|
|
23
|
+
return this.findSingleByQuery(agentContext, { verifierId });
|
|
24
|
+
}
|
|
25
|
+
getByVerifierId(agentContext, verifierId) {
|
|
26
|
+
return this.getSingleByQuery(agentContext, { verifierId });
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
OpenId4VcVerifierRepository = __decorate([
|
|
30
|
+
(0, core_1.injectable)(),
|
|
31
|
+
__param(0, (0, core_1.inject)(core_1.InjectionSymbols.StorageService)),
|
|
32
|
+
__metadata("design:paramtypes", [Object, core_1.EventEmitter])
|
|
33
|
+
], OpenId4VcVerifierRepository);
|
|
34
|
+
exports.OpenId4VcVerifierRepository = OpenId4VcVerifierRepository;
|
|
35
|
+
//# sourceMappingURL=OpenId4VcVerifierRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VcVerifierRepository.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/repository/OpenId4VcVerifierRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,yCAA+G;AAE/G,uEAAmE;AAG5D,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,iBAAmC;IAClF,YAC2C,cAAuD,EAChG,YAA0B;QAE1B,KAAK,CAAC,iDAAuB,EAAE,cAAc,EAAE,YAAY,CAAC,CAAA;IAC9D,CAAC;IAEM,gBAAgB,CAAC,YAA0B,EAAE,UAAkB;QACpE,OAAO,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,CAAC,CAAA;IAC7D,CAAC;IAEM,eAAe,CAAC,YAA0B,EAAE,UAAkB;QACnE,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,CAAC,CAAA;IAC5D,CAAC;CACF,CAAA;AAfY,2BAA2B;IADvC,IAAA,iBAAU,GAAE;IAGR,WAAA,IAAA,aAAM,EAAC,uBAAgB,CAAC,cAAc,CAAC,CAAA;6CAC1B,mBAAY;GAHjB,2BAA2B,CAevC;AAfY,kEAA2B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./OpenId4VcVerifierRecord"), exports);
|
|
18
|
+
__exportStar(require("./OpenId4VcVerifierRepository"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/repository/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAyC;AACzC,gEAA6C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Router } from 'express';
|
|
2
|
+
export interface OpenId4VcSiopAuthorizationEndpointConfig {
|
|
3
|
+
/**
|
|
4
|
+
* The path at which the authorization endpoint should be made available. Note that it will be
|
|
5
|
+
* hosted at a subpath to take into account multiple tenants and verifiers.
|
|
6
|
+
*
|
|
7
|
+
* @default /authorize
|
|
8
|
+
*/
|
|
9
|
+
endpointPath: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function configureAuthorizationEndpoint(router: Router, config: OpenId4VcSiopAuthorizationEndpointConfig): void;
|