@credo-ts/openid4vc 0.6.0-pr-2094-20241121142705 → 0.6.0-pr-2100-20241121224952

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.
Files changed (37) hide show
  1. package/build/openid4vc-holder/OpenId4VcHolderApi.d.ts +12 -11
  2. package/build/openid4vc-holder/OpenId4VcHolderApi.js +15 -9
  3. package/build/openid4vc-holder/OpenId4VcHolderApi.js.map +1 -1
  4. package/build/openid4vc-holder/OpenId4vcSiopHolderService.d.ts +5 -170
  5. package/build/openid4vc-holder/OpenId4vcSiopHolderService.js +66 -89
  6. package/build/openid4vc-holder/OpenId4vcSiopHolderService.js.map +1 -1
  7. package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.d.ts +13 -26
  8. package/build/openid4vc-issuer/OpenId4VcIssuerModule.js +0 -2
  9. package/build/openid4vc-issuer/OpenId4VcIssuerModule.js.map +1 -1
  10. package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.d.ts +7 -7
  11. package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js +2 -10
  12. package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js.map +1 -1
  13. package/build/openid4vc-issuer/OpenId4VcIssuerService.js +14 -6
  14. package/build/openid4vc-issuer/OpenId4VcIssuerService.js.map +1 -1
  15. package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts +7 -2
  16. package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.d.ts +3 -12
  17. package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js +26 -24
  18. package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js.map +1 -1
  19. package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.d.ts +12 -1
  20. package/build/openid4vc-verifier/OpenId4VcVerifierModule.js +0 -3
  21. package/build/openid4vc-verifier/OpenId4VcVerifierModule.js.map +1 -1
  22. package/build/openid4vc-verifier/router/index.d.ts +0 -1
  23. package/build/openid4vc-verifier/router/index.js +1 -3
  24. package/build/openid4vc-verifier/router/index.js.map +1 -1
  25. package/build/shared/models/OpenId4VcJwtIssuer.d.ts +1 -4
  26. package/build/shared/transform.js +1 -0
  27. package/build/shared/transform.js.map +1 -1
  28. package/build/shared/utils.d.ts +3 -11
  29. package/build/shared/utils.js +8 -100
  30. package/build/shared/utils.js.map +1 -1
  31. package/package.json +4 -6
  32. package/build/openid4vc-issuer/router/federationEndpoint.d.ts +0 -2
  33. package/build/openid4vc-issuer/router/federationEndpoint.js +0 -89
  34. package/build/openid4vc-issuer/router/federationEndpoint.js.map +0 -1
  35. package/build/openid4vc-verifier/router/federationEndpoint.d.ts +0 -2
  36. package/build/openid4vc-verifier/router/federationEndpoint.js +0 -118
  37. package/build/openid4vc-verifier/router/federationEndpoint.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import type { OpenId4VcVerificationSessionRecord, OpenId4VcVerifierRecordProps } from './repository';
2
2
  import type { OpenId4VcIssuerX5c, OpenId4VcJwtIssuer, OpenId4VcSiopAuthorizationResponsePayload, OpenId4VcSiopIdTokenPayload } from '../shared';
3
- import type { DifPresentationExchangeDefinition, DifPresentationExchangeSubmission, DifPresentationExchangeDefinitionV2, VerifiablePresentation, DifPexPresentationWithDescriptor } from '@credo-ts/core';
3
+ import type { DifPresentationExchangeDefinition, DifPresentationExchangeSubmission, DifPresentationExchangeDefinitionV2, VerifiablePresentation, DcqlQuery, DcqlPresentationRecord, DifPexPresentationWithDescriptor } from '@credo-ts/core';
4
4
  export type ResponseMode = 'direct_post' | 'direct_post.jwt';
5
5
  export interface OpenId4VcSiopCreateAuthorizationRequestOptions {
6
6
  /**
@@ -23,6 +23,12 @@ export interface OpenId4VcSiopCreateAuthorizationRequestOptions {
23
23
  presentationExchange?: {
24
24
  definition: DifPresentationExchangeDefinitionV2;
25
25
  };
26
+ /**
27
+ * A Digital Credentials Query Language (DCQL) can be provided to request the presentation of a Verifiable Credentials.
28
+ */
29
+ dcql?: {
30
+ query: DcqlQuery;
31
+ };
26
32
  /**
27
33
  * The response mode to use for the authorization request.
28
34
  * @default to `direct_post`.
@@ -48,6 +54,10 @@ export interface OpenId4VcSiopVerifiedAuthorizationResponsePresentationExchange
48
54
  presentations: Array<VerifiablePresentation>;
49
55
  descriptors: DifPexPresentationWithDescriptor[];
50
56
  }
57
+ export interface OpenId4VcSiopVerifiedAuthorizationResponseDcql {
58
+ query: DcqlQuery;
59
+ presentationRecord: DcqlPresentationRecord;
60
+ }
51
61
  /**
52
62
  * Either `idToken` and/or `presentationExchange` will be present.
53
63
  */
@@ -56,6 +66,7 @@ export interface OpenId4VcSiopVerifiedAuthorizationResponse {
56
66
  payload: OpenId4VcSiopIdTokenPayload;
57
67
  };
58
68
  presentationExchange?: OpenId4VcSiopVerifiedAuthorizationResponsePresentationExchange;
69
+ dcql?: OpenId4VcSiopVerifiedAuthorizationResponseDcql;
59
70
  }
60
71
  /**
61
72
  * Verifier metadata that will be send when creating a request
@@ -91,9 +91,6 @@ class OpenId4VcVerifierModule {
91
91
  // Configure endpoints
92
92
  (0, router_2.configureAuthorizationEndpoint)(endpointRouter, this.config.authorizationEndpoint);
93
93
  (0, authorizationRequestEndpoint_1.configureAuthorizationRequestEndpoint)(endpointRouter, this.config.authorizationRequestEndpoint);
94
- // TODO: The keys needs to be passed down to the federation endpoint to be used in the entity configuration for the openid relying party
95
- // TODO: But the keys also needs to be available for the request signing. They also needs to get saved because it needs to survive a restart of the agent.
96
- (0, router_2.configureFederationEndpoint)(endpointRouter);
97
94
  // First one will be called for all requests (when next is called)
98
95
  contextRouter.use(async (req, _res, next) => {
99
96
  const { agentContext } = (0, router_1.getRequestContext)(req);
@@ -1 +1 @@
1
- {"version":3,"file":"OpenId4VcVerifierModule.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierModule.ts"],"names":[],"mappings":";;;AAKA,6CAAkD;AAClD,yCAA4C;AAE5C,6CAA8F;AAE9F,iFAA6E;AAC7E,iEA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AAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;YAC3C,CAAC;YAED,IAAI,EAAE,CAAA;QACR,CAAC,CAAC,CAAA;QAEF,aAAa,CAAC,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;QAEjD,sBAAsB;QACtB,IAAA,uCAA8B,EAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAA;QACjF,IAAA,oEAAqC,EAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAA;QAE/F,kEAAkE;QAClE,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,GAAiC,EAAE,IAAa,EAAE,IAAI,EAAE,EAAE;YACjF,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;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;AAvHD,0DAuHC"}
@@ -1,3 +1,2 @@
1
1
  export { configureAuthorizationEndpoint } from './authorizationEndpoint';
2
2
  export { OpenId4VcVerificationRequest } from './requestContext';
3
- export { configureFederationEndpoint } from './federationEndpoint';
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configureFederationEndpoint = exports.configureAuthorizationEndpoint = void 0;
3
+ exports.configureAuthorizationEndpoint = void 0;
4
4
  var authorizationEndpoint_1 = require("./authorizationEndpoint");
5
5
  Object.defineProperty(exports, "configureAuthorizationEndpoint", { enumerable: true, get: function () { return authorizationEndpoint_1.configureAuthorizationEndpoint; } });
6
- var federationEndpoint_1 = require("./federationEndpoint");
7
- Object.defineProperty(exports, "configureFederationEndpoint", { enumerable: true, get: function () { return federationEndpoint_1.configureFederationEndpoint; } });
8
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/router/index.ts"],"names":[],"mappings":";;;AAAA,iEAAwE;AAA/D,uIAAA,8BAA8B,OAAA;AAEvC,2DAAkE;AAAzD,iIAAA,2BAA2B,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/router/index.ts"],"names":[],"mappings":";;;AAAA,iEAAwE;AAA/D,uIAAA,8BAA8B,OAAA"}
@@ -24,8 +24,5 @@ interface OpenId4VcJwtIssuerJwk {
24
24
  method: 'jwk';
25
25
  jwk: Jwk;
26
26
  }
27
- export interface OpenId4VcJwtIssuerFederation {
28
- method: 'openid-federation';
29
- }
30
- export type OpenId4VcJwtIssuer = OpenId4VcJwtIssuerDid | OpenId4VcIssuerX5c | OpenId4VcJwtIssuerJwk | OpenId4VcJwtIssuerFederation;
27
+ export type OpenId4VcJwtIssuer = OpenId4VcJwtIssuerDid | OpenId4VcIssuerX5c | OpenId4VcJwtIssuerJwk;
31
28
  export {};
@@ -59,6 +59,7 @@ function getVerifiablePresentationFromSphereonWrapped(wrappedVerifiablePresentat
59
59
  header,
60
60
  payload: wrappedVerifiablePresentation.presentation.signedPayload,
61
61
  prettyClaims: wrappedVerifiablePresentation.presentation.decodedPayload,
62
+ claimFormat: core_1.ClaimFormat.SdJwtVc,
62
63
  };
63
64
  }
64
65
  else if (wrappedVerifiablePresentation.format === 'mso_mdoc') {
@@ -1 +1 @@
1
- {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/shared/transform.ts"],"names":[],"mappings":";;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yBAAkB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA;QACpD,CAAC;QACD,OAAO,yBAAkB,CAAC,aAAa,CAAC,6BAA6B,CAAC,QAAQ,CAAC,CAAA;IACjF,CAAC;IAED,MAAM,IAAI,iBAAU,CAAC,oCAAoC,6BAA6B,CAAC,MAAM,EAAE,CAAC,CAAA;AAClG,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { OpenId4VcIssuerX5c, OpenId4VcJwtIssuer, OpenId4VcJwtIssuerFederation } from './models';
1
+ import type { OpenId4VcIssuerX5c, OpenId4VcJwtIssuer } from './models';
2
2
  import type { AgentContext, DidPurpose, JwaSignatureAlgorithm, Key } from '@credo-ts/core';
3
3
  import type { JwtIssuerWithContext as VpJwtIssuerWithContext, VerifyJwtCallback } from '@sphereon/did-auth-siop';
4
4
  import type { DPoPJwtIssuerWithContext, CreateJwtCallback, JwtIssuer } from '@sphereon/oid4vc-common';
@@ -12,19 +12,11 @@ import type { DPoPJwtIssuerWithContext, CreateJwtCallback, JwtIssuer } from '@sp
12
12
  */
13
13
  export declare function getSupportedJwaSignatureAlgorithms(agentContext: AgentContext): JwaSignatureAlgorithm[];
14
14
  export declare function getKeyFromDid(agentContext: AgentContext, didUrl: string, allowedPurposes?: DidPurpose[]): Promise<Key>;
15
- type VerifyJwtCallbackOptions = {
16
- federation?: {
17
- trustedEntityIds?: string[];
18
- };
19
- };
20
- export declare function getVerifyJwtCallback(agentContext: AgentContext, options?: VerifyJwtCallbackOptions): VerifyJwtCallback;
15
+ export declare function getVerifyJwtCallback(agentContext: AgentContext): VerifyJwtCallback;
21
16
  export declare function getCreateJwtCallback(agentContext: AgentContext): CreateJwtCallback<DPoPJwtIssuerWithContext | VpJwtIssuerWithContext>;
22
- export declare function openIdTokenIssuerToJwtIssuer(agentContext: AgentContext, openId4VcTokenIssuer: Exclude<OpenId4VcJwtIssuer, OpenId4VcIssuerX5c | OpenId4VcJwtIssuerFederation> | (OpenId4VcIssuerX5c & {
17
+ export declare function openIdTokenIssuerToJwtIssuer(agentContext: AgentContext, openId4VcTokenIssuer: Exclude<OpenId4VcJwtIssuer, OpenId4VcIssuerX5c> | (OpenId4VcIssuerX5c & {
23
18
  issuer: string;
24
- }) | (OpenId4VcJwtIssuerFederation & {
25
- entityId: string;
26
19
  })): Promise<JwtIssuer>;
27
20
  export declare function getProofTypeFromKey(agentContext: AgentContext, key: Key): string;
28
21
  export declare function addSecondsToDate(date: Date, seconds: number): Date;
29
22
  export declare function dateToSeconds(date: Date): number;
30
- export {};
@@ -9,7 +9,6 @@ exports.getProofTypeFromKey = getProofTypeFromKey;
9
9
  exports.addSecondsToDate = addSecondsToDate;
10
10
  exports.dateToSeconds = dateToSeconds;
11
11
  const core_1 = require("@credo-ts/core");
12
- const core_2 = require("@openid-federation/core");
13
12
  /**
14
13
  * Returns the JWA Signature Algorithms that are supported by the wallet.
15
14
  *
@@ -36,10 +35,8 @@ async function getKeyFromDid(agentContext, didUrl, allowedPurposes = ['authentic
36
35
  const verificationMethod = didDocument.dereferenceKey(didUrl, allowedPurposes);
37
36
  return (0, core_1.getKeyFromVerificationMethod)(verificationMethod);
38
37
  }
39
- function getVerifyJwtCallback(agentContext, options = {}) {
40
- const logger = agentContext.config.logger;
38
+ function getVerifyJwtCallback(agentContext) {
41
39
  return async (jwtVerifier, jwt) => {
42
- var _a, _b, _c, _d;
43
40
  const jwsService = agentContext.dependencyManager.resolve(core_1.JwsService);
44
41
  if (jwtVerifier.method === 'did') {
45
42
  const key = await getKeyFromDid(agentContext, jwtVerifier.didUrl);
@@ -47,55 +44,17 @@ function getVerifyJwtCallback(agentContext, options = {}) {
47
44
  const res = await jwsService.verifyJws(agentContext, { jws: jwt.raw, jwkResolver: () => jwk });
48
45
  return res.isValid;
49
46
  }
50
- if (jwtVerifier.method === 'x5c' || jwtVerifier.method === 'jwk') {
47
+ else if (jwtVerifier.method === 'x5c' || jwtVerifier.method === 'jwk') {
51
48
  const res = await jwsService.verifyJws(agentContext, { jws: jwt.raw });
52
49
  return res.isValid;
53
50
  }
54
- if (jwtVerifier.method === 'openid-federation') {
55
- const { entityId } = jwtVerifier;
56
- const trustedEntityIds = (_a = options.federation) === null || _a === void 0 ? void 0 : _a.trustedEntityIds;
57
- if (!trustedEntityIds) {
58
- logger.error('No trusted entity ids provided but is required for the "openid-federation" method.');
59
- return false;
60
- }
61
- const validTrustChains = await (0, core_2.resolveTrustChains)({
62
- entityId,
63
- trustAnchorEntityIds: trustedEntityIds,
64
- verifyJwtCallback: async ({ jwt, jwk }) => {
65
- const res = await jwsService.verifyJws(agentContext, {
66
- jws: jwt,
67
- jwkResolver: () => (0, core_1.getJwkFromJson)(jwk),
68
- });
69
- return res.isValid;
70
- },
71
- });
72
- // When the chain is already invalid we can return false immediately
73
- if (validTrustChains.length === 0) {
74
- logger.error(`${entityId} is not part of a trusted federation.`);
75
- return false;
76
- }
77
- // Pick the first valid trust chain for validation of the leaf entity jwks
78
- const { leafEntityConfiguration } = validTrustChains[0];
79
- // TODO: No support yet for signed jwks and external jwks
80
- const rpSigningKeys = (_d = (_c = (_b = leafEntityConfiguration === null || leafEntityConfiguration === void 0 ? void 0 : leafEntityConfiguration.metadata) === null || _b === void 0 ? void 0 : _b.openid_relying_party) === null || _c === void 0 ? void 0 : _c.jwks) === null || _d === void 0 ? void 0 : _d.keys;
81
- if (!rpSigningKeys || rpSigningKeys.length === 0)
82
- throw new core_1.CredoError('No rp signing keys found in the entity configuration.');
83
- const res = await jwsService.verifyJws(agentContext, {
84
- jws: jwt.raw,
85
- jwkResolver: () => (0, core_1.getJwkFromJson)(rpSigningKeys[0]),
86
- });
87
- if (!res.isValid) {
88
- logger.error(`${entityId} does not match the expected signing key.`);
89
- }
90
- // TODO: There is no check yet for the policies
91
- return res.isValid;
51
+ else {
52
+ throw new Error(`Unsupported jwt verifier method: '${jwtVerifier.method}'`);
92
53
  }
93
- throw new Error(`Unsupported jwt verifier method: '${jwtVerifier.method}'`);
94
54
  };
95
55
  }
96
56
  function getCreateJwtCallback(agentContext) {
97
57
  return async (jwtIssuer, jwt) => {
98
- var _a;
99
58
  const jwsService = agentContext.dependencyManager.resolve(core_1.JwsService);
100
59
  if (jwtIssuer.method === 'did') {
101
60
  const key = await getKeyFromDid(agentContext, jwtIssuer.didUrl);
@@ -106,7 +65,7 @@ function getCreateJwtCallback(agentContext) {
106
65
  });
107
66
  return jws;
108
67
  }
109
- if (jwtIssuer.method === 'jwk') {
68
+ else if (jwtIssuer.method === 'jwk') {
110
69
  if (!jwtIssuer.jwk.kty) {
111
70
  throw new core_1.CredoError('Missing required key type (kty) in the jwk.');
112
71
  }
@@ -119,7 +78,7 @@ function getCreateJwtCallback(agentContext) {
119
78
  });
120
79
  return jws;
121
80
  }
122
- if (jwtIssuer.method === 'x5c') {
81
+ else if (jwtIssuer.method === 'x5c') {
123
82
  const leafCertificate = core_1.X509Service.getLeafCertificate(agentContext, { certificateChain: jwtIssuer.x5c });
124
83
  const jws = await jwsService.createJwsCompact(agentContext, {
125
84
  protectedHeaderOptions: Object.assign(Object.assign({}, jwt.header), { alg: jwtIssuer.alg, jwk: undefined }),
@@ -128,47 +87,6 @@ function getCreateJwtCallback(agentContext) {
128
87
  });
129
88
  return jws;
130
89
  }
131
- if (jwtIssuer.method === 'custom') {
132
- // TODO: This could be used as the issuer and verifier. Based on that we need to search for a jwk in the entity configuration
133
- const { options } = jwtIssuer;
134
- if (!options)
135
- throw new core_1.CredoError(`Custom jwtIssuer must have options defined.`);
136
- if (!options.method)
137
- throw new core_1.CredoError(`Custom jwtIssuer's options must have a 'method' property defined.`);
138
- if (options.method !== 'openid-federation')
139
- throw new core_1.CredoError(`Custom jwtIssuer's options 'method' property must be 'openid-federation' when using the 'custom' method.`);
140
- if (!options.entityId)
141
- throw new core_1.CredoError(`Custom jwtIssuer must have entityId defined.`);
142
- if (typeof options.entityId !== 'string')
143
- throw new core_1.CredoError(`Custom jwtIssuer's entityId must be a string.`);
144
- const { entityId } = options;
145
- const entityConfiguration = await (0, core_2.fetchEntityConfiguration)({
146
- entityId,
147
- verifyJwtCallback: async ({ jwt, jwk }) => {
148
- const res = await jwsService.verifyJws(agentContext, { jws: jwt, jwkResolver: () => (0, core_1.getJwkFromJson)(jwk) });
149
- return res.isValid;
150
- },
151
- });
152
- // TODO: Not really sure if this is also used for the issuer so if so we need to change this logic. But currently it's not possible to specify a issuer method with issuance so I think it's fine.
153
- // NOTE: Hardcoded part for the verifier
154
- const openIdRelyingParty = (_a = entityConfiguration.metadata) === null || _a === void 0 ? void 0 : _a.openid_relying_party;
155
- if (!openIdRelyingParty)
156
- throw new core_1.CredoError('No openid-relying-party found in the entity configuration.');
157
- // NOTE: No support for signed jwks and external jwks
158
- const jwks = openIdRelyingParty.jwks;
159
- if (!jwks)
160
- throw new core_1.CredoError('No jwks found in the openid-relying-party.');
161
- // TODO: Not 100% sure what key to pick here I think the one that matches the kid in the jwt header of the entity configuration or we should pass a alg and pick a jwk based on that?
162
- const jwk = (0, core_1.getJwkFromJson)(jwks.keys[0]);
163
- // TODO: This gives a weird error when the private key is not available in the wallet so we should handle that better
164
- const jws = await jwsService.createJwsCompact(agentContext, {
165
- protectedHeaderOptions: Object.assign(Object.assign({}, jwt.header), { jwk, alg: jwk.supportedSignatureAlgorithms[0] }),
166
- payload: core_1.JwtPayload.fromJson(jwt.payload),
167
- key: jwk.key,
168
- });
169
- return jws;
170
- }
171
- // @ts-expect-error - All methods are supported currently so there is no unsupported method anymore
172
90
  throw new Error(`Unsupported jwt issuer method '${jwtIssuer.method}'`);
173
91
  };
174
92
  }
@@ -185,7 +103,7 @@ async function openIdTokenIssuerToJwtIssuer(agentContext, openId4VcTokenIssuer)
185
103
  alg,
186
104
  };
187
105
  }
188
- if (openId4VcTokenIssuer.method === 'x5c') {
106
+ else if (openId4VcTokenIssuer.method === 'x5c') {
189
107
  const leafCertificate = core_1.X509Service.getLeafCertificate(agentContext, {
190
108
  certificateChain: openId4VcTokenIssuer.x5c,
191
109
  });
@@ -210,23 +128,13 @@ async function openIdTokenIssuerToJwtIssuer(agentContext, openId4VcTokenIssuer)
210
128
  }
211
129
  return Object.assign(Object.assign({}, openId4VcTokenIssuer), { alg });
212
130
  }
213
- if (openId4VcTokenIssuer.method === 'jwk') {
131
+ else if (openId4VcTokenIssuer.method === 'jwk') {
214
132
  const alg = openId4VcTokenIssuer.jwk.supportedSignatureAlgorithms[0];
215
133
  if (!alg) {
216
134
  throw new core_1.CredoError(`No supported signature algorithms for key type: '${openId4VcTokenIssuer.jwk.keyType}'`);
217
135
  }
218
136
  return Object.assign(Object.assign({}, openId4VcTokenIssuer), { jwk: openId4VcTokenIssuer.jwk.toJson(), alg });
219
137
  }
220
- if (openId4VcTokenIssuer.method === 'openid-federation') {
221
- // TODO: Not sure what we want here if we need to add a new type to the sphereon library or that we can do it with the custom issuer
222
- return {
223
- method: 'custom',
224
- options: {
225
- method: 'openid-federation',
226
- entityId: openId4VcTokenIssuer.entityId,
227
- },
228
- };
229
- }
230
138
  throw new core_1.CredoError(`Unsupported jwt issuer method '${openId4VcTokenIssuer.method}'`);
231
139
  }
232
140
  function getProofTypeFromKey(agentContext, key) {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/shared/utils.ts"],"names":[],"mappings":";;AA4BA,gFAaC;AAED,sCAUC;AAQD,oDAsEC;AAED,oDA4FC;AAED,oEAoFC;AAED,kDASC;AAED,4CAEC;AAED,sCAEC;AArUD,yCAYuB;AACvB,kDAAsF;AAEtF;;;;;;;GAOG;AACH,SAAgB,kCAAkC,CAAC,YAA0B;IAC3E,MAAM,iBAAiB,GAAG,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAA;IAE/D,4EAA4E;IAC5E,MAAM,+BAA+B,GAAG,iBAAiB;QACvD,yDAAyD;SACxD,GAAG,CAAC,6BAAsB,CAAC;QAC5B,kCAAkC;SACjC,MAAM,CAAC,CAAC,QAAQ,EAAmD,EAAE,CAAC,QAAQ,KAAK,SAAS,CAAC;QAC9F,oEA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,7 @@
2
2
  "name": "@credo-ts/openid4vc",
3
3
  "main": "build/index",
4
4
  "types": "build/index",
5
- "version": "0.6.0-pr-2094-20241121142705",
5
+ "version": "0.6.0-pr-2100-20241121224952",
6
6
  "files": [
7
7
  "build"
8
8
  ],
@@ -17,16 +17,14 @@
17
17
  "directory": "packages/openid4vc"
18
18
  },
19
19
  "dependencies": {
20
- "@sphereon/did-auth-siop": "0.16.1-fix.173",
20
+ "@sphereon/did-auth-siop": "https://gitpkg.vercel.app/animo/OID4VC/packages/siop-oid4vp?funke",
21
21
  "@sphereon/oid4vc-common": "0.16.1-fix.173",
22
22
  "@sphereon/ssi-types": "0.30.2-next.135",
23
- "@openid-federation/core": "0.1.1-alpha.13",
24
23
  "class-transformer": "^0.5.1",
25
24
  "rxjs": "^7.8.0",
26
- "zod": "^3.23.8",
27
25
  "@animo-id/oid4vci": "0.1.3",
28
26
  "@animo-id/oauth2": "0.1.3",
29
- "@credo-ts/core": "0.6.0-pr-2094-20241121142705"
27
+ "@credo-ts/core": "0.6.0-pr-2100-20241121224952"
30
28
  },
31
29
  "devDependencies": {
32
30
  "@types/express": "^4.17.21",
@@ -34,7 +32,7 @@
34
32
  "nock": "^14.0.0-beta.16",
35
33
  "rimraf": "^4.4.0",
36
34
  "typescript": "~5.5.2",
37
- "@credo-ts/tenants": "0.6.0-pr-2094-20241121142705"
35
+ "@credo-ts/tenants": "0.6.0-pr-2100-20241121224952"
38
36
  },
39
37
  "scripts": {
40
38
  "build": "pnpm run clean && pnpm run compile",
@@ -1,2 +0,0 @@
1
- import type { Router } from 'express';
2
- export declare function configureFederationEndpoint(router: Router): void;
@@ -1,89 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configureFederationEndpoint = configureFederationEndpoint;
4
- const core_1 = require("@credo-ts/core");
5
- const core_2 = require("@openid-federation/core");
6
- const router_1 = require("../../shared/router");
7
- // TODO: It's also possible that the issuer and the verifier can have the same openid-federation endpoint. In that case we need to combine them.
8
- function configureFederationEndpoint(router) {
9
- // TODO: this whole result needs to be cached and the ttl should be the expires of this node
10
- router.get('/.well-known/openid-federation', async (request, response, next) => {
11
- var _a, _b;
12
- const { agentContext, issuer } = (0, router_1.getRequestContext)(request);
13
- try {
14
- // TODO: Should be only created once per issuer and be used between instances
15
- const federationKey = await agentContext.wallet.createKey({
16
- keyType: core_1.KeyType.Ed25519,
17
- });
18
- const now = new Date();
19
- const expires = new Date(now.getTime() + 1000 * 60 * 60 * 24); // 1 day from now
20
- // TODO: We need to generate a key and always use that for the entity configuration
21
- const jwk = (0, core_1.getJwkFromKey)(federationKey);
22
- const kid = federationKey.fingerprint;
23
- const alg = jwk.supportedSignatureAlgorithms[0];
24
- const issuerDisplay = (_a = issuer.display) === null || _a === void 0 ? void 0 : _a[0];
25
- const accessTokenSigningKey = core_1.Key.fromFingerprint(issuer.accessTokenPublicKeyFingerprint);
26
- const entityConfiguration = await (0, core_2.createEntityConfiguration)({
27
- claims: {
28
- sub: issuer.issuerId,
29
- iss: issuer.issuerId,
30
- iat: now,
31
- exp: expires,
32
- jwks: {
33
- keys: [Object.assign({ kid, alg }, jwk.toJson())],
34
- },
35
- metadata: {
36
- federation_entity: issuerDisplay
37
- ? {
38
- organization_name: issuerDisplay.name,
39
- logo_uri: (_b = issuerDisplay.logo) === null || _b === void 0 ? void 0 : _b.uri,
40
- }
41
- : undefined,
42
- openid_provider: {
43
- // TODO: The type isn't correct yet down the line so that needs to be updated before
44
- // credential_issuer: issuerMetadata.issuerUrl,
45
- // token_endpoint: issuerMetadata.tokenEndpoint,
46
- // credential_endpoint: issuerMetadata.credentialEndpoint,
47
- // authorization_server: issuerMetadata.authorizationServer,
48
- // authorization_servers: issuerMetadata.authorizationServer
49
- // ? [issuerMetadata.authorizationServer]
50
- // : undefined,
51
- // credentials_supported: issuerMetadata.credentialsSupported,
52
- // credential_configurations_supported: issuerMetadata.credentialConfigurationsSupported,
53
- // display: issuerMetadata.issuerDisplay,
54
- // dpop_signing_alg_values_supported: issuerMetadata.dpopSigningAlgValuesSupported,
55
- client_registration_types_supported: ['automatic'],
56
- jwks: {
57
- keys: [
58
- Object.assign({
59
- // TODO: Not 100% sure if this is the right key that we want to expose here or a different one
60
- kid: accessTokenSigningKey.fingerprint }, (0, core_1.getJwkFromKey)(accessTokenSigningKey).toJson()),
61
- ],
62
- },
63
- },
64
- },
65
- },
66
- header: {
67
- kid,
68
- alg,
69
- typ: 'entity-statement+jwt',
70
- },
71
- signJwtCallback: ({ toBeSigned }) => agentContext.wallet.sign({
72
- data: toBeSigned,
73
- key: federationKey,
74
- }),
75
- });
76
- response.writeHead(200, { 'Content-Type': 'application/entity-statement+jwt' }).end(entityConfiguration);
77
- }
78
- catch (error) {
79
- agentContext.config.logger.error('Failed to create entity configuration', {
80
- error,
81
- });
82
- (0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 500, 'invalid_request', error);
83
- return;
84
- }
85
- // NOTE: if we don't call next, the agentContext session handler will NOT be called
86
- next();
87
- });
88
- }
89
- //# sourceMappingURL=federationEndpoint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"federationEndpoint.js","sourceRoot":"","sources":["../../../src/openid4vc-issuer/router/federationEndpoint.ts"],"names":[],"mappings":";;AAWA,kEA6FC;AApGD,yCAA4D;AAC5D,kDAAmE;AAEnE,gDAA0E;AAE1E,gJAAgJ;AAEhJ,SAAgB,2BAA2B,CAAC,MAAc;IACxD,4FAA4F;IAE5F,MAAM,CAAC,GAAG,CAAC,gCAAgC,EAAE,KAAK,EAAE,OAAiC,EAAE,QAAkB,EAAE,IAAI,EAAE,EAAE;;QACjH,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,CAAA;QAE3D,IAAI,CAAC;YACH,6EAA6E;YAC7E,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC;gBACxD,OAAO,EAAE,cAAO,CAAC,OAAO;aAC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FAAyF;4BACzF,yCAAyC;4BACzC,mFAAmF;4BAEnF,mCAAmC,EAAE,CAAC,WAAW,CAAC;4BAClD,IAAI,EAAE;gCACJ,IAAI,EAAE;;wCAEF,8FAA8F;wCAC9F,GAAG,EAAE,qBAAqB,CAAC,WAAW,IACnC,IAAA,oBAAa,EAAC,qBAAqB,CAAC,CAAC,MAAM,EAAE;iCAEnD;6BACF;yBACF;qBACF;iBACF;gBACD,MAAM,EAAE;oBACN,GAAG;oBACH,GAAG;oBACH,GAAG,EAAE,sBAAsB;iBAC5B;gBACD,eAAe,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAClC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC;oBACvB,IAAI,EAAE,UAAoB;oBAC1B,GAAG,EAAE,aAAa;iBACnB,CAAC;aACL,CAAC,CAAA;YAEF,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,kCAAkC,EAAE,CAAC,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;QAC1G,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,uCAAuC,EAAE;gBACxE,KAAK;aACN,CAAC,CAAA;YACF,IAAA,0BAAiB,EAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAA;YAC5F,OAAM;QACR,CAAC;QAED,mFAAmF;QACnF,IAAI,EAAE,CAAA;IACR,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { Router } from 'express';
2
- export declare function configureFederationEndpoint(router: Router): void;
@@ -1,118 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configureFederationEndpoint = configureFederationEndpoint;
4
- const core_1 = require("@credo-ts/core");
5
- const core_2 = require("@openid-federation/core");
6
- const did_auth_siop_1 = require("@sphereon/did-auth-siop");
7
- const router_1 = require("../../shared/router");
8
- const OpenId4VcSiopVerifierService_1 = require("../OpenId4VcSiopVerifierService");
9
- const OpenId4VcVerifierModuleConfig_1 = require("../OpenId4VcVerifierModuleConfig");
10
- // TODO: Add types but this function is originally from the @
11
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
- const createRPRegistrationMetadataPayload = (opts) => {
13
- const rpRegistrationMetadataPayload = {
14
- id_token_signing_alg_values_supported: opts.idTokenSigningAlgValuesSupported,
15
- request_object_signing_alg_values_supported: opts.requestObjectSigningAlgValuesSupported,
16
- response_types_supported: opts.responseTypesSupported,
17
- scopes_supported: opts.scopesSupported,
18
- subject_types_supported: opts.subjectTypesSupported,
19
- subject_syntax_types_supported: opts.subject_syntax_types_supported || ['did:web:', 'did:ion:'],
20
- vp_formats: opts.vpFormatsSupported,
21
- client_name: opts.clientName,
22
- logo_uri: opts.logo_uri,
23
- tos_uri: opts.tos_uri,
24
- client_purpose: opts.clientPurpose,
25
- client_id: opts.client_id,
26
- };
27
- const languageTagEnabledFieldsNamesMapping = new Map();
28
- languageTagEnabledFieldsNamesMapping.set('clientName', 'client_name');
29
- languageTagEnabledFieldsNamesMapping.set('clientPurpose', 'client_purpose');
30
- // TODO: Do we need this?
31
- const languageTaggedFields = did_auth_siop_1.LanguageTagUtils.getLanguageTaggedPropertiesMapped(opts, languageTagEnabledFieldsNamesMapping);
32
- languageTaggedFields.forEach((value, key) => {
33
- const _key = key;
34
- rpRegistrationMetadataPayload[_key] = value;
35
- });
36
- return (0, did_auth_siop_1.removeNullUndefined)(rpRegistrationMetadataPayload);
37
- };
38
- function configureFederationEndpoint(router) {
39
- // TODO: this whole result needs to be cached and the ttl should be the expires of this node
40
- // TODO: This will not work for multiple instances so we have to save it in the database.
41
- const federationKeyMapping = new Map();
42
- const rpSigningKeyMapping = new Map();
43
- router.get('/.well-known/openid-federation', async (request, response, next) => {
44
- const { agentContext, verifier } = (0, router_1.getRequestContext)(request);
45
- const verifierService = agentContext.dependencyManager.resolve(OpenId4VcSiopVerifierService_1.OpenId4VcSiopVerifierService);
46
- const verifierConfig = agentContext.dependencyManager.resolve(OpenId4VcVerifierModuleConfig_1.OpenId4VcVerifierModuleConfig);
47
- try {
48
- let federationKey = federationKeyMapping.get(verifier.verifierId);
49
- if (!federationKey) {
50
- federationKey = await agentContext.wallet.createKey({
51
- keyType: core_1.KeyType.Ed25519,
52
- });
53
- federationKeyMapping.set(verifier.verifierId, federationKey);
54
- }
55
- let rpSigningKey = rpSigningKeyMapping.get(verifier.verifierId);
56
- if (!rpSigningKey) {
57
- rpSigningKey = await agentContext.wallet.createKey({
58
- keyType: core_1.KeyType.Ed25519,
59
- });
60
- rpSigningKeyMapping.set(verifier.verifierId, rpSigningKey);
61
- }
62
- const relyingParty = await verifierService.getRelyingParty(agentContext, verifier, {
63
- clientId: verifierConfig.baseUrl,
64
- clientIdScheme: 'entity_id',
65
- authorizationResponseUrl: `${verifierConfig.baseUrl}/siop/${verifier.verifierId}/authorize`,
66
- });
67
- const verifierEntityId = `${verifierConfig.baseUrl}/${verifier.verifierId}`;
68
- const rpMetadata = createRPRegistrationMetadataPayload(relyingParty.createRequestOptions.clientMetadata);
69
- // TODO: We also need to cache the entity configuration until it expires
70
- const now = new Date();
71
- // TODO: We also need to check if the x509 certificate is still valid until this expires
72
- const expires = new Date(now.getTime() + 1000 * 60 * 60 * 24); // 1 day
73
- const jwk = (0, core_1.getJwkFromKey)(federationKey);
74
- const alg = jwk.supportedSignatureAlgorithms[0];
75
- const kid = federationKey.fingerprint;
76
- const entityConfiguration = await (0, core_2.createEntityConfiguration)({
77
- header: {
78
- kid,
79
- alg,
80
- typ: 'entity-statement+jwt',
81
- },
82
- claims: {
83
- sub: verifierEntityId,
84
- iss: verifierEntityId,
85
- iat: now,
86
- exp: expires,
87
- jwks: {
88
- keys: [Object.assign({ kid, alg }, jwk.toJson())],
89
- },
90
- metadata: {
91
- federation_entity: {
92
- organization_name: rpMetadata.client_name,
93
- logo_uri: rpMetadata.logo_uri,
94
- },
95
- openid_relying_party: Object.assign(Object.assign({}, rpMetadata), { jwks: {
96
- keys: [Object.assign({ kid: rpSigningKey.fingerprint, alg }, (0, core_1.getJwkFromKey)(rpSigningKey).toJson())],
97
- }, client_registration_types: ['automatic'] }),
98
- },
99
- },
100
- signJwtCallback: ({ toBeSigned }) => agentContext.wallet.sign({
101
- data: toBeSigned,
102
- key: federationKey,
103
- }),
104
- });
105
- response.writeHead(200, { 'Content-Type': 'application/entity-statement+jwt' }).end(entityConfiguration);
106
- }
107
- catch (error) {
108
- agentContext.config.logger.error('Failed to create entity configuration', {
109
- error,
110
- });
111
- (0, router_1.sendErrorResponse)(response, next, agentContext.config.logger, 500, 'invalid_request', error);
112
- return;
113
- }
114
- // NOTE: if we don't call next, the agentContext session handler will NOT be called
115
- next();
116
- });
117
- }
118
- //# sourceMappingURL=federationEndpoint.js.map