UNPKG

blade

Version:
67 lines (64 loc) 1.87 kB
import { k as getRecordIdentifier } from "../../index-l2pJm30F.js"; import "../../context-By_CckoX.js"; //#region ../../node_modules/hono/dist/types/utils/jwt/jwa.d.ts /** * @module * JSON Web Algorithms (JWA) * https://datatracker.ietf.org/doc/html/rfc7518 */ declare enum AlgorithmTypes { HS256 = "HS256", HS384 = "HS384", HS512 = "HS512", RS256 = "RS256", RS384 = "RS384", RS512 = "RS512", PS256 = "PS256", PS384 = "PS384", PS512 = "PS512", ES256 = "ES256", ES384 = "ES384", ES512 = "ES512", EdDSA = "EdDSA", } type SignatureAlgorithm = keyof typeof AlgorithmTypes; //#endregion //#region ../../node_modules/hono/dist/types/utils/jwt/jws.d.ts interface HonoJsonWebKey extends JsonWebKey { kid?: string; } type SignatureKey = string | HonoJsonWebKey | CryptoKey; //#endregion //#region ../../node_modules/hono/dist/types/utils/jwt/types.d.ts /** * JWT Payload */ type JWTPayload = { [key: string]: unknown; /** * The token is checked to ensure it has not expired. */ exp?: number; /** * The token is checked to ensure it is not being used before a specified time. */ nbf?: number; /** * The token is checked to ensure it is not issued in the future. */ iat?: number; }; //#endregion //#region ../../node_modules/hono/dist/types/middleware/jwt/jwt.d.ts type JwtVariables<T = any> = { jwtPayload: T; }; declare const verify: (token: string, publicKey: SignatureKey, alg?: SignatureAlgorithm) => Promise<JWTPayload>; declare const sign: (payload: JWTPayload, privateKey: SignatureKey, alg?: SignatureAlgorithm) => Promise<string>; //#endregion //#region ../../node_modules/hono/dist/types/middleware/jwt/index.d.ts declare module '../..' { interface ContextVariableMap extends JwtVariables {} } //#endregion export { type JWTPayload, getRecordIdentifier, sign as signJWT, verify as verifyJWT };