@meistrari/data-token 1.0.1 → 1.0.2
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/elysia.mjs +0 -1
- package/dist/adapters/hono.mjs +0 -1
- package/dist/index.mjs +1 -2
- package/package.json +1 -1
package/dist/adapters/elysia.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import Elysia from 'elysia';
|
|
|
2
2
|
import { getValidator } from '../index.mjs';
|
|
3
3
|
import 'node:buffer';
|
|
4
4
|
import 'jose';
|
|
5
|
-
import 'jose/dist/types/util/errors';
|
|
6
5
|
import 'zod';
|
|
7
6
|
|
|
8
7
|
function createDataTokenPlugin(url, skipOnError = false, getToken = (c) => c.headers["x-data-token"] ?? "") {
|
package/dist/adapters/hono.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import { createMiddleware } from 'hono/factory';
|
|
|
2
2
|
import { getValidator } from '../index.mjs';
|
|
3
3
|
import 'node:buffer';
|
|
4
4
|
import 'jose';
|
|
5
|
-
import 'jose/dist/types/util/errors';
|
|
6
5
|
import 'zod';
|
|
7
6
|
|
|
8
7
|
function createDataTokenMiddleware(url, skipOnError = false, getToken = (c) => c.req.header("x-data-token") ?? "") {
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
2
|
import { createRemoteJWKSet, jwtVerify, errors, decodeJwt } from 'jose';
|
|
3
|
-
import { JWKSNoMatchingKey } from 'jose/dist/types/util/errors';
|
|
4
3
|
import { z } from 'zod';
|
|
5
4
|
|
|
6
5
|
const sleep = async (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -81,7 +80,7 @@ function getValidator(jwksUrl, {
|
|
|
81
80
|
);
|
|
82
81
|
return DataToken.parse(payload);
|
|
83
82
|
} catch (error) {
|
|
84
|
-
if (error instanceof JWKSNoMatchingKey) {
|
|
83
|
+
if (error instanceof errors.JWKSNoMatchingKey) {
|
|
85
84
|
const [header] = token.split(".");
|
|
86
85
|
const tokenHeader = JSON.parse(Buffer.from(header, "base64").toString("utf-8"));
|
|
87
86
|
const jwksResponse = await fetch(jwksUrl);
|
package/package.json
CHANGED