@credo-ts/openid4vc 0.6.0-pr-2134-20241217213340 → 0.6.0-pr-2195-20250217170804
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/OpenId4VcHolderApi.d.ts +61 -11
- package/build/openid4vc-holder/OpenId4VcHolderApi.js +17 -19
- package/build/openid4vc-holder/OpenId4VcHolderApi.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VcHolderModule.js +1 -1
- package/build/openid4vc-holder/OpenId4VcHolderModule.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VciHolderService.d.ts +7 -8
- package/build/openid4vc-holder/OpenId4VciHolderService.js +60 -45
- package/build/openid4vc-holder/OpenId4VciHolderService.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.d.ts +3 -3
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js +1 -1
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js.map +1 -1
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.d.ts +59 -13
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js +232 -172
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js.map +1 -1
- package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.d.ts +18 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.d.ts +196 -46
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.js +8 -19
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js +3 -3
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.d.ts +13 -13
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js +19 -40
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerService.d.ts +198 -48
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js +45 -37
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts +8 -3
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.d.ts +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js +26 -12
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js.map +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js +19 -22
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js.map +1 -1
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js +11 -9
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.js +17 -6
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/authorizationServerMetadataEndpoint.js +1 -1
- package/build/openid4vc-issuer/router/authorizationServerMetadataEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/credentialEndpoint.js +11 -9
- package/build/openid4vc-issuer/router/credentialEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.js +7 -3
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/util/txCode.js +2 -3
- package/build/openid4vc-issuer/util/txCode.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.d.ts +21 -7
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js +499 -263
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.d.ts +23 -3
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.ts +3 -3
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js +11 -18
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js +3 -3
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js +11 -8
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.d.ts +23 -4
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js +25 -29
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js +4 -6
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js +11 -6
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.js +7 -5
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.js.map +1 -1
- package/build/openid4vc-verifier/router/authorizationEndpoint.js +5 -104
- package/build/openid4vc-verifier/router/authorizationEndpoint.js.map +1 -1
- package/build/shared/callbacks.d.ts +16 -5
- package/build/shared/callbacks.js +120 -24
- package/build/shared/callbacks.js.map +1 -1
- package/build/shared/issuerMetadataUtils.d.ts +102 -144
- package/build/shared/models/index.d.ts +10 -8
- package/build/shared/models/index.js +5 -5
- package/build/shared/models/index.js.map +1 -1
- package/build/shared/router/context.d.ts +2 -2
- package/build/shared/router/context.js +5 -5
- package/build/shared/router/context.js.map +1 -1
- package/build/shared/router/tenants.js +1 -2
- package/build/shared/router/tenants.js.map +1 -1
- package/build/shared/utils.d.ts +6 -6
- package/build/shared/utils.js +22 -61
- package/build/shared/utils.js.map +1 -1
- package/package.json +7 -6
- package/build/shared/transform.d.ts +0 -5
- package/build/shared/transform.js +0 -73
- package/build/shared/transform.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.configureCredentialEndpoint = configureCredentialEndpoint;
|
|
4
|
-
const oauth2_1 = require("@
|
|
5
|
-
const oid4vci_1 = require("@
|
|
4
|
+
const oauth2_1 = require("@openid4vc/oauth2");
|
|
5
|
+
const oid4vci_1 = require("@openid4vc/oid4vci");
|
|
6
6
|
const core_1 = require("@credo-ts/core");
|
|
7
7
|
const shared_1 = require("../../shared");
|
|
8
8
|
const router_1 = require("../../shared/router");
|
|
@@ -12,7 +12,6 @@ const OpenId4VcIssuerService_1 = require("../OpenId4VcIssuerService");
|
|
|
12
12
|
const repository_1 = require("../repository");
|
|
13
13
|
function configureCredentialEndpoint(router, config) {
|
|
14
14
|
router.post(config.credentialEndpointPath, async (request, response, next) => {
|
|
15
|
-
var _a, _b, _c;
|
|
16
15
|
const { agentContext, issuer } = (0, router_1.getRequestContext)(request);
|
|
17
16
|
const openId4VcIssuerService = agentContext.dependencyManager.resolve(OpenId4VcIssuerService_1.OpenId4VcIssuerService);
|
|
18
17
|
const issuerMetadata = await openId4VcIssuerService.getIssuerMetadata(agentContext, issuer, true);
|
|
@@ -82,7 +81,7 @@ function configureCredentialEndpoint(router, config) {
|
|
|
82
81
|
}));
|
|
83
82
|
}
|
|
84
83
|
// Verify the issuance session subject
|
|
85
|
-
if (
|
|
84
|
+
if (issuanceSession.authorization?.subject) {
|
|
86
85
|
if (issuanceSession.authorization.subject !== tokenPayload.sub) {
|
|
87
86
|
return (0, router_1.sendOauth2ErrorResponse)(response, next, agentContext.config.logger, new oauth2_1.Oauth2ServerErrorResponseError({
|
|
88
87
|
error: oauth2_1.Oauth2ErrorCodes.CredentialRequestDenied,
|
|
@@ -91,9 +90,9 @@ function configureCredentialEndpoint(router, config) {
|
|
|
91
90
|
}));
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
|
-
//
|
|
93
|
+
// Stateful session expired
|
|
95
94
|
else if (Date.now() >
|
|
96
|
-
(0, utils_1.addSecondsToDate)(issuanceSession.createdAt, config.
|
|
95
|
+
(0, utils_1.addSecondsToDate)(issuanceSession.createdAt, config.statefulCredentialOfferExpirationInSeconds).getTime()) {
|
|
97
96
|
issuanceSession.errorMessage = 'Credential offer has expired';
|
|
98
97
|
await openId4VcIssuerService.updateState(agentContext, issuanceSession, OpenId4VcIssuanceSessionState_1.OpenId4VcIssuanceSessionState.Error);
|
|
99
98
|
throw new oauth2_1.Oauth2ServerErrorResponseError({
|
|
@@ -103,7 +102,10 @@ function configureCredentialEndpoint(router, config) {
|
|
|
103
102
|
});
|
|
104
103
|
}
|
|
105
104
|
else {
|
|
106
|
-
issuanceSession.authorization =
|
|
105
|
+
issuanceSession.authorization = {
|
|
106
|
+
...issuanceSession.authorization,
|
|
107
|
+
subject: tokenPayload.sub,
|
|
108
|
+
};
|
|
107
109
|
await issuanceSessionRepository.update(agentContext, issuanceSession);
|
|
108
110
|
}
|
|
109
111
|
}
|
|
@@ -114,7 +116,7 @@ function configureCredentialEndpoint(router, config) {
|
|
|
114
116
|
// All credential configurations that match the request scope and credential request
|
|
115
117
|
// This is just so we don't create an issuance session that will fail immediately after
|
|
116
118
|
const credentialConfigurationsForToken = (0, oid4vci_1.getCredentialConfigurationsMatchingRequestFormat)({
|
|
117
|
-
credentialConfigurations: (0, shared_1.getCredentialConfigurationsSupportedForScopes)(issuerMetadata.credentialIssuer.credential_configurations_supported,
|
|
119
|
+
credentialConfigurations: (0, shared_1.getCredentialConfigurationsSupportedForScopes)(issuerMetadata.credentialIssuer.credential_configurations_supported, tokenPayload.scope?.split(' ') ?? []),
|
|
118
120
|
requestFormat: parsedCredentialRequest.format,
|
|
119
121
|
});
|
|
120
122
|
if (Object.keys(credentialConfigurationsForToken).length === 0) {
|
|
@@ -145,7 +147,7 @@ function configureCredentialEndpoint(router, config) {
|
|
|
145
147
|
return (0, router_1.sendOauth2ErrorResponse)(response, next, agentContext.config.logger, new oauth2_1.Oauth2ServerErrorResponseError({
|
|
146
148
|
error: oauth2_1.Oauth2ErrorCodes.CredentialRequestDenied,
|
|
147
149
|
}, {
|
|
148
|
-
internalMessage: `Access token without 'issuer_state' or 'pre-authorized_code' issued by external authorization server provided, but 'allowDynamicIssuanceSessions' is disabled. Either bind the access token to a
|
|
150
|
+
internalMessage: `Access token without 'issuer_state' or 'pre-authorized_code' issued by external authorization server provided, but 'allowDynamicIssuanceSessions' is disabled. Either bind the access token to a stateful credential offer, or enable 'allowDynamicIssuanceSessions'.`,
|
|
149
151
|
}));
|
|
150
152
|
}
|
|
151
153
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentialEndpoint.js","sourceRoot":"","sources":["../../../src/openid4vc-issuer/router/credentialEndpoint.ts"],"names":[],"mappings":";;AA2BA,kEA+OC;AArQD,
|
|
1
|
+
{"version":3,"file":"credentialEndpoint.js","sourceRoot":"","sources":["../../../src/openid4vc-issuer/router/credentialEndpoint.ts"],"names":[],"mappings":";;AA2BA,kEA+OC;AArQD,8CAK0B;AAC1B,gDAAqF;AACrF,yCAA6C;AAE7C,yCAA4E;AAC5E,gDAM4B;AAC5B,8CAAqD;AACrD,oFAAgF;AAChF,sEAAkE;AAClE,8CAAkG;AAElG,SAAgB,2BAA2B,CAAC,MAAc,EAAE,MAAmC;IAC7F,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,KAAK,EAAE,OAAiC,EAAE,QAAkB,EAAE,IAAI,EAAE,EAAE;QAC/G,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,CAAA;QAC3D,MAAM,sBAAsB,GAAG,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,+CAAsB,CAAC,CAAA;QAC7F,MAAM,cAAc,GAAG,MAAM,sBAAsB,CAAC,iBAAiB,CAAC,YAAY,EAAE,MAAM,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AAY,uCAA8B,EAAE,CAAC;gBACpD,OAAO,IAAA,gCAAuB,EAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;YACnF,CAAC;YACD,IAAI,KAAK,YAAY,wCAA+B,EAAE,CAAC;gBACrD,OAAO,IAAA,8BAAqB,EAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;YACjF,CAAC;YAED,OAAO,IAAA,uCAA8B,EAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QAC1F,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.configureIssuerMetadataEndpoint = configureIssuerMetadataEndpoint;
|
|
4
|
-
const oauth2_1 = require("@
|
|
4
|
+
const oauth2_1 = require("@openid4vc/oauth2");
|
|
5
5
|
const router_1 = require("../../shared/router");
|
|
6
6
|
const OpenId4VcIssuerService_1 = require("../OpenId4VcIssuerService");
|
|
7
7
|
function configureIssuerMetadataEndpoint(router) {
|
|
@@ -12,10 +12,14 @@ function configureIssuerMetadataEndpoint(router) {
|
|
|
12
12
|
const issuerMetadata = await openId4VcIssuerService.getIssuerMetadata(agentContext, issuer);
|
|
13
13
|
const vcIssuer = openId4VcIssuerService.getIssuer(agentContext);
|
|
14
14
|
const issuerAuthorizationServer = (0, oauth2_1.getAuthorizationServerMetadataFromList)(issuerMetadata.authorizationServers, issuerMetadata.credentialIssuer.credential_issuer);
|
|
15
|
-
const transformedMetadata =
|
|
15
|
+
const transformedMetadata = {
|
|
16
|
+
// Get the draft 11 metadata (it also contains drfat 14)
|
|
17
|
+
...vcIssuer.getCredentialIssuerMetadataDraft11(issuerMetadata.credentialIssuer),
|
|
16
18
|
// TOOD: these values should be removed, as they need to be hosted in the oauth-authorization-server
|
|
17
19
|
// metadata. For backwards compatiblity we will keep them in now.
|
|
18
|
-
token_endpoint: issuerAuthorizationServer.token_endpoint,
|
|
20
|
+
token_endpoint: issuerAuthorizationServer.token_endpoint,
|
|
21
|
+
dpop_signing_alg_values_supported: issuerAuthorizationServer.dpop_signing_alg_values_supported,
|
|
22
|
+
};
|
|
19
23
|
return (0, router_1.sendJsonResponse)(response, next, transformedMetadata);
|
|
20
24
|
}
|
|
21
25
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issuerMetadataEndpoint.js","sourceRoot":"","sources":["../../../src/openid4vc-issuer/router/issuerMetadataEndpoint.ts"],"names":[],"mappings":";;AASA,0EA8BC;AAnCD,
|
|
1
|
+
{"version":3,"file":"issuerMetadataEndpoint.js","sourceRoot":"","sources":["../../../src/openid4vc-issuer/router/issuerMetadataEndpoint.ts"],"names":[],"mappings":";;AASA,0EA8BC;AAnCD,8CAA0E;AAE1E,gDAAyG;AACzG,sEAAkE;AAElE,SAAgB,+BAA+B,CAAC,MAAc;IAC5D,MAAM,CAAC,GAAG,CACR,uCAAuC,EACvC,KAAK,EAAE,QAAkC,EAAE,QAAkB,EAAE,IAAI,EAAE,EAAE;QACrE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAA,0BAAiB,EAAC,QAAQ,CAAC,CAAA;QAC5D,IAAI,CAAC;YACH,MAAM,sBAAsB,GAAG,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,+CAAsB,CAAC,CAAA;YAC7F,MAAM,cAAc,GAAG,MAAM,sBAAsB,CAAC,iBAAiB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;YAC3F,MAAM,QAAQ,GAAG,sBAAsB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;YAC/D,MAAM,yBAAyB,GAAG,IAAA,+CAAsC,EACtE,cAAc,CAAC,oBAAoB,EACnC,cAAc,CAAC,gBAAgB,CAAC,iBAAiB,CAClD,CAAA;YAED,MAAM,mBAAmB,GAAG;gBAC1B,wDAAwD;gBACxD,GAAG,QAAQ,CAAC,kCAAkC,CAAC,cAAc,CAAC,gBAAgB,CAAC;gBAE/E,oGAAoG;gBACpG,iEAAiE;gBACjE,cAAc,EAAE,yBAAyB,CAAC,cAAc;gBACxD,iCAAiC,EAAE,yBAAyB,CAAC,iCAAiC;aAClD,CAAA;YAE9C,OAAO,IAAA,yBAAgB,EAAC,QAAQ,EAAE,IAAI,EAAE,mBAAmB,CAAC,CAAA;QAC9D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,IAAA,uCAA8B,EAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;QACtF,CAAC;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateTxCode = generateTxCode;
|
|
4
4
|
function generateTxCode(agentContext, txCode) {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const inputMode = (_b = txCode.input_mode) !== null && _b !== void 0 ? _b : 'numeric';
|
|
5
|
+
const length = txCode.length ?? 4;
|
|
6
|
+
const inputMode = txCode.input_mode ?? 'numeric';
|
|
8
7
|
const numbers = '0123456789';
|
|
9
8
|
const letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
10
9
|
const characters = inputMode === 'numeric' ? numbers : numbers + letters;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"txCode.js","sourceRoot":"","sources":["../../../src/openid4vc-issuer/util/txCode.ts"],"names":[],"mappings":";;AAGA,wCAeC;AAfD,SAAgB,cAAc,CAAC,YAA0B,EAAE,MAAwB
|
|
1
|
+
{"version":3,"file":"txCode.js","sourceRoot":"","sources":["../../../src/openid4vc-issuer/util/txCode.ts"],"names":[],"mappings":";;AAGA,wCAeC;AAfD,SAAgB,cAAc,CAAC,YAA0B,EAAE,MAAwB;IACjF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,CAAA;IACjC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,IAAI,SAAS,CAAA;IAEhD,MAAM,OAAO,GAAG,YAAY,CAAA;IAC5B,MAAM,OAAO,GAAG,sDAAsD,CAAA;IACtE,MAAM,UAAU,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,OAAO,CAAA;IACxE,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;IAE1D,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;IACrD,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { OpenId4VcSiopCreateAuthorizationRequestOptions, OpenId4VcSiopCreateAuthorizationRequestReturn, OpenId4VcSiopCreateVerifierOptions, OpenId4VcSiopVerifiedAuthorizationResponse, OpenId4VcSiopVerifyAuthorizationResponseOptions } from './OpenId4VcSiopVerifierServiceOptions';
|
|
2
|
-
import type { OpenId4VcVerificationSessionRecord } from './repository';
|
|
3
|
-
import type { OpenId4VcSiopAuthorizationResponsePayload } from '../shared';
|
|
4
1
|
import type { AgentContext, Query, QueryOptions } from '@credo-ts/core';
|
|
2
|
+
import { ParsedOpenid4vpAuthorizationResponse } from '@openid4vc/oid4vp';
|
|
3
|
+
import type { OpenId4VcSiopCreateAuthorizationRequestOptions, OpenId4VcSiopCreateAuthorizationRequestReturn, OpenId4VcSiopCreateVerifierOptions, OpenId4VcSiopVerifiedAuthorizationResponse, OpenId4VcSiopVerifyAuthorizationResponseOptions } from './OpenId4VcSiopVerifierServiceOptions';
|
|
4
|
+
import { OpenId4VcVerificationSessionRecord } from './repository';
|
|
5
5
|
import { Logger, W3cCredentialService } from '@credo-ts/core';
|
|
6
|
+
import { OpenId4VcSiopAuthorizationResponsePayload } from '../shared/index';
|
|
6
7
|
import { OpenId4VcVerifierModuleConfig } from './OpenId4VcVerifierModuleConfig';
|
|
7
8
|
import { OpenId4VcVerificationSessionRepository, OpenId4VcVerifierRecord, OpenId4VcVerifierRepository } from './repository';
|
|
8
9
|
/**
|
|
@@ -15,19 +16,29 @@ export declare class OpenId4VcSiopVerifierService {
|
|
|
15
16
|
private config;
|
|
16
17
|
private openId4VcVerificationSessionRepository;
|
|
17
18
|
constructor(logger: Logger, w3cCredentialService: W3cCredentialService, openId4VcVerifierRepository: OpenId4VcVerifierRepository, config: OpenId4VcVerifierModuleConfig, openId4VcVerificationSessionRepository: OpenId4VcVerificationSessionRepository);
|
|
19
|
+
private getOpenid4vpVerifier;
|
|
18
20
|
createAuthorizationRequest(agentContext: AgentContext, options: OpenId4VcSiopCreateAuthorizationRequestOptions & {
|
|
19
21
|
verifier: OpenId4VcVerifierRecord;
|
|
20
22
|
}): Promise<OpenId4VcSiopCreateAuthorizationRequestReturn>;
|
|
21
|
-
|
|
23
|
+
private getDcqlVerifiedResponse;
|
|
24
|
+
parseAuthorizationResponse(agentContext: AgentContext, options: {
|
|
25
|
+
verifierId: string;
|
|
26
|
+
responsePayload: Record<string, unknown>;
|
|
27
|
+
setResponseState?: boolean;
|
|
28
|
+
}): Promise<ParsedOpenid4vpAuthorizationResponse & {
|
|
22
29
|
verificationSession: OpenId4VcVerificationSessionRecord;
|
|
30
|
+
}>;
|
|
31
|
+
verifyAuthorizationResponse(agentContext: AgentContext, options: OpenId4VcSiopVerifyAuthorizationResponseOptions & {
|
|
32
|
+
verifierId: string;
|
|
23
33
|
jarmHeader?: {
|
|
24
34
|
apu?: string;
|
|
25
35
|
apv?: string;
|
|
26
36
|
};
|
|
37
|
+
origin?: string;
|
|
27
38
|
}): Promise<OpenId4VcSiopVerifiedAuthorizationResponse & {
|
|
28
39
|
verificationSession: OpenId4VcVerificationSessionRecord;
|
|
29
40
|
}>;
|
|
30
|
-
getVerifiedAuthorizationResponse(verificationSession: OpenId4VcVerificationSessionRecord): Promise<OpenId4VcSiopVerifiedAuthorizationResponse>;
|
|
41
|
+
getVerifiedAuthorizationResponse(agentContext: AgentContext, verificationSession: OpenId4VcVerificationSessionRecord): Promise<OpenId4VcSiopVerifiedAuthorizationResponse>;
|
|
31
42
|
/**
|
|
32
43
|
* Find the verification session associated with an authorization response. You can optionally provide a verifier id
|
|
33
44
|
* if the verifier that the response is associated with is already known.
|
|
@@ -50,6 +61,9 @@ export declare class OpenId4VcSiopVerifierService {
|
|
|
50
61
|
createVerifier(agentContext: AgentContext, options?: OpenId4VcSiopCreateVerifierOptions): Promise<OpenId4VcVerifierRecord>;
|
|
51
62
|
findVerificationSessionsByQuery(agentContext: AgentContext, query: Query<OpenId4VcVerificationSessionRecord>, queryOptions?: QueryOptions): Promise<OpenId4VcVerificationSessionRecord[]>;
|
|
52
63
|
getVerificationSessionById(agentContext: AgentContext, verificationSessionId: string): Promise<OpenId4VcVerificationSessionRecord>;
|
|
53
|
-
private
|
|
54
|
-
private
|
|
64
|
+
private getClientMetadata;
|
|
65
|
+
private getPresentationFromVpTokenParseResult;
|
|
66
|
+
private getTransactionDataMeta;
|
|
67
|
+
private decodePresentation;
|
|
68
|
+
private verifyPresentations;
|
|
55
69
|
}
|