@openid4vc/oauth2 0.3.0-alpha-20250321213505 → 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 +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -6388,17 +6388,15 @@ declare function getAuthorizationServerMetadataFromList(authorizationServersMeta
|
|
|
6388
6388
|
}, z.ZodTypeAny, "passthrough">;
|
|
6389
6389
|
|
|
6390
6390
|
/**
|
|
6391
|
-
* Fetch JWKs from
|
|
6391
|
+
* Fetch JWKs from a provided JWKs URI.
|
|
6392
6392
|
*
|
|
6393
|
-
* Returns null if 404 is returned
|
|
6394
6393
|
* Returns validated metadata if successfull response
|
|
6395
6394
|
* Throws error otherwise
|
|
6396
6395
|
*
|
|
6397
6396
|
* @throws {ValidationError} if successfull response but validation of response failed
|
|
6398
6397
|
* @throws {InvalidFetchResponseError} if unsuccesful response
|
|
6399
|
-
* @throws {Oauth2Error} if authorization server does not have a jwks_uri
|
|
6400
6398
|
*/
|
|
6401
|
-
declare function fetchJwks(
|
|
6399
|
+
declare function fetchJwks(jwksUrl: string, fetch?: Fetch): Promise<JwkSet>;
|
|
6402
6400
|
|
|
6403
6401
|
/**
|
|
6404
6402
|
* Fetch well known metadata and validate the response.
|
package/dist/index.d.ts
CHANGED
|
@@ -6388,17 +6388,15 @@ declare function getAuthorizationServerMetadataFromList(authorizationServersMeta
|
|
|
6388
6388
|
}, z.ZodTypeAny, "passthrough">;
|
|
6389
6389
|
|
|
6390
6390
|
/**
|
|
6391
|
-
* Fetch JWKs from
|
|
6391
|
+
* Fetch JWKs from a provided JWKs URI.
|
|
6392
6392
|
*
|
|
6393
|
-
* Returns null if 404 is returned
|
|
6394
6393
|
* Returns validated metadata if successfull response
|
|
6395
6394
|
* Throws error otherwise
|
|
6396
6395
|
*
|
|
6397
6396
|
* @throws {ValidationError} if successfull response but validation of response failed
|
|
6398
6397
|
* @throws {InvalidFetchResponseError} if unsuccesful response
|
|
6399
|
-
* @throws {Oauth2Error} if authorization server does not have a jwks_uri
|
|
6400
6398
|
*/
|
|
6401
|
-
declare function fetchJwks(
|
|
6399
|
+
declare function fetchJwks(jwksUrl: string, fetch?: Fetch): Promise<JwkSet>;
|
|
6402
6400
|
|
|
6403
6401
|
/**
|
|
6404
6402
|
* Fetch well known metadata and validate the response.
|
package/dist/index.js
CHANGED
|
@@ -744,14 +744,8 @@ function getAuthorizationServerMetadataFromList(authorizationServersMetadata, is
|
|
|
744
744
|
// src/metadata/fetch-jwks-uri.ts
|
|
745
745
|
var import_utils10 = require("@openid4vc/utils");
|
|
746
746
|
var import_utils11 = require("@openid4vc/utils");
|
|
747
|
-
async function fetchJwks(
|
|
747
|
+
async function fetchJwks(jwksUrl, fetch) {
|
|
748
748
|
const fetcher = (0, import_utils10.createZodFetcher)(fetch);
|
|
749
|
-
const jwksUrl = authorizationServer.jwks_uri;
|
|
750
|
-
if (!jwksUrl) {
|
|
751
|
-
throw new Oauth2Error(
|
|
752
|
-
`Authorization server '${authorizationServer.issuer}' does not have a 'jwks_uri' parameter to fetch JWKs.`
|
|
753
|
-
);
|
|
754
|
-
}
|
|
755
749
|
const { result, response } = await fetcher(zJwkSet, import_utils10.ContentType.JwkSet, jwksUrl);
|
|
756
750
|
if (!response.ok) {
|
|
757
751
|
throw new import_utils11.InvalidFetchResponseError(
|
|
@@ -858,7 +852,13 @@ async function verifyJwtProfileAccessToken(options) {
|
|
|
858
852
|
`Access token jwt contains unrecognized authorization server 'iss' value of '${decodedJwt.payload.iss}'`
|
|
859
853
|
);
|
|
860
854
|
}
|
|
861
|
-
const
|
|
855
|
+
const jwksUrl = authorizationServer.jwks_uri;
|
|
856
|
+
if (!jwksUrl) {
|
|
857
|
+
throw new Oauth2Error(
|
|
858
|
+
`Authorization server '${authorizationServer.issuer}' does not have a 'jwks_uri' parameter to fetch JWKs.`
|
|
859
|
+
);
|
|
860
|
+
}
|
|
861
|
+
const jwks = await fetchJwks(jwksUrl, options.callbacks.fetch);
|
|
862
862
|
const publicJwk = extractJwkFromJwksForJwt({
|
|
863
863
|
kid: decodedJwt.header.kid,
|
|
864
864
|
jwks,
|