@meistrari/data-token 1.2.2 → 1.2.4
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/adapters/hono.mjs +2 -1
- package/package.json +1 -1
package/dist/adapters/hono.mjs
CHANGED
|
@@ -6,9 +6,10 @@ import '@meistrari/logger';
|
|
|
6
6
|
import 'zod';
|
|
7
7
|
|
|
8
8
|
function createDataTokenMiddleware(url, skipOnError = false, getToken = (c) => c.req.header("x-data-token") ?? "") {
|
|
9
|
+
let validator;
|
|
9
10
|
return createMiddleware(async (c, next) => {
|
|
10
11
|
const jwksUrl = typeof url === "function" ? url(c) : url;
|
|
11
|
-
|
|
12
|
+
validator ?? (validator = getValidator(jwksUrl));
|
|
12
13
|
const token = getToken(c);
|
|
13
14
|
try {
|
|
14
15
|
const data = await validator(token);
|
package/package.json
CHANGED