@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.
@@ -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
- const validator = getValidator(jwksUrl);
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meistrari/data-token",
3
3
  "type": "module",
4
- "version": "1.2.2",
4
+ "version": "1.2.4",
5
5
  "description": "Internal library to verify and decode the API Gateway data token",
6
6
  "author": "Roz <roz@meistrari.com>",
7
7
  "license": "UNLICENSED",