@@ -84,3 +84,3 @@ "use strict"; | ||
| } | ||
| const now = Date.now() / 1e3 | 0; | ||
| const now = Math.floor(Date.now() / 1e3); | ||
| if (nbf && payload.nbf && payload.nbf > now) { | ||
@@ -150,2 +150,3 @@ throw new import_types.JwtTokenNotBefore(token); | ||
| } | ||
| let verifyKeys = options.keys ? [...options.keys] : void 0; | ||
| if (options.jwks_uri) { | ||
@@ -163,11 +164,8 @@ const response = await fetch(options.jwks_uri, init); | ||
| } | ||
| if (options.keys) { | ||
| options.keys.push(...data.keys); | ||
| } else { | ||
| options.keys = data.keys; | ||
| } | ||
| } else if (!options.keys) { | ||
| verifyKeys ??= []; | ||
| verifyKeys.push(...data.keys); | ||
| } else if (!verifyKeys) { | ||
| throw new Error('verifyWithJwks requires options for either "keys" or "jwks_uri" or both'); | ||
| } | ||
| const matchingKey = options.keys.find((key) => key.kid === header.kid); | ||
| const matchingKey = verifyKeys.find((key) => key.kid === header.kid); | ||
| if (!matchingKey) { | ||
@@ -174,0 +172,0 @@ throw new import_types.JwtTokenInvalid(token); |
@@ -64,3 +64,3 @@ "use strict"; | ||
| } | ||
| const form = {}; | ||
| const form = /* @__PURE__ */ Object.create(null); | ||
| formData.forEach((value2, key) => { | ||
@@ -73,3 +73,3 @@ if (key.endsWith("[]")) { | ||
| form[key].push(value2); | ||
| } else if (key in form) { | ||
| } else if (Object.hasOwn(form, key)) { | ||
| form[key] = [form[key], value2]; | ||
@@ -76,0 +76,0 @@ } else { |
@@ -105,8 +105,10 @@ import type { Hono } from '../hono'; | ||
| } ? ClientResponse<O, S extends number ? S : never, F extends ResponseFormat ? F : never> : never; | ||
| export interface ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = ResponseFormat> extends globalThis.Response { | ||
| export interface ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = ResponseFormat> { | ||
| readonly body: ReadableStream | null; | ||
| readonly bodyUsed: boolean; | ||
| ok: U extends SuccessStatusCode ? true : U extends Exclude<StatusCode, SuccessStatusCode> ? false : boolean; | ||
| redirected: boolean; | ||
| status: U; | ||
| statusText: string; | ||
| type: 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'; | ||
| headers: Headers; | ||
@@ -116,2 +118,3 @@ url: string; | ||
| clone(): Response; | ||
| bytes(): Promise<Uint8Array<ArrayBuffer>>; | ||
| json(): F extends 'text' ? Promise<never> : F extends 'json' ? Promise<T> : Promise<unknown>; | ||
@@ -118,0 +121,0 @@ text(): F extends 'text' ? (T extends string ? Promise<T> : Promise<never>) : Promise<string>; |
@@ -200,3 +200,3 @@ /** | ||
| */ | ||
| request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: E["Bindings"] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response>; | ||
| request: (input: Request | string | URL, requestInit?: RequestInit, Env?: E["Bindings"] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response>; | ||
| /** | ||
@@ -203,0 +203,0 @@ * `.fire()` automatically adds a global fetch event listener. |
@@ -6,4 +6,4 @@ import type { JwtVariables } from './jwt'; | ||
| declare module '../..' { | ||
| interface ContextVariableMap extends JwtVariables { | ||
| interface ContextVariableMap extends JwtVariables<unknown> { | ||
| } | ||
| } |
@@ -72,3 +72,3 @@ // src/utils/jwt/jwt.ts | ||
| } | ||
| const now = Date.now() / 1e3 | 0; | ||
| const now = Math.floor(Date.now() / 1e3); | ||
| if (nbf && payload.nbf && payload.nbf > now) { | ||
@@ -138,2 +138,3 @@ throw new JwtTokenNotBefore(token); | ||
| } | ||
| let verifyKeys = options.keys ? [...options.keys] : void 0; | ||
| if (options.jwks_uri) { | ||
@@ -151,11 +152,8 @@ const response = await fetch(options.jwks_uri, init); | ||
| } | ||
| if (options.keys) { | ||
| options.keys.push(...data.keys); | ||
| } else { | ||
| options.keys = data.keys; | ||
| } | ||
| } else if (!options.keys) { | ||
| verifyKeys ??= []; | ||
| verifyKeys.push(...data.keys); | ||
| } else if (!verifyKeys) { | ||
| throw new Error('verifyWithJwks requires options for either "keys" or "jwks_uri" or both'); | ||
| } | ||
| const matchingKey = options.keys.find((key) => key.kid === header.kid); | ||
| const matchingKey = verifyKeys.find((key) => key.kid === header.kid); | ||
| if (!matchingKey) { | ||
@@ -162,0 +160,0 @@ throw new JwtTokenInvalid(token); |
@@ -42,3 +42,3 @@ // src/validator/validator.ts | ||
| } | ||
| const form = {}; | ||
| const form = /* @__PURE__ */ Object.create(null); | ||
| formData.forEach((value2, key) => { | ||
@@ -51,3 +51,3 @@ if (key.endsWith("[]")) { | ||
| form[key].push(value2); | ||
| } else if (key in form) { | ||
| } else if (Object.hasOwn(form, key)) { | ||
| form[key] = [form[key], value2]; | ||
@@ -54,0 +54,0 @@ } else { |
+1
-1
| { | ||
| "name": "hono", | ||
| "version": "4.12.2", | ||
| "version": "4.12.3", | ||
| "description": "Web framework built on Web Standards", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1272894
035548
-0.01%