@credo-ts/openid4vc 0.6.0-pr-2195-20250223181657 → 0.6.0-pr-2195-20250225234342
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 +31 -28
- package/build/openid4vc-holder/OpenId4VcHolderApi.js +6 -4
- 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 +3 -3
- package/build/openid4vc-holder/OpenId4VciHolderService.js +8 -8
- package/build/openid4vc-holder/OpenId4VciHolderService.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.d.ts +3 -3
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js +2 -2
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js.map +1 -1
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.d.ts +24 -30
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js +46 -135
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js.map +1 -1
- package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.d.ts +5 -10
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.d.ts +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerService.d.ts +5 -5
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js +7 -7
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.d.ts +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js.map +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js +2 -2
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js.map +1 -1
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js +1 -1
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.js +1 -1
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/credentialEndpoint.js +3 -3
- package/build/openid4vc-issuer/router/credentialEndpoint.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.d.ts +8 -8
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js +142 -101
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.d.ts +11 -17
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.ts +2 -2
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js +1 -4
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.d.ts +19 -10
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js +18 -6
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js.map +1 -1
- package/build/openid4vc-verifier/router/authorizationEndpoint.js.map +1 -1
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js +3 -16
- package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js.map +1 -1
- package/build/shared/callbacks.d.ts +6 -9
- package/build/shared/callbacks.js +50 -56
- package/build/shared/callbacks.js.map +1 -1
- package/build/shared/issuerMetadataUtils.d.ts +1 -1
- package/build/shared/models/OpenId4VcJwtIssuer.d.ts +2 -3
- package/build/shared/models/index.d.ts +4 -4
- package/build/shared/models/index.js.map +1 -1
- package/build/shared/router/context.d.ts +1 -1
- package/build/shared/router/context.js +1 -1
- package/build/shared/router/context.js.map +1 -1
- package/build/shared/utils.d.ts +3 -5
- package/build/shared/utils.js +23 -21
- package/build/shared/utils.js.map +1 -1
- package/package.json +6 -7
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.d.ts +0 -102
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js +0 -273
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js.map +0 -1
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.d.ts +0 -49
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js +0 -164
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenId4VcVerifierModule.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierModule.ts"],"names":[],"mappings":";;;AAKA,
|
|
1
|
+
{"version":3,"file":"OpenId4VcVerifierModule.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierModule.ts"],"names":[],"mappings":";;;AAKA,yCAA4C;AAC5C,8CAAmD;AAEnD,6CAA8F;AAE9F,iFAA6E;AAC7E,iEAA6D;AAC7D,mFAA+E;AAC/E,6CAA0D;AAC1D,qCAAyD;AACzD,wFAA6F;AAE7F;;GAEG;AACH,MAAa,uBAAuB;IAIlC,YAAmB,OAA6C;QAHhD,QAAG,GAAG,2CAAoB,CAAA;QAIxC,IAAI,CAAC,MAAM,GAAG,IAAI,6DAA6B,CAAC,OAAO,CAAC,CAAA;IAC1D,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,iBAAoC;QAClD,MAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,kBAAW,CAAC,CAAA;QAE1D,iCAAiC;QACjC,WAAW,CAAC,MAAM,CAAC,IAAI,CACrB,0LAA0L,CAC3L,CAAA;QAED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AE,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;AApHD,0DAoHC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpenId4VcSiopAuthorizationResponsePayload } from '../../shared/models';
|
|
1
|
+
import type { OpenId4VcSiopAuthorizationRequestPayload, OpenId4VcSiopAuthorizationResponsePayload } from '../../shared/models';
|
|
2
2
|
import type { OpenId4VcVerificationSessionState } from '../OpenId4VcVerificationSessionState';
|
|
3
3
|
import type { RecordTags, TagsBase } from '@credo-ts/core';
|
|
4
4
|
import { BaseRecord } from '@credo-ts/core';
|
|
@@ -7,8 +7,8 @@ export type DefaultOpenId4VcVerificationSessionRecordTags = {
|
|
|
7
7
|
verifierId: string;
|
|
8
8
|
state: OpenId4VcVerificationSessionState;
|
|
9
9
|
nonce: string;
|
|
10
|
-
payloadState
|
|
11
|
-
authorizationRequestUri
|
|
10
|
+
payloadState?: string;
|
|
11
|
+
authorizationRequestUri?: string;
|
|
12
12
|
};
|
|
13
13
|
export interface OpenId4VcVerificationSessionRecordProps {
|
|
14
14
|
id?: string;
|
|
@@ -17,8 +17,9 @@ export interface OpenId4VcVerificationSessionRecordProps {
|
|
|
17
17
|
verifierId: string;
|
|
18
18
|
state: OpenId4VcVerificationSessionState;
|
|
19
19
|
errorMessage?: string;
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
authorizationRequestJwt?: string;
|
|
21
|
+
authorizationRequestUri?: string;
|
|
22
|
+
authorizationRequestPayload?: OpenId4VcSiopAuthorizationRequestPayload;
|
|
22
23
|
authorizationResponsePayload?: OpenId4VcSiopAuthorizationResponsePayload;
|
|
23
24
|
/**
|
|
24
25
|
* Presentation during issuance session. This is used when issuance of a credential requires a presentation, and helps
|
|
@@ -44,12 +45,18 @@ export declare class OpenId4VcVerificationSessionRecord extends BaseRecord<Defau
|
|
|
44
45
|
/**
|
|
45
46
|
* The signed JWT containing the authorization request
|
|
46
47
|
*/
|
|
47
|
-
authorizationRequestJwt
|
|
48
|
+
authorizationRequestJwt?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Authorization request payload. This should be used only for unsigned requests
|
|
51
|
+
*/
|
|
52
|
+
authorizationRequestPayload?: OpenId4VcSiopAuthorizationRequestPayload;
|
|
48
53
|
/**
|
|
49
54
|
* URI of the authorization request. This is the url that can be used to
|
|
50
|
-
* retrieve the authorization request
|
|
55
|
+
* retrieve the authorization request.
|
|
56
|
+
*
|
|
57
|
+
* Not used for requests with response_mode of dc_api or dc_api.jwt
|
|
51
58
|
*/
|
|
52
|
-
authorizationRequestUri
|
|
59
|
+
authorizationRequestUri?: string;
|
|
53
60
|
/**
|
|
54
61
|
* The payload of the received authorization response
|
|
55
62
|
*/
|
|
@@ -60,12 +67,14 @@ export declare class OpenId4VcVerificationSessionRecord extends BaseRecord<Defau
|
|
|
60
67
|
*/
|
|
61
68
|
presentationDuringIssuanceSession?: string;
|
|
62
69
|
constructor(props: OpenId4VcVerificationSessionRecordProps);
|
|
70
|
+
get request(): string | OpenId4VcSiopAuthorizationRequestPayload;
|
|
71
|
+
get requestPayload(): OpenId4VcSiopAuthorizationRequestPayload;
|
|
63
72
|
assertState(expectedStates: OpenId4VcVerificationSessionState | OpenId4VcVerificationSessionState[]): void;
|
|
64
73
|
getTags(): {
|
|
65
74
|
verifierId: string;
|
|
66
75
|
state: OpenId4VcVerificationSessionState;
|
|
67
76
|
nonce: string;
|
|
68
|
-
payloadState: string;
|
|
69
|
-
authorizationRequestUri: string;
|
|
77
|
+
payloadState: string | undefined;
|
|
78
|
+
authorizationRequestUri: string | undefined;
|
|
70
79
|
};
|
|
71
80
|
}
|
|
@@ -13,12 +13,27 @@ class OpenId4VcVerificationSessionRecord extends core_1.BaseRecord {
|
|
|
13
13
|
this.verifierId = props.verifierId;
|
|
14
14
|
this.state = props.state;
|
|
15
15
|
this.errorMessage = props.errorMessage;
|
|
16
|
+
this.authorizationRequestPayload = props.authorizationRequestPayload;
|
|
16
17
|
this.authorizationRequestJwt = props.authorizationRequestJwt;
|
|
17
18
|
this.authorizationRequestUri = props.authorizationRequestUri;
|
|
18
19
|
this.authorizationResponsePayload = props.authorizationResponsePayload;
|
|
19
20
|
this.presentationDuringIssuanceSession = props.presentationDuringIssuanceSession;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
23
|
+
get request() {
|
|
24
|
+
if (this.authorizationRequestJwt)
|
|
25
|
+
return this.authorizationRequestJwt;
|
|
26
|
+
if (this.authorizationRequestPayload)
|
|
27
|
+
return this.authorizationRequestPayload;
|
|
28
|
+
throw new core_1.CredoError('Unable to extract authorization payload from openid4vc session record');
|
|
29
|
+
}
|
|
30
|
+
get requestPayload() {
|
|
31
|
+
if (this.authorizationRequestJwt)
|
|
32
|
+
return core_1.Jwt.fromSerializedJwt(this.authorizationRequestJwt).payload.toJson();
|
|
33
|
+
if (this.authorizationRequestPayload)
|
|
34
|
+
return this.authorizationRequestPayload;
|
|
35
|
+
throw new core_1.CredoError('Unable to extract authorization payload from openid4vc session record');
|
|
36
|
+
}
|
|
22
37
|
assertState(expectedStates) {
|
|
23
38
|
if (!Array.isArray(expectedStates)) {
|
|
24
39
|
expectedStates = [expectedStates];
|
|
@@ -28,19 +43,16 @@ class OpenId4VcVerificationSessionRecord extends core_1.BaseRecord {
|
|
|
28
43
|
}
|
|
29
44
|
}
|
|
30
45
|
getTags() {
|
|
31
|
-
const
|
|
32
|
-
const nonce =
|
|
46
|
+
const request = this.requestPayload;
|
|
47
|
+
const nonce = request.nonce;
|
|
33
48
|
if (!nonce || typeof nonce !== 'string')
|
|
34
49
|
throw new core_1.CredoError('Expected nonce in authorization request payload');
|
|
35
|
-
const payloadState =
|
|
36
|
-
if (!payloadState || typeof payloadState !== 'string')
|
|
37
|
-
throw new core_1.CredoError('Expected state in authorization request payload');
|
|
50
|
+
const payloadState = 'state' in request ? request.state : undefined;
|
|
38
51
|
return {
|
|
39
52
|
...this._tags,
|
|
40
53
|
verifierId: this.verifierId,
|
|
41
54
|
state: this.state,
|
|
42
55
|
nonce,
|
|
43
|
-
// FIXME: how do we call this property so it doesn't conflict with the record state?
|
|
44
56
|
payloadState,
|
|
45
57
|
authorizationRequestUri: this.authorizationRequestUri,
|
|
46
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenId4VcVerificationSessionRecord.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"OpenId4VcVerificationSessionRecord.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.ts"],"names":[],"mappings":";;;AAOA,yCAAmE;AAkCnE,MAAa,kCAAmC,SAAQ,iBAAyD;IAgD/G,YAAmB,KAA8C;QAC/D,KAAK,EAAE,CAAA;QA/CO,SAAI,GAAG,kCAAkC,CAAC,IAAI,CAAA;QAiD5D,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,IAAI,YAAK,CAAC,IAAI,EAAE,CAAA;YAClC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAA;YAC9C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE,CAAA;YAE7B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAA;YAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;YACxB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AC,CAAA;AACJ,CAAC"}
|
|
@@ -5,9 +5,7 @@ const core_1 = require("@credo-ts/core");
|
|
|
5
5
|
const router_1 = require("../../shared/router");
|
|
6
6
|
const OpenId4VcSiopVerifierService_1 = require("../OpenId4VcSiopVerifierService");
|
|
7
7
|
const OpenId4VcVerificationSessionState_1 = require("../OpenId4VcVerificationSessionState");
|
|
8
|
-
const OpenId4VcVerifierEvents_1 = require("../OpenId4VcVerifierEvents");
|
|
9
8
|
const OpenId4VcVerifierModuleConfig_1 = require("../OpenId4VcVerifierModuleConfig");
|
|
10
|
-
const repository_1 = require("../repository");
|
|
11
9
|
function configureAuthorizationRequestEndpoint(router, config) {
|
|
12
10
|
router.get((0, core_1.joinUriParts)(config.endpointPath, [':authorizationRequestId']), async (request, response, next) => {
|
|
13
11
|
const { agentContext, verifier } = (0, router_1.getRequestContext)(request);
|
|
@@ -16,7 +14,6 @@ function configureAuthorizationRequestEndpoint(router, config) {
|
|
|
16
14
|
}
|
|
17
15
|
try {
|
|
18
16
|
const verifierService = agentContext.dependencyManager.resolve(OpenId4VcSiopVerifierService_1.OpenId4VcSiopVerifierService);
|
|
19
|
-
const verificationSessionRepository = agentContext.dependencyManager.resolve(repository_1.OpenId4VcVerificationSessionRepository);
|
|
20
17
|
const verifierConfig = agentContext.dependencyManager.resolve(OpenId4VcVerifierModuleConfig_1.OpenId4VcVerifierModuleConfig);
|
|
21
18
|
// We always use shortened URIs currently
|
|
22
19
|
const fullAuthorizationRequestUri = (0, core_1.joinUriParts)(verifierConfig.baseUrl, [
|
|
@@ -28,7 +25,8 @@ function configureAuthorizationRequestEndpoint(router, config) {
|
|
|
28
25
|
verifierId: verifier.verifierId,
|
|
29
26
|
authorizationRequestUri: fullAuthorizationRequestUri,
|
|
30
27
|
});
|
|
31
|
-
|
|
28
|
+
// Not all requets are signed, and those are not fetcheable
|
|
29
|
+
if (!verificationSession || !verificationSession.authorizationRequestJwt) {
|
|
32
30
|
return (0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 404, 'not_found', 'Authorization request not found');
|
|
33
31
|
}
|
|
34
32
|
if (![
|
|
@@ -39,18 +37,7 @@ function configureAuthorizationRequestEndpoint(router, config) {
|
|
|
39
37
|
}
|
|
40
38
|
// It's okay to retrieve the offer multiple times. So we only update the state if it's not already retrieved
|
|
41
39
|
if (verificationSession.state !== OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestUriRetrieved) {
|
|
42
|
-
|
|
43
|
-
verificationSession.state = OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestUriRetrieved;
|
|
44
|
-
await verificationSessionRepository.update(agentContext, verificationSession);
|
|
45
|
-
agentContext.dependencyManager
|
|
46
|
-
.resolve(core_1.EventEmitter)
|
|
47
|
-
.emit(agentContext, {
|
|
48
|
-
type: OpenId4VcVerifierEvents_1.OpenId4VcVerifierEvents.VerificationSessionStateChanged,
|
|
49
|
-
payload: {
|
|
50
|
-
verificationSession: verificationSession.clone(),
|
|
51
|
-
previousState,
|
|
52
|
-
},
|
|
53
|
-
});
|
|
40
|
+
await verifierService.updateState(agentContext, verificationSession, OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestUriRetrieved);
|
|
54
41
|
}
|
|
55
42
|
response.type('application/oauth-authz-req+jwt').status(200).send(verificationSession.authorizationRequestJwt);
|
|
56
43
|
next();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorizationRequestEndpoint.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/router/authorizationRequestEndpoint.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"authorizationRequestEndpoint.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/router/authorizationRequestEndpoint.ts"],"names":[],"mappings":";;AAoBA,sFAgFC;AAjGD,yCAA6C;AAE7C,gDAA0E;AAC1E,kFAA8E;AAC9E,4FAAwF;AACxF,oFAAgF;AAYhF,SAAgB,qCAAqC,CACnD,MAAc,EACd,MAAuD;IA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AAY,CAAC,MAAM,CAAC,MAAM,EAC1B,GAAG,EACH,WAAW,EACX,iCAAiC,CAClC,CAAA;YACH,CAAC;YAED,IACE,CAAC;gBACC,qEAAiC,CAAC,cAAc;gBAChD,qEAAiC,CAAC,mBAAmB;aACtD,CAAC,QAAQ,CAAC,mBAAmB,CAAC,KAAK,CAAC,EACrC,CAAC;gBACD,OAAO,IAAA,0BAAiB,EACtB,QAAQ,EACR,IAAI,EACJ,YAAY,CAAC,MAAM,CAAC,MAAM,EAC1B,GAAG,EACH,iBAAiB,EACjB,yCAAyC,CAC1C,CAAA;YACH,CAAC;YAED,4GAA4G;YAC5G,IAAI,mBAAmB,CAAC,KAAK,KAAK,qEAAiC,CAAC,mBAAmB,EAAE,CAAC;gBACxF,MAAM,eAAe,CAAC,WAAW,CAC/B,YAAY,EACZ,mBAAmB,EACnB,qEAAiC,CAAC,mBAAmB,CACtD,CAAA;YACH,CAAC;YAED,QAAQ,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAA;YAC9G,IAAI,EAAE,CAAA;QACR,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAA,0BAAiB,EAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAA;QACrG,CAAC;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { ClientAuthenticationCallback, SignJwtCallback, VerifyJwtCallback } from '@openid4vc/oauth2';
|
|
2
|
-
import type { AgentContext } from '@credo-ts/core';
|
|
3
1
|
import type { OpenId4VcIssuerRecord } from '../openid4vc-issuer/repository';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
2
|
+
import type { AgentContext } from '@credo-ts/core';
|
|
3
|
+
import type { ClientAuthenticationCallback, SignJwtCallback, VerifyJwtCallback, DecryptJweCallback, EncryptJweCallback } from '@openid4vc/oauth2';
|
|
4
|
+
export declare function getOid4vcJwtVerifyCallback(agentContext: AgentContext, trustedCertificates?: string[]): VerifyJwtCallback;
|
|
5
|
+
export declare function getOid4vcEncryptJweCallback(agentContext: AgentContext): EncryptJweCallback;
|
|
6
|
+
export declare function getOid4vcDecryptJweCallback(agentContext: AgentContext): DecryptJweCallback;
|
|
7
|
+
export declare function getOid4vcJwtSignCallback(agentContext: AgentContext): SignJwtCallback;
|
|
9
8
|
export declare function getOid4vcCallbacks(agentContext: AgentContext, trustedCertificates?: string[]): {
|
|
10
9
|
hash: (data: Uint8Array, alg: import("@openid4vc/oauth2").HashAlgorithm) => Uint8Array;
|
|
11
10
|
generateRandom: (length: number) => Uint8Array;
|
|
@@ -15,8 +14,6 @@ export declare function getOid4vcCallbacks(agentContext: AgentContext, trustedCe
|
|
|
15
14
|
fetch: typeof fetch;
|
|
16
15
|
encryptJwe: EncryptJweCallback;
|
|
17
16
|
decryptJwe: DecryptJweCallback;
|
|
18
|
-
};
|
|
19
|
-
export declare function getOid4vpX509Callbacks(agentContext: AgentContext): {
|
|
20
17
|
getX509CertificateMetadata: (certificate: string) => {
|
|
21
18
|
sanDnsNames: string[];
|
|
22
19
|
sanUriNames: string[];
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
3
|
+
exports.getOid4vcJwtVerifyCallback = getOid4vcJwtVerifyCallback;
|
|
4
|
+
exports.getOid4vcEncryptJweCallback = getOid4vcEncryptJweCallback;
|
|
5
|
+
exports.getOid4vcDecryptJweCallback = getOid4vcDecryptJweCallback;
|
|
6
|
+
exports.getOid4vcJwtSignCallback = getOid4vcJwtSignCallback;
|
|
7
7
|
exports.getOid4vcCallbacks = getOid4vcCallbacks;
|
|
8
|
-
exports.getOid4vpX509Callbacks = getOid4vpX509Callbacks;
|
|
9
8
|
exports.dynamicOid4vciClientAuthentication = dynamicOid4vciClientAuthentication;
|
|
10
9
|
const core_1 = require("@credo-ts/core");
|
|
11
10
|
const oauth2_1 = require("@openid4vc/oauth2");
|
|
12
|
-
const core_2 = require("@credo-ts/core");
|
|
13
11
|
const utils_1 = require("./utils");
|
|
14
|
-
function
|
|
15
|
-
const jwsService = agentContext.dependencyManager.resolve(
|
|
12
|
+
function getOid4vcJwtVerifyCallback(agentContext, trustedCertificates) {
|
|
13
|
+
const jwsService = agentContext.dependencyManager.resolve(core_1.JwsService);
|
|
16
14
|
return async (signer, { compact }) => {
|
|
17
15
|
const { isValid, signerKeys } = await jwsService.verifyJws(agentContext, {
|
|
18
16
|
jws: compact,
|
|
@@ -20,63 +18,63 @@ function getOid4vciJwtVerifyCallback(agentContext, trustedCertificates) {
|
|
|
20
18
|
// Only handles kid as did resolution. JWK is handled by jws service
|
|
21
19
|
jwkResolver: async () => {
|
|
22
20
|
if (signer.method === 'jwk') {
|
|
23
|
-
return (0,
|
|
21
|
+
return (0, core_1.getJwkFromJson)(signer.publicJwk);
|
|
24
22
|
}
|
|
25
23
|
else if (signer.method === 'did') {
|
|
26
24
|
const key = await (0, utils_1.getKeyFromDid)(agentContext, signer.didUrl);
|
|
27
|
-
return (0,
|
|
25
|
+
return (0, core_1.getJwkFromKey)(key);
|
|
28
26
|
}
|
|
29
|
-
throw new
|
|
27
|
+
throw new core_1.CredoError(`Unexpected call to jwk resolver for signer method ${signer.method}`);
|
|
30
28
|
},
|
|
31
29
|
});
|
|
32
30
|
if (!isValid) {
|
|
33
31
|
return { verified: false, signerJwk: undefined };
|
|
34
32
|
}
|
|
35
33
|
const signerKey = signerKeys[0];
|
|
36
|
-
const signerJwk = (0,
|
|
34
|
+
const signerJwk = (0, core_1.getJwkFromKey)(signerKey).toJson();
|
|
37
35
|
if (signer.method === 'did') {
|
|
38
36
|
signerJwk.kid = signer.didUrl;
|
|
39
37
|
}
|
|
40
38
|
return { verified: true, signerJwk };
|
|
41
39
|
};
|
|
42
40
|
}
|
|
43
|
-
function
|
|
44
|
-
return async (
|
|
45
|
-
if (
|
|
46
|
-
throw new
|
|
41
|
+
function getOid4vcEncryptJweCallback(agentContext) {
|
|
42
|
+
return async (jweEncryptor, compact) => {
|
|
43
|
+
if (jweEncryptor.method !== 'jwk') {
|
|
44
|
+
throw new core_1.CredoError(`Jwt encryption method '${jweEncryptor.method}' is not supported for jwt signer. Only 'jwk' is supported.`);
|
|
47
45
|
}
|
|
48
|
-
const jwk = (0,
|
|
46
|
+
const jwk = (0, core_1.getJwkFromJson)(jweEncryptor.publicJwk);
|
|
49
47
|
const key = jwk.key;
|
|
50
|
-
if (
|
|
51
|
-
throw new
|
|
48
|
+
if (jweEncryptor.alg !== 'ECDH-ES') {
|
|
49
|
+
throw new core_1.CredoError("Only 'ECDH-ES' is supported as 'alg' value for JARM response encryption");
|
|
52
50
|
}
|
|
53
|
-
if (
|
|
54
|
-
throw new
|
|
51
|
+
if (jweEncryptor.enc !== 'A256GCM' && jweEncryptor.enc !== 'A128GCM' && jweEncryptor.enc !== 'A128CBC-HS256') {
|
|
52
|
+
throw new core_1.CredoError("Only 'A256GCM', 'A128GCM', and 'A128CBC-HS256' is supported as 'enc' value for JARM response encryption");
|
|
55
53
|
}
|
|
56
|
-
if (key.keyType !==
|
|
57
|
-
throw new
|
|
54
|
+
if (key.keyType !== core_1.KeyType.P256) {
|
|
55
|
+
throw new core_1.CredoError(`Only '${core_1.KeyType.P256}' key type is supported for JARM response encryption`);
|
|
58
56
|
}
|
|
59
57
|
if (!agentContext.wallet.directEncryptCompactJweEcdhEs) {
|
|
60
|
-
throw new
|
|
58
|
+
throw new core_1.CredoError('Cannot decrypt Jarm Response, wallet does not support directEncryptCompactJweEcdhEs. You need to upgrade your wallet implementation.');
|
|
61
59
|
}
|
|
62
60
|
const jwe = await agentContext.wallet.directEncryptCompactJweEcdhEs({
|
|
63
61
|
data: core_1.Buffer.from(compact),
|
|
64
62
|
recipientKey: key,
|
|
65
|
-
header: { kid:
|
|
66
|
-
encryptionAlgorithm:
|
|
67
|
-
apu:
|
|
68
|
-
apv:
|
|
63
|
+
header: { kid: jweEncryptor.publicJwk.kid },
|
|
64
|
+
encryptionAlgorithm: jweEncryptor.enc,
|
|
65
|
+
apu: jweEncryptor.apu ? core_1.TypedArrayEncoder.toBase64URL(core_1.TypedArrayEncoder.fromString(jweEncryptor.apu)) : undefined,
|
|
66
|
+
apv: jweEncryptor.apv ? core_1.TypedArrayEncoder.toBase64URL(core_1.TypedArrayEncoder.fromString(jweEncryptor.apv)) : undefined,
|
|
69
67
|
});
|
|
70
|
-
return { encryptionJwk:
|
|
68
|
+
return { encryptionJwk: jweEncryptor.publicJwk, jwe };
|
|
71
69
|
};
|
|
72
70
|
}
|
|
73
|
-
function
|
|
71
|
+
function getOid4vcDecryptJweCallback(agentContext) {
|
|
74
72
|
return async (jwe, options) => {
|
|
75
73
|
const [header] = jwe.split('.');
|
|
76
|
-
const decodedHeader =
|
|
74
|
+
const decodedHeader = core_1.JsonEncoder.fromBase64(header);
|
|
77
75
|
const key = core_1.Key.fromFingerprint(options?.jwk.kid ?? decodedHeader.kid);
|
|
78
76
|
if (!agentContext.wallet.directDecryptCompactJweEcdhEs) {
|
|
79
|
-
throw new
|
|
77
|
+
throw new core_1.CredoError('Cannot decrypt Jarm Response, wallet does not support directDecryptCompactJweEcdhEs');
|
|
80
78
|
}
|
|
81
79
|
let decryptedPayload;
|
|
82
80
|
try {
|
|
@@ -93,59 +91,55 @@ function getOid4vciDecryptJweCallback(agentContext) {
|
|
|
93
91
|
}
|
|
94
92
|
return {
|
|
95
93
|
decrypted: true,
|
|
96
|
-
decryptionJwk: (0,
|
|
94
|
+
decryptionJwk: (0, core_1.getJwkFromKey)(key).toJson(),
|
|
97
95
|
payload: decryptedPayload,
|
|
98
96
|
header: decodedHeader,
|
|
99
97
|
};
|
|
100
98
|
};
|
|
101
99
|
}
|
|
102
|
-
function
|
|
103
|
-
const jwsService = agentContext.dependencyManager.resolve(
|
|
100
|
+
function getOid4vcJwtSignCallback(agentContext) {
|
|
101
|
+
const jwsService = agentContext.dependencyManager.resolve(core_1.JwsService);
|
|
104
102
|
return async (signer, { payload, header }) => {
|
|
105
103
|
if (signer.method === 'custom' || signer.method === 'trustChain') {
|
|
106
|
-
throw new
|
|
104
|
+
throw new core_1.CredoError(`Jwt signer method 'custom' and 'x5c' are not supported for jwt signer.`);
|
|
107
105
|
}
|
|
108
106
|
if (signer.method === 'x5c') {
|
|
109
|
-
const leafCertificate =
|
|
107
|
+
const leafCertificate = core_1.X509Service.getLeafCertificate(agentContext, { certificateChain: signer.x5c });
|
|
110
108
|
const jws = await jwsService.createJwsCompact(agentContext, {
|
|
111
109
|
protectedHeaderOptions: { ...header, alg: signer.alg, jwk: undefined },
|
|
112
|
-
payload:
|
|
110
|
+
payload: core_1.JwtPayload.fromJson(payload),
|
|
113
111
|
key: leafCertificate.publicKey,
|
|
114
112
|
});
|
|
115
|
-
return { jwt: jws, signerJwk: (0,
|
|
113
|
+
return { jwt: jws, signerJwk: (0, core_1.getJwkFromKey)(leafCertificate.publicKey).toJson() };
|
|
116
114
|
}
|
|
117
|
-
const key = signer.method === 'did' ? await (0, utils_1.getKeyFromDid)(agentContext, signer.didUrl) : (0,
|
|
118
|
-
const jwk = (0,
|
|
115
|
+
const key = signer.method === 'did' ? await (0, utils_1.getKeyFromDid)(agentContext, signer.didUrl) : (0, core_1.getJwkFromJson)(signer.publicJwk).key;
|
|
116
|
+
const jwk = (0, core_1.getJwkFromKey)(key);
|
|
119
117
|
if (!jwk.supportsSignatureAlgorithm(signer.alg)) {
|
|
120
|
-
throw new
|
|
118
|
+
throw new core_1.CredoError(`key type '${jwk.keyType}', does not support the JWS signature alg '${signer.alg}'`);
|
|
121
119
|
}
|
|
122
120
|
const jwt = await jwsService.createJwsCompact(agentContext, {
|
|
123
121
|
protectedHeaderOptions: {
|
|
124
122
|
...header,
|
|
125
|
-
jwk: header.jwk ? (0,
|
|
123
|
+
jwk: header.jwk ? (0, core_1.getJwkFromJson)(header.jwk) : undefined,
|
|
126
124
|
},
|
|
127
|
-
payload:
|
|
125
|
+
payload: core_1.JsonEncoder.toBuffer(payload),
|
|
128
126
|
key,
|
|
129
127
|
});
|
|
130
|
-
return { jwt, signerJwk: (0,
|
|
128
|
+
return { jwt, signerJwk: (0, core_1.getJwkFromKey)(key).toJson() };
|
|
131
129
|
};
|
|
132
130
|
}
|
|
133
131
|
function getOid4vcCallbacks(agentContext, trustedCertificates) {
|
|
134
132
|
return {
|
|
135
|
-
hash: (data, alg) =>
|
|
133
|
+
hash: (data, alg) => core_1.Hasher.hash(data, alg.toLowerCase()),
|
|
136
134
|
generateRandom: (length) => agentContext.wallet.getRandomValues(length),
|
|
137
|
-
signJwt:
|
|
135
|
+
signJwt: getOid4vcJwtSignCallback(agentContext),
|
|
138
136
|
clientAuthentication: (0, oauth2_1.clientAuthenticationNone)(),
|
|
139
|
-
verifyJwt:
|
|
137
|
+
verifyJwt: getOid4vcJwtVerifyCallback(agentContext, trustedCertificates),
|
|
140
138
|
fetch: agentContext.config.agentDependencies.fetch,
|
|
141
|
-
encryptJwe:
|
|
142
|
-
decryptJwe:
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
function getOid4vpX509Callbacks(agentContext) {
|
|
146
|
-
return {
|
|
139
|
+
encryptJwe: getOid4vcEncryptJweCallback(agentContext),
|
|
140
|
+
decryptJwe: getOid4vcDecryptJweCallback(agentContext),
|
|
147
141
|
getX509CertificateMetadata: (certificate) => {
|
|
148
|
-
const leafCertificate =
|
|
142
|
+
const leafCertificate = core_1.X509Service.getLeafCertificate(agentContext, { certificateChain: [certificate] });
|
|
149
143
|
return {
|
|
150
144
|
sanDnsNames: leafCertificate.sanDnsNames,
|
|
151
145
|
sanUriNames: leafCertificate.sanUriNames,
|
|
@@ -166,7 +160,7 @@ function dynamicOid4vciClientAuthentication(agentContext, issuerRecord) {
|
|
|
166
160
|
return;
|
|
167
161
|
}
|
|
168
162
|
if (!authorizationServer.clientAuthentication) {
|
|
169
|
-
throw new
|
|
163
|
+
throw new core_1.CredoError(`Unable to authenticate to authorization server '${authorizationServer.issuer}' for issuer '${issuerRecord.issuerId}' for request to '${callbackOptions.url}'. Make sure to configure a 'clientId' and 'clientSecret' for the authorization server on the issuer record.`);
|
|
170
164
|
}
|
|
171
165
|
return (0, oauth2_1.clientAuthenticationDynamic)({
|
|
172
166
|
clientId: authorizationServer.clientAuthentication.clientId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callbacks.js","sourceRoot":"","sources":["../../src/shared/callbacks.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"callbacks.js","sourceRoot":"","sources":["../../src/shared/callbacks.ts"],"names":[],"mappings":";;AA6BA,gEAmCC;AAED,kEA0CC;AAED,kEA+BC;AAED,4DAuCC;AAED,gDAkBC;AAMD,gFA4BC;AAjOD,yCAauB;AACvB,8CAAyF;AAEzF,mCAAuC;AAEvC,SAAgB,0BAA0B,CACxC,YAA0B,EAC1B,mBAA8B;IAE9B,MAAM,UAAU,GAAG,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,iBAAU,CAAC,CAAA;IAErE,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACnC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,YAAY,EAAE;YACvE,GAAG,EAAE,OAAO;YACZ,mBAAmB;YACnB,oEAAoE;YACpE,WAAW,EAAE,KAAK,IAAI,EAAE;gBACtB,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;oBAC5B,OAAO,IAAA,qBAAc,EAAC,MAAM,CAAC,SAAS,CAA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AC,EAAE,CAAC,CAAA;YACzG,OAAO;gBACL,WAAW,EAAE,eAAe,CAAC,WAAW;gBACxC,WAAW,EAAE,eAAe,CAAC,WAAW;aACzC,CAAA;QACH,CAAC;KACiC,CAAA;AACtC,CAAC;AAED;;;GAGG;AACH,SAAgB,kCAAkC,CAChD,YAA0B,EAC1B,YAAmC;IAEnC,OAAO,CAAC,eAAe,EAAE,EAAE;QACzB,MAAM,mBAAmB,GAAG,YAAY,CAAC,0BAA0B,EAAE,IAAI,CACvE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,eAAe,CAAC,yBAAyB,CAAC,MAAM,CACrE,CAAA;QAED,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACzB,qEAAqE;YACrE,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAC9B,iCAAiC,eAAe,CAAC,yBAAyB,CAAC,MAAM,iBAAiB,YAAY,CAAC,QAAQ,qBAAqB,eAAe,CAAC,GAAG,GAAG,CACnK,CAAA;YACD,OAAM;QACR,CAAC;QAED,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,CAAC;YAC9C,MAAM,IAAI,iBAAU,CAClB,mDAAmD,mBAAmB,CAAC,MAAM,iBAAiB,YAAY,CAAC,QAAQ,qBAAqB,eAAe,CAAC,GAAG,8GAA8G,CAC1Q,CAAA;QACH,CAAC;QAED,OAAO,IAAA,oCAA2B,EAAC;YACjC,QAAQ,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,QAAQ;YAC3D,YAAY,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,YAAY;SACpE,CAAC,CAAC,eAAe,CAAC,CAAA;IACrB,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OpenId4VciCredentialConfigurationsSupported, OpenId4VciCredentialConfigurationsSupportedWithFormats } from './models';
|
|
2
|
-
import { type CredentialConfigurationsSupported } from '@openid4vc/
|
|
2
|
+
import { type CredentialConfigurationsSupported } from '@openid4vc/openid4vci';
|
|
3
3
|
/**
|
|
4
4
|
* Returns all entries from the credential offer with the associated metadata resolved.
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Jwk } from '@credo-ts/core';
|
|
2
|
-
interface OpenId4VcJwtIssuerDid {
|
|
2
|
+
export interface OpenId4VcJwtIssuerDid {
|
|
3
3
|
method: 'did';
|
|
4
4
|
didUrl: string;
|
|
5
5
|
}
|
|
@@ -20,9 +20,8 @@ export interface OpenId4VcIssuerX5c {
|
|
|
20
20
|
*/
|
|
21
21
|
issuer: string;
|
|
22
22
|
}
|
|
23
|
-
interface OpenId4VcJwtIssuerJwk {
|
|
23
|
+
export interface OpenId4VcJwtIssuerJwk {
|
|
24
24
|
method: 'jwk';
|
|
25
25
|
jwk: Jwk;
|
|
26
26
|
}
|
|
27
27
|
export type OpenId4VcJwtIssuer = OpenId4VcJwtIssuerDid | OpenId4VcIssuerX5c | OpenId4VcJwtIssuerJwk;
|
|
28
|
-
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AccessTokenResponse } from '@openid4vc/oauth2';
|
|
2
|
-
import type { CredentialConfigurationSupported, CredentialConfigurationSupportedWithFormats, CredentialIssuerMetadata, CredentialIssuerMetadataDisplayEntry, CredentialOfferObject, CredentialOfferPreAuthorizedCodeGrantTxCode, CredentialRequest, CredentialRequestFormatSpecific, CredentialRequestWithFormats, IssuerMetadataResult, ParseCredentialRequestReturn } from '@openid4vc/
|
|
3
|
-
import type { Openid4vpAuthorizationResponse,
|
|
2
|
+
import type { CredentialConfigurationSupported, CredentialConfigurationSupportedWithFormats, CredentialIssuerMetadata, CredentialIssuerMetadataDisplayEntry, CredentialOfferObject, CredentialOfferPreAuthorizedCodeGrantTxCode, CredentialRequest, CredentialRequestFormatSpecific, CredentialRequestWithFormats, IssuerMetadataResult, ParseCredentialRequestReturn } from '@openid4vc/openid4vci';
|
|
3
|
+
import type { Openid4vpAuthorizationResponse, ResolvedOpenid4vpAuthRequest, Openid4vpAuthorizationRequest, Openid4vpAuthorizationRequestDcApi } from '@openid4vc/openid4vp';
|
|
4
4
|
export { authorizationCodeGrantIdentifier, preAuthorizedCodeGrantIdentifier } from '@openid4vc/oauth2';
|
|
5
|
-
export { Openid4vpAuthorizationRequest } from '@openid4vc/
|
|
5
|
+
export { Openid4vpAuthorizationRequest } from '@openid4vc/openid4vp';
|
|
6
6
|
export type OpenId4VciCredentialConfigurationSupportedWithFormats = CredentialConfigurationSupportedWithFormats;
|
|
7
7
|
export type OpenId4VciCredentialConfigurationSupported = CredentialConfigurationSupported;
|
|
8
8
|
export type OpenId4VciCredentialConfigurationsSupported = Record<string, OpenId4VciCredentialConfigurationSupported>;
|
|
@@ -19,7 +19,7 @@ export type OpenId4VciCredentialRequestWithFormats = CredentialRequestWithFormat
|
|
|
19
19
|
export type OpenId4VciCredentialOfferPayload = CredentialOfferObject;
|
|
20
20
|
export type OpenId4VcSiopVerifiedAuthorizationRequest = ResolvedOpenid4vpAuthRequest;
|
|
21
21
|
export type OpenId4VcSiopAuthorizationRequestPayload = Openid4vpAuthorizationRequest | Openid4vpAuthorizationRequestDcApi;
|
|
22
|
-
export type OpenId4VcSiopAuthorizationResponsePayload = Openid4vpAuthorizationResponse
|
|
22
|
+
export type OpenId4VcSiopAuthorizationResponsePayload = Openid4vpAuthorizationResponse;
|
|
23
23
|
export * from './CredentialHolderBinding';
|
|
24
24
|
export * from './OpenId4VciAuthorizationServerConfig';
|
|
25
25
|
export * from './OpenId4VciCredentialFormatProfile';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAqBA,4CAAsG;AAA7F,0HAAA,gCAAgC,OAAA;AAAE,0HAAA,gCAAgC,OAAA;AAkC3E,4DAAyC;AACzC,wEAAqD;AACrD,sEAAmD;AACnD,uDAAoC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Oauth2ErrorCodes, Oauth2ServerErrorResponseError } from '@openid4vc/oauth2';
|
|
2
1
|
import type { AgentContext, Logger } from '@credo-ts/core';
|
|
2
|
+
import type { Oauth2ErrorCodes, Oauth2ServerErrorResponseError } from '@openid4vc/oauth2';
|
|
3
3
|
import type { Response, Request, NextFunction } from 'express';
|
|
4
4
|
import { Oauth2ResourceUnauthorizedError } from '@openid4vc/oauth2';
|
|
5
5
|
export interface OpenId4VcRequest<RC extends Record<string, unknown> = Record<string, never>> extends Request {
|
|
@@ -7,8 +7,8 @@ exports.sendNotFoundResponse = sendNotFoundResponse;
|
|
|
7
7
|
exports.sendErrorResponse = sendErrorResponse;
|
|
8
8
|
exports.sendJsonResponse = sendJsonResponse;
|
|
9
9
|
exports.getRequestContext = getRequestContext;
|
|
10
|
-
const oauth2_1 = require("@openid4vc/oauth2");
|
|
11
10
|
const core_1 = require("@credo-ts/core");
|
|
11
|
+
const oauth2_1 = require("@openid4vc/oauth2");
|
|
12
12
|
function sendUnauthorizedError(response, next, logger, error, status) {
|
|
13
13
|
const errorMessage = error instanceof Error ? error.message : error;
|
|
14
14
|
logger.warn(`[OID4VC] Sending authorization error response: ${JSON.stringify(errorMessage)}`, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/shared/router/context.ts"],"names":[],"mappings":";;AAeA,sDAyBC;AAED,0DAYC;AACD,wEAYC;AAED,oDAKC;AAED,8CAmBC;AAED,4CAcC;AAGD,8CAKC;AAnHD,
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/shared/router/context.ts"],"names":[],"mappings":";;AAeA,sDAyBC;AAED,0DAYC;AACD,wEAYC;AAED,oDAKC;AAED,8CAmBC;AAED,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U,CAAC,CAAA;AAClB,CAAC;AAED,SAAgB,gBAAgB,CAC9B,QAAkB,EAClB,IAAkB;AAClB,8DAA8D;AAC9D,IAAS,EACT,WAAoB,EACpB,MAAe;IAEf,QAAQ;SACL,SAAS,CAAC,cAAc,EAAE,WAAW,IAAI,kBAAkB,CAAC;SAC5D,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC;SACrB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;IAE7B,IAAI,EAAE,CAAA;AACR,CAAC;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"}
|
package/build/shared/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { OpenId4VcJwtIssuer } from './models';
|
|
1
2
|
import type { AgentContext, DidPurpose, JwaSignatureAlgorithm, Key } from '@credo-ts/core';
|
|
2
|
-
import type {
|
|
3
|
-
import { JwtSigner, JwtSignerX5c } from '@openid4vc/oauth2';
|
|
3
|
+
import type { JwtSigner, JwtSignerX5c } from '@openid4vc/oauth2';
|
|
4
4
|
/**
|
|
5
5
|
* Returns the JWA Signature Algorithms that are supported by the wallet.
|
|
6
6
|
*
|
|
@@ -11,9 +11,7 @@ import { JwtSigner, JwtSignerX5c } from '@openid4vc/oauth2';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function getSupportedJwaSignatureAlgorithms(agentContext: AgentContext): JwaSignatureAlgorithm[];
|
|
13
13
|
export declare function getKeyFromDid(agentContext: AgentContext, didUrl: string, allowedPurposes?: DidPurpose[]): Promise<Key>;
|
|
14
|
-
export declare function
|
|
15
|
-
issuer: string;
|
|
16
|
-
})): Promise<Exclude<JwtSigner, JwtSignerX5c> | (JwtSignerX5c & {
|
|
14
|
+
export declare function requestSignerToJwtIssuer(agentContext: AgentContext, requestSigner: OpenId4VcJwtIssuer): Promise<Exclude<JwtSigner, JwtSignerX5c> | (JwtSignerX5c & {
|
|
17
15
|
issuer: string;
|
|
18
16
|
})>;
|
|
19
17
|
export declare function getProofTypeFromKey(agentContext: AgentContext, key: Key): string;
|