@openstax/ts-utils 1.38.0 → 1.38.1
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/esm/misc/jwks.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import type { JWK } from 'node-jose';
|
|
|
3
3
|
export type JwksFetcher = (uri: string) => Promise<{
|
|
4
4
|
keys: JWK.RawKey[];
|
|
5
5
|
}>;
|
|
6
|
-
export declare const getJwksClient: (
|
|
6
|
+
export declare const getJwksClient: (jwksUri: string, fetcher?: JwksFetcher) => JwksClient;
|
|
7
7
|
export declare const getJwksKey: (iss: string, kid?: string, fetcher?: JwksFetcher) => Promise<import("jwks-rsa").SigningKey>;
|
package/dist/esm/misc/jwks.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { JwksClient } from 'jwks-rsa';
|
|
2
2
|
import { memoize } from './helpers';
|
|
3
|
-
export const getJwksClient = memoize((
|
|
4
|
-
const jwksUri = new URL('/.well-known/jwks.json', iss).toString();
|
|
3
|
+
export const getJwksClient = memoize((jwksUri, fetcher) => {
|
|
5
4
|
return new JwksClient({ jwksUri, fetcher });
|
|
6
5
|
});
|
|
7
6
|
export const getJwksKey = memoize(async (iss, kid, fetcher) => {
|
|
8
|
-
const
|
|
7
|
+
const jwksUri = new URL('/.well-known/jwks.json', iss).toString();
|
|
8
|
+
const client = getJwksClient(jwksUri, fetcher);
|
|
9
9
|
return client.getSigningKey(kid);
|
|
10
10
|
});
|