@openid4vc/openid4vp 0.3.0-alpha-20250321221213 → 0.3.0-alpha-20250322133827
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/dist/index.d.mts +58 -1
- package/dist/index.d.ts +58 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -92,6 +92,8 @@ var zVpFormatsSupported = z2.record(
|
|
|
92
92
|
|
|
93
93
|
// src/models/z-client-metadata.ts
|
|
94
94
|
var zClientMetadata = z3.object({
|
|
95
|
+
// Up until draft 22
|
|
96
|
+
jwks_uri: z3.string().url().optional(),
|
|
95
97
|
jwks: z3.optional(zJwkSet),
|
|
96
98
|
vp_formats: z3.optional(zVpFormatsSupported),
|
|
97
99
|
...zJarmClientMetadata.shape,
|
|
@@ -1204,7 +1206,8 @@ function validateOpenId4vpAuthorizationRequestPayload(options) {
|
|
|
1204
1206
|
import {
|
|
1205
1207
|
Oauth2Error as Oauth2Error7,
|
|
1206
1208
|
Oauth2ErrorCodes as Oauth2ErrorCodes10,
|
|
1207
|
-
Oauth2ServerErrorResponseError as Oauth2ServerErrorResponseError11
|
|
1209
|
+
Oauth2ServerErrorResponseError as Oauth2ServerErrorResponseError11,
|
|
1210
|
+
fetchJwks
|
|
1208
1211
|
} from "@openid4vc/oauth2";
|
|
1209
1212
|
import { dateToSeconds as dateToSeconds3 } from "@openid4vc/utils";
|
|
1210
1213
|
|
|
@@ -1316,10 +1319,15 @@ async function createOpenid4vpAuthorizationResponse(options) {
|
|
|
1316
1319
|
if (!authorizationRequestPayload.client_metadata) {
|
|
1317
1320
|
throw new Oauth2Error7("Missing client metadata in the request params to assert Jarm metadata support.");
|
|
1318
1321
|
}
|
|
1319
|
-
|
|
1322
|
+
let jwks;
|
|
1323
|
+
if (authorizationRequestPayload.client_metadata.jwks) {
|
|
1324
|
+
jwks = authorizationRequestPayload.client_metadata.jwks;
|
|
1325
|
+
} else if (authorizationRequestPayload.client_metadata.jwks_uri) {
|
|
1326
|
+
jwks = await fetchJwks(authorizationRequestPayload.client_metadata.jwks_uri, options.callbacks.fetch);
|
|
1327
|
+
} else {
|
|
1320
1328
|
throw new Oauth2ServerErrorResponseError11({
|
|
1321
1329
|
error: Oauth2ErrorCodes10.InvalidRequest,
|
|
1322
|
-
error_description:
|
|
1330
|
+
error_description: `Missing 'jwks' or 'jwks_uri' in client metadata. Cannot extract encryption JWK.`
|
|
1323
1331
|
});
|
|
1324
1332
|
}
|
|
1325
1333
|
const supportedJarmMetadata = jarmAssertMetadataSupported({
|
|
@@ -1328,7 +1336,7 @@ async function createOpenid4vpAuthorizationResponse(options) {
|
|
|
1328
1336
|
});
|
|
1329
1337
|
const clientMetaJwks = extractJwksFromClientMetadata({
|
|
1330
1338
|
...authorizationRequestPayload.client_metadata,
|
|
1331
|
-
jwks
|
|
1339
|
+
jwks
|
|
1332
1340
|
});
|
|
1333
1341
|
if (!clientMetaJwks?.encJwk) {
|
|
1334
1342
|
throw new Oauth2ServerErrorResponseError11({
|