@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,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configureAuthorizationEndpoint = void 0;
|
|
4
|
+
const router_1 = require("../../shared/router");
|
|
5
|
+
const OpenId4VcSiopVerifierService_1 = require("../OpenId4VcSiopVerifierService");
|
|
6
|
+
function configureAuthorizationEndpoint(router, config) {
|
|
7
|
+
router.post(config.endpointPath, async (request, response, next) => {
|
|
8
|
+
const { agentContext, verifier } = (0, router_1.getRequestContext)(request);
|
|
9
|
+
try {
|
|
10
|
+
const openId4VcVerifierService = agentContext.dependencyManager.resolve(OpenId4VcSiopVerifierService_1.OpenId4VcSiopVerifierService);
|
|
11
|
+
const isVpRequest = request.body.presentation_submission !== undefined;
|
|
12
|
+
const authorizationResponse = request.body;
|
|
13
|
+
if (isVpRequest)
|
|
14
|
+
authorizationResponse.presentation_submission = JSON.parse(request.body.presentation_submission);
|
|
15
|
+
// FIXME: we should emit an event here and in other places
|
|
16
|
+
await openId4VcVerifierService.verifyAuthorizationResponse(agentContext, {
|
|
17
|
+
authorizationResponse: request.body,
|
|
18
|
+
verifier,
|
|
19
|
+
});
|
|
20
|
+
response.status(200).send();
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
(0, router_1.sendErrorResponse)(response, agentContext.config.logger, 500, 'invalid_request', error);
|
|
24
|
+
}
|
|
25
|
+
// NOTE: if we don't call next, the agentContext session handler will NOT be called
|
|
26
|
+
next();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.configureAuthorizationEndpoint = configureAuthorizationEndpoint;
|
|
30
|
+
//# sourceMappingURL=authorizationEndpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorizationEndpoint.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/router/authorizationEndpoint.ts"],"names":[],"mappings":";;;AAIA,gDAA0E;AAC1E,kFAA8E;AAY9E,SAAgB,8BAA8B,CAAC,MAAc,EAAE,MAAgD;IAC7G,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,EAAE,OAAqC,EAAE,QAAkB,EAAE,IAAI,EAAE,EAAE;QACzG,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,CAAA;QAE7D,IAAI;YACF,MAAM,wBAAwB,GAAG,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,2DAA4B,CAAC,CAAA;YACrG,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,uBAAuB,KAAK,SAAS,CAAA;YAEtE,MAAM,qBAAqB,GAAiC,OAAO,CAAC,IAAI,CAAA;YACxE,IAAI,WAAW;gBAAE,qBAAqB,CAAC,uBAAuB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA;YAEjH,0DAA0D;YAC1D,MAAM,wBAAwB,CAAC,2BAA2B,CAAC,YAAY,EAAE;gBACvE,qBAAqB,EAAE,OAAO,CAAC,IAAI;gBACnC,QAAQ;aACT,CAAC,CAAA;YACF,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;SAC5B;QAAC,OAAO,KAAK,EAAE;YACd,IAAA,0BAAiB,EAAC,QAAQ,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAA;SACvF;QAED,mFAAmF;QACnF,IAAI,EAAE,CAAA;IACR,CAAC,CAAC,CAAA;AACJ,CAAC;AAxBD,wEAwBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configureAuthorizationEndpoint = void 0;
|
|
4
|
+
var authorizationEndpoint_1 = require("./authorizationEndpoint");
|
|
5
|
+
Object.defineProperty(exports, "configureAuthorizationEndpoint", { enumerable: true, get: function () { return authorizationEndpoint_1.configureAuthorizationEndpoint; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/router/index.ts"],"names":[],"mappings":";;;AAAA,iEAAwE;AAA/D,uIAAA,8BAA8B,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestContext.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/router/requestContext.ts"],"names":[],"mappings":""}
|
|
@@ -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("./models"), exports);
|
|
18
|
+
__exportStar(require("./issuerMetadataUtils"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,wDAAqC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OpenId4VciCredentialSupported, OpenId4VciCredentialSupportedWithId } from './models';
|
|
2
|
+
import type { AuthorizationDetails, CredentialOfferFormat, EndpointMetadataResult } from '@sphereon/oid4vci-common';
|
|
3
|
+
/**
|
|
4
|
+
* Get all `types` from a `CredentialSupported` object.
|
|
5
|
+
*
|
|
6
|
+
* Depending on the format, the types may be nested, or have different a different name/type
|
|
7
|
+
*/
|
|
8
|
+
export declare function getTypesFromCredentialSupported(credentialSupported: OpenId4VciCredentialSupported): string[];
|
|
9
|
+
/**
|
|
10
|
+
* Returns all entries from the credential offer with the associated metadata resolved. For 'id' entries, the associated `credentials_supported` object is resolved from the issuer metadata.
|
|
11
|
+
* For inline entries, an error is thrown.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getOfferedCredentials(offeredCredentials: Array<string | CredentialOfferFormat>, allCredentialsSupported: OpenId4VciCredentialSupported[]): OpenId4VciCredentialSupportedWithId[];
|
|
14
|
+
export declare function handleAuthorizationDetails(authorizationDetails: AuthorizationDetails | AuthorizationDetails[], metadata: EndpointMetadataResult): AuthorizationDetails | AuthorizationDetails[] | undefined;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleAuthorizationDetails = exports.getOfferedCredentials = exports.getTypesFromCredentialSupported = void 0;
|
|
4
|
+
const core_1 = require("@credo-ts/core");
|
|
5
|
+
/**
|
|
6
|
+
* Get all `types` from a `CredentialSupported` object.
|
|
7
|
+
*
|
|
8
|
+
* Depending on the format, the types may be nested, or have different a different name/type
|
|
9
|
+
*/
|
|
10
|
+
function getTypesFromCredentialSupported(credentialSupported) {
|
|
11
|
+
if (credentialSupported.format === 'jwt_vc_json-ld' ||
|
|
12
|
+
credentialSupported.format === 'ldp_vc' ||
|
|
13
|
+
credentialSupported.format === 'jwt_vc_json' ||
|
|
14
|
+
credentialSupported.format === 'jwt_vc') {
|
|
15
|
+
return credentialSupported.types;
|
|
16
|
+
}
|
|
17
|
+
else if (credentialSupported.format === 'vc+sd-jwt') {
|
|
18
|
+
return [credentialSupported.vct];
|
|
19
|
+
}
|
|
20
|
+
throw Error(`Unable to extract types from credentials supported. Unknown format ${credentialSupported.format}`);
|
|
21
|
+
}
|
|
22
|
+
exports.getTypesFromCredentialSupported = getTypesFromCredentialSupported;
|
|
23
|
+
/**
|
|
24
|
+
* Returns all entries from the credential offer with the associated metadata resolved. For 'id' entries, the associated `credentials_supported` object is resolved from the issuer metadata.
|
|
25
|
+
* For inline entries, an error is thrown.
|
|
26
|
+
*/
|
|
27
|
+
function getOfferedCredentials(offeredCredentials, allCredentialsSupported) {
|
|
28
|
+
const credentialsSupported = [];
|
|
29
|
+
for (const offeredCredential of offeredCredentials) {
|
|
30
|
+
// In draft 12 inline credential offers are removed. It's easier to already remove support now.
|
|
31
|
+
if (typeof offeredCredential !== 'string') {
|
|
32
|
+
throw new core_1.CredoError('Only referenced credentials pointing to an id in credentials_supported issuer metadata are supported');
|
|
33
|
+
}
|
|
34
|
+
const foundSupportedCredential = allCredentialsSupported.find((supportedCredential) => supportedCredential.id !== undefined && supportedCredential.id === offeredCredential);
|
|
35
|
+
// Make sure the issuer metadata includes the offered credential.
|
|
36
|
+
if (!foundSupportedCredential) {
|
|
37
|
+
throw new Error(`Offered credential '${offeredCredential}' is not part of credentials_supported of the issuer metadata.`);
|
|
38
|
+
}
|
|
39
|
+
credentialsSupported.push(foundSupportedCredential);
|
|
40
|
+
}
|
|
41
|
+
return credentialsSupported;
|
|
42
|
+
}
|
|
43
|
+
exports.getOfferedCredentials = getOfferedCredentials;
|
|
44
|
+
// copied from sphereon as the method is only available on the client
|
|
45
|
+
function handleAuthorizationDetails(authorizationDetails, metadata) {
|
|
46
|
+
if (Array.isArray(authorizationDetails)) {
|
|
47
|
+
return authorizationDetails.map((value) => handleLocations(value, metadata));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return handleLocations(authorizationDetails, metadata);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.handleAuthorizationDetails = handleAuthorizationDetails;
|
|
54
|
+
// copied from sphereon as the method is only available on the client
|
|
55
|
+
function handleLocations(authorizationDetails, metadata) {
|
|
56
|
+
var _a;
|
|
57
|
+
if (typeof authorizationDetails === 'string')
|
|
58
|
+
return authorizationDetails;
|
|
59
|
+
if (((_a = metadata.credentialIssuerMetadata) === null || _a === void 0 ? void 0 : _a.authorization_server) || metadata.authorization_endpoint) {
|
|
60
|
+
if (!authorizationDetails.locations)
|
|
61
|
+
authorizationDetails.locations = [metadata.issuer];
|
|
62
|
+
else if (Array.isArray(authorizationDetails.locations))
|
|
63
|
+
authorizationDetails.locations.push(metadata.issuer);
|
|
64
|
+
else
|
|
65
|
+
authorizationDetails.locations = [authorizationDetails.locations, metadata.issuer];
|
|
66
|
+
}
|
|
67
|
+
return authorizationDetails;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=issuerMetadataUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issuerMetadataUtils.js","sourceRoot":"","sources":["../../src/shared/issuerMetadataUtils.ts"],"names":[],"mappings":";;;AAGA,yCAA2C;AAE3C;;;;GAIG;AACH,SAAgB,+BAA+B,CAAC,mBAAkD;IAChG,IACE,mBAAmB,CAAC,MAAM,KAAK,gBAAgB;QAC/C,mBAAmB,CAAC,MAAM,KAAK,QAAQ;QACvC,mBAAmB,CAAC,MAAM,KAAK,aAAa;QAC5C,mBAAmB,CAAC,MAAM,KAAK,QAAQ,EACvC;QACA,OAAO,mBAAmB,CAAC,KAAK,CAAA;KACjC;SAAM,IAAI,mBAAmB,CAAC,MAAM,KAAK,WAAW,EAAE;QACrD,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAA;KACjC;IAED,MAAM,KAAK,CAAC,sEAAsE,mBAAmB,CAAC,MAAM,EAAE,CAAC,CAAA;AACjH,CAAC;AAbD,0EAaC;AAED;;;GAGG;AACH,SAAgB,qBAAqB,CACnC,kBAAyD,EACzD,uBAAwD;IAExD,MAAM,oBAAoB,GAA0C,EAAE,CAAA;IAEtE,KAAK,MAAM,iBAAiB,IAAI,kBAAkB,EAAE;QAClD,+FAA+F;QAC/F,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE;YACzC,MAAM,IAAI,iBAAU,CAClB,sGAAsG,CACvG,CAAA;SACF;QAED,MAAM,wBAAwB,GAAG,uBAAuB,CAAC,IAAI,CAC3D,CAAC,mBAAmB,EAA8D,EAAE,CAClF,mBAAmB,CAAC,EAAE,KAAK,SAAS,IAAI,mBAAmB,CAAC,EAAE,KAAK,iBAAiB,CACvF,CAAA;QAED,iEAAiE;QACjE,IAAI,CAAC,wBAAwB,EAAE;YAC7B,MAAM,IAAI,KAAK,CACb,uBAAuB,iBAAiB,gEAAgE,CACzG,CAAA;SACF;QAED,oBAAoB,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;KACpD;IAED,OAAO,oBAAoB,CAAA;AAC7B,CAAC;AA9BD,sDA8BC;AAED,qEAAqE;AACrE,SAAgB,0BAA0B,CACxC,oBAAmE,EACnE,QAAgC;IAEhC,IAAI,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE;QACvC,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAA;KAC7E;SAAM;QACL,OAAO,eAAe,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAA;KACvD;AACH,CAAC;AATD,gEASC;AAED,qEAAqE;AACrE,SAAS,eAAe,CAAC,oBAA0C,EAAE,QAAgC;;IACnG,IAAI,OAAO,oBAAoB,KAAK,QAAQ;QAAE,OAAO,oBAAoB,CAAA;IACzE,IAAI,CAAA,MAAA,QAAQ,CAAC,wBAAwB,0CAAE,oBAAoB,KAAI,QAAQ,CAAC,sBAAsB,EAAE;QAC9F,IAAI,CAAC,oBAAoB,CAAC,SAAS;YAAE,oBAAoB,CAAC,SAAS,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;aAClF,IAAI,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,SAAS,CAAC;YAAE,oBAAoB,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;;YACvG,oBAAoB,CAAC,SAAS,GAAG,CAAC,oBAAoB,CAAC,SAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;KAClG;IACD,OAAO,oBAAoB,CAAA;AAC7B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Jwk } from '@credo-ts/core';
|
|
2
|
+
export type OpenId4VcCredentialHolderDidBinding = {
|
|
3
|
+
method: 'did';
|
|
4
|
+
didUrl: string;
|
|
5
|
+
};
|
|
6
|
+
export type OpenId4VcCredentialHolderJwkBinding = {
|
|
7
|
+
method: 'jwk';
|
|
8
|
+
jwk: Jwk;
|
|
9
|
+
};
|
|
10
|
+
export type OpenId4VcCredentialHolderBinding = OpenId4VcCredentialHolderDidBinding | OpenId4VcCredentialHolderJwkBinding;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CredentialHolderBinding.js","sourceRoot":"","sources":["../../../src/shared/models/CredentialHolderBinding.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VcJwtIssuer.js","sourceRoot":"","sources":["../../../src/shared/models/OpenId4VcJwtIssuer.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenId4VciCredentialFormatProfile = void 0;
|
|
4
|
+
var OpenId4VciCredentialFormatProfile;
|
|
5
|
+
(function (OpenId4VciCredentialFormatProfile) {
|
|
6
|
+
OpenId4VciCredentialFormatProfile["JwtVcJson"] = "jwt_vc_json";
|
|
7
|
+
OpenId4VciCredentialFormatProfile["JwtVcJsonLd"] = "jwt_vc_json-ld";
|
|
8
|
+
OpenId4VciCredentialFormatProfile["LdpVc"] = "ldp_vc";
|
|
9
|
+
OpenId4VciCredentialFormatProfile["SdJwtVc"] = "vc+sd-jwt";
|
|
10
|
+
})(OpenId4VciCredentialFormatProfile = exports.OpenId4VciCredentialFormatProfile || (exports.OpenId4VciCredentialFormatProfile = {}));
|
|
11
|
+
//# sourceMappingURL=OpenId4VciCredentialFormatProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VciCredentialFormatProfile.js","sourceRoot":"","sources":["../../../src/shared/models/OpenId4VciCredentialFormatProfile.ts"],"names":[],"mappings":";;;AAAA,IAAY,iCAKX;AALD,WAAY,iCAAiC;IAC3C,8DAAyB,CAAA;IACzB,mEAA8B,CAAA;IAC9B,qDAAgB,CAAA;IAChB,0DAAqB,CAAA;AACvB,CAAC,EALW,iCAAiC,GAAjC,yCAAiC,KAAjC,yCAAiC,QAK5C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { VerifiedAuthorizationRequest, AuthorizationRequestPayload, AuthorizationResponsePayload, IDTokenPayload } from '@sphereon/did-auth-siop';
|
|
2
|
+
import type { AssertedUniformCredentialOffer, CredentialIssuerMetadata, CredentialOfferPayloadV1_0_11, CredentialRequestJwtVcJson, CredentialRequestJwtVcJsonLdAndLdpVc, CredentialRequestSdJwtVc, CredentialSupported, MetadataDisplay, UniformCredentialRequest } from '@sphereon/oid4vci-common';
|
|
3
|
+
export type OpenId4VciCredentialSupportedWithId = CredentialSupported & {
|
|
4
|
+
id: string;
|
|
5
|
+
};
|
|
6
|
+
export type OpenId4VciCredentialSupported = CredentialSupported;
|
|
7
|
+
export type OpenId4VciIssuerMetadata = CredentialIssuerMetadata;
|
|
8
|
+
export type OpenId4VciIssuerMetadataDisplay = MetadataDisplay;
|
|
9
|
+
export type OpenId4VciCredentialRequest = UniformCredentialRequest;
|
|
10
|
+
export type OpenId4VciCredentialRequestJwtVcJson = CredentialRequestJwtVcJson;
|
|
11
|
+
export type OpenId4VciCredentialRequestJwtVcJsonLdAndLdpVc = CredentialRequestJwtVcJsonLdAndLdpVc;
|
|
12
|
+
export type OpenId4VciCredentialRequestSdJwtVc = CredentialRequestSdJwtVc;
|
|
13
|
+
export type OpenId4VciCredentialOffer = AssertedUniformCredentialOffer;
|
|
14
|
+
export type OpenId4VciCredentialOfferPayload = CredentialOfferPayloadV1_0_11;
|
|
15
|
+
export type OpenId4VcSiopVerifiedAuthorizationRequest = VerifiedAuthorizationRequest;
|
|
16
|
+
export type OpenId4VcSiopAuthorizationRequestPayload = AuthorizationRequestPayload;
|
|
17
|
+
export type OpenId4VcSiopAuthorizationResponsePayload = AuthorizationResponsePayload;
|
|
18
|
+
export type OpenId4VcSiopIdTokenPayload = IDTokenPayload;
|
|
19
|
+
export * from './OpenId4VcJwtIssuer';
|
|
20
|
+
export * from './CredentialHolderBinding';
|
|
21
|
+
export * from './OpenId4VciCredentialFormatProfile';
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./OpenId4VcJwtIssuer"), exports);
|
|
18
|
+
__exportStar(require("./CredentialHolderBinding"), exports);
|
|
19
|
+
__exportStar(require("./OpenId4VciCredentialFormatProfile"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkCA,uDAAoC;AACpC,4DAAyC;AACzC,sEAAmD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AgentContext, Logger } from '@credo-ts/core';
|
|
2
|
+
import type { Response, Request } from 'express';
|
|
3
|
+
export interface OpenId4VcRequest<RC extends Record<string, unknown> = Record<string, never>> extends Request {
|
|
4
|
+
requestContext?: RC & OpenId4VcRequestContext;
|
|
5
|
+
}
|
|
6
|
+
export interface OpenId4VcRequestContext {
|
|
7
|
+
agentContext: AgentContext;
|
|
8
|
+
}
|
|
9
|
+
export declare function sendErrorResponse(response: Response, logger: Logger, code: number, message: string, error: unknown): Response<any, Record<string, any>>;
|
|
10
|
+
export declare function getRequestContext<T extends OpenId4VcRequest<any>>(request: T): NonNullable<T['requestContext']>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRequestContext = exports.sendErrorResponse = void 0;
|
|
4
|
+
const core_1 = require("@credo-ts/core");
|
|
5
|
+
function sendErrorResponse(response, logger, code, message, error) {
|
|
6
|
+
const error_description = error instanceof Error ? error.message : typeof error === 'string' ? error : 'An unknown error occurred.';
|
|
7
|
+
const body = { error: message, error_description };
|
|
8
|
+
logger.warn(`[OID4VCI] Sending error response: ${JSON.stringify(body)}`, {
|
|
9
|
+
error,
|
|
10
|
+
});
|
|
11
|
+
return response.status(code).json(body);
|
|
12
|
+
}
|
|
13
|
+
exports.sendErrorResponse = sendErrorResponse;
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
function getRequestContext(request) {
|
|
16
|
+
const requestContext = request.requestContext;
|
|
17
|
+
if (!requestContext)
|
|
18
|
+
throw new core_1.CredoError('Request context not set.');
|
|
19
|
+
return requestContext;
|
|
20
|
+
}
|
|
21
|
+
exports.getRequestContext = getRequestContext;
|
|
22
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/shared/router/context.ts"],"names":[],"mappings":";;;AAGA,yCAA2C;AAU3C,SAAgB,iBAAiB,CAAC,QAAkB,EAAE,MAAc,EAAE,IAAY,EAAE,OAAe,EAAE,KAAc;IACjH,MAAM,iBAAiB,GACrB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,4BAA4B,CAAA;IAE3G,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAA;IAClD,MAAM,CAAC,IAAI,CAAC,qCAAqC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE;QACvE,KAAK;KACN,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzC,CAAC;AAVD,8CAUC;AAED,8DAA8D;AAC9D,SAAgB,iBAAiB,CAAkC,OAAU;IAC3E,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;IAC7C,IAAI,CAAC,cAAc;QAAE,MAAM,IAAI,iBAAU,CAAC,0BAA0B,CAAC,CAAA;IAErE,OAAO,cAAc,CAAA;AACvB,CAAC;AALD,8CAKC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.importExpress = void 0;
|
|
4
|
+
function importExpress() {
|
|
5
|
+
try {
|
|
6
|
+
// NOTE: 'express' is added as a peer-dependency, and is required when using this module
|
|
7
|
+
// eslint-disable-next-line import/no-extraneous-dependencies, @typescript-eslint/no-var-requires
|
|
8
|
+
const express = require('express');
|
|
9
|
+
return express;
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
throw new Error('Express must be installed as a peer dependency');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.importExpress = importExpress;
|
|
16
|
+
//# sourceMappingURL=express.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.js","sourceRoot":"","sources":["../../../src/shared/router/express.ts"],"names":[],"mappings":";;;AAEA,SAAgB,aAAa;IAC3B,IAAI;QACF,wFAAwF;QACxF,iGAAiG;QACjG,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAmB,CAAA;QACpD,OAAO,OAAO,CAAA;KACf;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;KAClE;AACH,CAAC;AATD,sCASC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./express"), exports);
|
|
18
|
+
__exportStar(require("./context"), exports);
|
|
19
|
+
__exportStar(require("./tenants"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/router/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,4CAAyB;AACzB,4CAAyB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AgentContext } from '@credo-ts/core';
|
|
2
|
+
export declare function getAgentContextForActorId(rootAgentContext: AgentContext, actorId: string): Promise<AgentContext>;
|
|
3
|
+
/**
|
|
4
|
+
* Store the actor id associated with a context correlation id. If multi-tenancy is not used
|
|
5
|
+
* this method won't do anything as we can just use the actor from the default context. However
|
|
6
|
+
* if multi-tenancy is used, we will store the actor id in the tenant record metadata so it can
|
|
7
|
+
* be queried when a request comes in for the specific actor id.
|
|
8
|
+
*
|
|
9
|
+
* The reason for doing this is that we don't want to expose the context correlation id in the
|
|
10
|
+
* actor metadata url, as it is then possible to see exactly which actors are registered under
|
|
11
|
+
* the same agent.
|
|
12
|
+
*/
|
|
13
|
+
export declare function storeActorIdForContextCorrelationId(agentContext: AgentContext, actorId: string): Promise<void>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storeActorIdForContextCorrelationId = exports.getAgentContextForActorId = void 0;
|
|
4
|
+
const core_1 = require("@credo-ts/core");
|
|
5
|
+
const OPENID4VC_ACTOR_IDS_METADATA_KEY = '_openid4vc/openId4VcActorIds';
|
|
6
|
+
async function getAgentContextForActorId(rootAgentContext, actorId) {
|
|
7
|
+
// Check if multi-tenancy is enabled, and if so find the associated multi-tenant record
|
|
8
|
+
// This is a bit hacky as it uses the tenants module to store the openid4vc actor id
|
|
9
|
+
// but this way we don't have to expose the contextCorrelationId in the openid metadata
|
|
10
|
+
const tenantsApi = (0, core_1.getApiForModuleByName)(rootAgentContext, 'TenantsModule');
|
|
11
|
+
if (tenantsApi) {
|
|
12
|
+
const [tenant] = await tenantsApi.findTenantsByQuery({
|
|
13
|
+
[OPENID4VC_ACTOR_IDS_METADATA_KEY]: [actorId],
|
|
14
|
+
});
|
|
15
|
+
if (tenant) {
|
|
16
|
+
const agentContextProvider = rootAgentContext.dependencyManager.resolve(core_1.InjectionSymbols.AgentContextProvider);
|
|
17
|
+
return agentContextProvider.getAgentContextForContextCorrelationId(tenant.id);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return rootAgentContext;
|
|
21
|
+
}
|
|
22
|
+
exports.getAgentContextForActorId = getAgentContextForActorId;
|
|
23
|
+
/**
|
|
24
|
+
* Store the actor id associated with a context correlation id. If multi-tenancy is not used
|
|
25
|
+
* this method won't do anything as we can just use the actor from the default context. However
|
|
26
|
+
* if multi-tenancy is used, we will store the actor id in the tenant record metadata so it can
|
|
27
|
+
* be queried when a request comes in for the specific actor id.
|
|
28
|
+
*
|
|
29
|
+
* The reason for doing this is that we don't want to expose the context correlation id in the
|
|
30
|
+
* actor metadata url, as it is then possible to see exactly which actors are registered under
|
|
31
|
+
* the same agent.
|
|
32
|
+
*/
|
|
33
|
+
async function storeActorIdForContextCorrelationId(agentContext, actorId) {
|
|
34
|
+
var _a;
|
|
35
|
+
// It's kind of hacky, but we add support for the tenants module specifically here to map an actorId to
|
|
36
|
+
// a specific tenant. Otherwise we have to expose /:contextCorrelationId/:actorId in all the public URLs
|
|
37
|
+
// which is of course not so nice.
|
|
38
|
+
const tenantsApi = (0, core_1.getApiForModuleByName)(agentContext, 'TenantsModule');
|
|
39
|
+
// We don't want to query the tenant record if the current context is the root context
|
|
40
|
+
if (tenantsApi && tenantsApi.rootAgentContext.contextCorrelationId !== agentContext.contextCorrelationId) {
|
|
41
|
+
const tenantRecord = await tenantsApi.getTenantById(agentContext.contextCorrelationId);
|
|
42
|
+
const currentOpenId4VcActorIds = (_a = tenantRecord.metadata.get(OPENID4VC_ACTOR_IDS_METADATA_KEY)) !== null && _a !== void 0 ? _a : [];
|
|
43
|
+
const openId4VcActorIds = [...currentOpenId4VcActorIds, actorId];
|
|
44
|
+
tenantRecord.metadata.set(OPENID4VC_ACTOR_IDS_METADATA_KEY, openId4VcActorIds);
|
|
45
|
+
tenantRecord.setTag(OPENID4VC_ACTOR_IDS_METADATA_KEY, openId4VcActorIds);
|
|
46
|
+
await tenantsApi.updateTenant(tenantRecord);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.storeActorIdForContextCorrelationId = storeActorIdForContextCorrelationId;
|
|
50
|
+
//# sourceMappingURL=tenants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenants.js","sourceRoot":"","sources":["../../../src/shared/router/tenants.ts"],"names":[],"mappings":";;;AAGA,yCAAwE;AAExE,MAAM,gCAAgC,GAAG,8BAA8B,CAAA;AAEhE,KAAK,UAAU,yBAAyB,CAAC,gBAA8B,EAAE,OAAe;IAC7F,uFAAuF;IACvF,oFAAoF;IACpF,uFAAuF;IACvF,MAAM,UAAU,GAAG,IAAA,4BAAqB,EAAgB,gBAAgB,EAAE,eAAe,CAAC,CAAA;IAC1F,IAAI,UAAU,EAAE;QACd,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC;YACnD,CAAC,gCAAgC,CAAC,EAAE,CAAC,OAAO,CAAC;SAC9C,CAAC,CAAA;QAEF,IAAI,MAAM,EAAE;YACV,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CACrE,uBAAgB,CAAC,oBAAoB,CACtC,CAAA;YACD,OAAO,oBAAoB,CAAC,sCAAsC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;SAC9E;KACF;IAED,OAAO,gBAAgB,CAAA;AACzB,CAAC;AAnBD,8DAmBC;AAED;;;;;;;;;GASG;AACI,KAAK,UAAU,mCAAmC,CAAC,YAA0B,EAAE,OAAe;;IACnG,uGAAuG;IACvG,wGAAwG;IACxG,kCAAkC;IAClC,MAAM,UAAU,GAAG,IAAA,4BAAqB,EAAgB,YAAY,EAAE,eAAe,CAAC,CAAA;IAEtF,sFAAsF;IACtF,IAAI,UAAU,IAAI,UAAU,CAAC,gBAAgB,CAAC,oBAAoB,KAAK,YAAY,CAAC,oBAAoB,EAAE;QACxG,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAA;QAEtF,MAAM,wBAAwB,GAAG,MAAA,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAW,gCAAgC,CAAC,mCAAI,EAAE,CAAA;QAC5G,MAAM,iBAAiB,GAAG,CAAC,GAAG,wBAAwB,EAAE,OAAO,CAAC,CAAA;QAEhE,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,gCAAgC,EAAE,iBAAiB,CAAC,CAAA;QAC9E,YAAY,CAAC,MAAM,CAAC,gCAAgC,EAAE,iBAAiB,CAAC,CAAA;QACxE,MAAM,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,CAAA;KAC5C;AACH,CAAC;AAjBD,kFAiBC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { VerifiablePresentation, VerifiableCredential } from '@credo-ts/core';
|
|
2
|
+
import type { W3CVerifiableCredential as SphereonW3cVerifiableCredential, W3CVerifiablePresentation as SphereonW3cVerifiablePresentation, CompactSdJwtVc as SphereonCompactSdJwtVc, WrappedVerifiablePresentation } from '@sphereon/ssi-types';
|
|
3
|
+
export declare function getSphereonVerifiableCredential(verifiableCredential: VerifiableCredential): SphereonW3cVerifiableCredential | SphereonCompactSdJwtVc;
|
|
4
|
+
export declare function getSphereonVerifiablePresentation(verifiablePresentation: VerifiablePresentation): SphereonW3cVerifiablePresentation | SphereonCompactSdJwtVc;
|
|
5
|
+
export declare function getVerifiablePresentationFromSphereonWrapped(wrappedVerifiablePresentation: WrappedVerifiablePresentation): VerifiablePresentation;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getVerifiablePresentationFromSphereonWrapped = exports.getSphereonVerifiablePresentation = exports.getSphereonVerifiableCredential = void 0;
|
|
4
|
+
const core_1 = require("@credo-ts/core");
|
|
5
|
+
function getSphereonVerifiableCredential(verifiableCredential) {
|
|
6
|
+
// encoded sd-jwt or jwt
|
|
7
|
+
if (typeof verifiableCredential === 'string') {
|
|
8
|
+
return verifiableCredential;
|
|
9
|
+
}
|
|
10
|
+
else if (verifiableCredential instanceof core_1.W3cJsonLdVerifiableCredential) {
|
|
11
|
+
return core_1.JsonTransformer.toJSON(verifiableCredential);
|
|
12
|
+
}
|
|
13
|
+
else if (verifiableCredential instanceof core_1.W3cJwtVerifiableCredential) {
|
|
14
|
+
return verifiableCredential.serializedJwt;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return verifiableCredential.compact;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.getSphereonVerifiableCredential = getSphereonVerifiableCredential;
|
|
21
|
+
function getSphereonVerifiablePresentation(verifiablePresentation) {
|
|
22
|
+
// encoded sd-jwt or jwt
|
|
23
|
+
if (typeof verifiablePresentation === 'string') {
|
|
24
|
+
return verifiablePresentation;
|
|
25
|
+
}
|
|
26
|
+
else if (verifiablePresentation instanceof core_1.W3cJsonLdVerifiablePresentation) {
|
|
27
|
+
return core_1.JsonTransformer.toJSON(verifiablePresentation);
|
|
28
|
+
}
|
|
29
|
+
else if (verifiablePresentation instanceof core_1.W3cJwtVerifiablePresentation) {
|
|
30
|
+
return verifiablePresentation.serializedJwt;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return verifiablePresentation.compact;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.getSphereonVerifiablePresentation = getSphereonVerifiablePresentation;
|
|
37
|
+
function getVerifiablePresentationFromSphereonWrapped(wrappedVerifiablePresentation) {
|
|
38
|
+
if (wrappedVerifiablePresentation.format === 'jwt_vp') {
|
|
39
|
+
if (typeof wrappedVerifiablePresentation.original !== 'string') {
|
|
40
|
+
throw new core_1.CredoError('Unable to transform JWT VP to W3C VP');
|
|
41
|
+
}
|
|
42
|
+
return core_1.W3cJwtVerifiablePresentation.fromSerializedJwt(wrappedVerifiablePresentation.original);
|
|
43
|
+
}
|
|
44
|
+
else if (wrappedVerifiablePresentation.format === 'ldp_vp') {
|
|
45
|
+
return core_1.JsonTransformer.fromJSON(wrappedVerifiablePresentation.original, core_1.W3cJsonLdVerifiablePresentation);
|
|
46
|
+
}
|
|
47
|
+
else if (wrappedVerifiablePresentation.format === 'vc+sd-jwt') {
|
|
48
|
+
// We use some custom logic here so we don't have to re-process the encoded SD-JWT
|
|
49
|
+
const [encodedHeader] = wrappedVerifiablePresentation.presentation.compactSdJwtVc.split('.');
|
|
50
|
+
const header = core_1.JsonEncoder.fromBase64(encodedHeader);
|
|
51
|
+
return {
|
|
52
|
+
compact: wrappedVerifiablePresentation.presentation.compactSdJwtVc,
|
|
53
|
+
header,
|
|
54
|
+
payload: wrappedVerifiablePresentation.presentation.signedPayload,
|
|
55
|
+
prettyClaims: wrappedVerifiablePresentation.presentation.decodedPayload,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
throw new core_1.CredoError(`Unsupported presentation format: ${wrappedVerifiablePresentation.format}`);
|
|
59
|
+
}
|
|
60
|
+
exports.getVerifiablePresentationFromSphereonWrapped = getVerifiablePresentationFromSphereonWrapped;
|
|
61
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/shared/transform.ts"],"names":[],"mappings":";;;AAQA,yCAQuB;AAEvB,SAAgB,+BAA+B,CAC7C,oBAA0C;IAE1C,wBAAwB;IACxB,IAAI,OAAO,oBAAoB,KAAK,QAAQ,EAAE;QAC5C,OAAO,oBAAoB,CAAA;KAC5B;SAAM,IAAI,oBAAoB,YAAY,oCAA6B,EAAE;QACxE,OAAO,sBAAe,CAAC,MAAM,CAAC,oBAAoB,CAAoC,CAAA;KACvF;SAAM,IAAI,oBAAoB,YAAY,iCAA0B,EAAE;QACrE,OAAO,oBAAoB,CAAC,aAAa,CAAA;KAC1C;SAAM;QACL,OAAO,oBAAoB,CAAC,OAAO,CAAA;KACpC;AACH,CAAC;AAbD,0EAaC;AAED,SAAgB,iCAAiC,CAC/C,sBAA8C;IAE9C,wBAAwB;IACxB,IAAI,OAAO,sBAAsB,KAAK,QAAQ,EAAE;QAC9C,OAAO,sBAAsB,CAAA;KAC9B;SAAM,IAAI,sBAAsB,YAAY,sCAA+B,EAAE;QAC5E,OAAO,sBAAe,CAAC,MAAM,CAAC,sBAAsB,CAAsC,CAAA;KAC3F;SAAM,IAAI,sBAAsB,YAAY,mCAA4B,EAAE;QACzE,OAAO,sBAAsB,CAAC,aAAa,CAAA;KAC5C;SAAM;QACL,OAAO,sBAAsB,CAAC,OAAO,CAAA;KACtC;AACH,CAAC;AAbD,8EAaC;AAED,SAAgB,4CAA4C,CAC1D,6BAA4D;IAE5D,IAAI,6BAA6B,CAAC,MAAM,KAAK,QAAQ,EAAE;QACrD,IAAI,OAAO,6BAA6B,CAAC,QAAQ,KAAK,QAAQ,EAAE;YAC9D,MAAM,IAAI,iBAAU,CAAC,sCAAsC,CAAC,CAAA;SAC7D;QAED,OAAO,mCAA4B,CAAC,iBAAiB,CAAC,6BAA6B,CAAC,QAAQ,CAAC,CAAA;KAC9F;SAAM,IAAI,6BAA6B,CAAC,MAAM,KAAK,QAAQ,EAAE;QAC5D,OAAO,sBAAe,CAAC,QAAQ,CAAC,6BAA6B,CAAC,QAAQ,EAAE,sCAA+B,CAAC,CAAA;KACzG;SAAM,IAAI,6BAA6B,CAAC,MAAM,KAAK,WAAW,EAAE;QAC/D,kFAAkF;QAClF,MAAM,CAAC,aAAa,CAAC,GAAG,6BAA6B,CAAC,YAAY,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC5F,MAAM,MAAM,GAAG,kBAAW,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;QACpD,OAAO;YACL,OAAO,EAAE,6BAA6B,CAAC,YAAY,CAAC,cAAc;YAClE,MAAM;YACN,OAAO,EAAE,6BAA6B,CAAC,YAAY,CAAC,aAAa;YACjE,YAAY,EAAE,6BAA6B,CAAC,YAAY,CAAC,cAAc;SACtD,CAAA;KACpB;IAED,MAAM,IAAI,iBAAU,CAAC,oCAAoC,6BAA6B,CAAC,MAAM,EAAE,CAAC,CAAA;AAClG,CAAC;AAxBD,oGAwBC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OpenId4VcJwtIssuer } from './models';
|
|
2
|
+
import type { AgentContext, JwaSignatureAlgorithm, Key } from '@credo-ts/core';
|
|
3
|
+
import type { DIDDocument, SuppliedSignature } from '@sphereon/did-auth-siop';
|
|
4
|
+
/**
|
|
5
|
+
* Returns the JWA Signature Algorithms that are supported by the wallet.
|
|
6
|
+
*
|
|
7
|
+
* This is an approximation based on the supported key types of the wallet.
|
|
8
|
+
* This is not 100% correct as a supporting a key type does not mean you support
|
|
9
|
+
* all the algorithms for that key type. However, this needs refactoring of the wallet
|
|
10
|
+
* that is planned for the 0.5.0 release.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getSupportedJwaSignatureAlgorithms(agentContext: AgentContext): JwaSignatureAlgorithm[];
|
|
13
|
+
export declare function getSphereonSuppliedSignatureFromJwtIssuer(agentContext: AgentContext, jwtIssuer: OpenId4VcJwtIssuer): Promise<SuppliedSignature>;
|
|
14
|
+
export declare function getSphereonDidResolver(agentContext: AgentContext): {
|
|
15
|
+
resolve: (didUrl: string) => Promise<{
|
|
16
|
+
didDocument: DIDDocument;
|
|
17
|
+
didResolutionMetadata: import("@credo-ts/core").DidResolutionMetadata;
|
|
18
|
+
didDocumentMetadata: import("did-resolver").DIDDocumentMetadata;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
export declare function getProofTypeFromKey(agentContext: AgentContext, key: Key): string;
|