Skip to content

Commit

Permalink
fix(middleware/jwt): Changed the jwt-secret type to SignatureKey (#3167)
Browse files Browse the repository at this point in the history
* Changed the jwt-secret type to SignatureKey

* Changed import to type-import
  • Loading branch information
JulesVerner authored Jul 20, 2024
1 parent 84424ad commit 09f1d20
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/middleware/jwt/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { CookiePrefixOptions } from '../../utils/cookie'
import { Jwt } from '../../utils/jwt'
import '../../context'
import type { SignatureAlgorithm } from '../../utils/jwt/jwa'
import type { SignatureKey } from '../../utils/jwt/jws'

export type JwtVariables = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -23,7 +24,7 @@ export type JwtVariables = {
* @see {@link https://hono.dev/docs/middleware/builtin/jwt}
*
* @param {object} options - The options for the JWT middleware.
* @param {string} [options.secret] - A value of your secret key.
* @param {SignatureKey} [options.secret] - A value of your secret key.
* @param {string} [options.cookie] - If this value is set, then the value is retrieved from the cookie header using that value as a key, which is then validated as a token.
* @param {SignatureAlgorithm} [options.alg=HS256] - An algorithm type that is used for verifying. Available types are `HS256` | `HS384` | `HS512` | `RS256` | `RS384` | `RS512` | `PS256` | `PS384` | `PS512` | `ES256` | `ES384` | `ES512` | `EdDSA`.
* @returns {MiddlewareHandler} The middleware handler function.
Expand All @@ -45,7 +46,7 @@ export type JwtVariables = {
* ```
*/
export const jwt = (options: {
secret: string
secret: SignatureKey
cookie?:
| string
| { key: string; secret?: string | BufferSource; prefixOptions?: CookiePrefixOptions }
Expand Down

0 comments on commit 09f1d20

Please sign in to comment.