UNPKG

hono

Version:

Web framework built on Web Standards

20 lines (19 loc) 723 B
/** * @module * JSON Web Token (JWT) * https://datatracker.ietf.org/doc/html/rfc7519 */ import type { SignatureAlgorithm } from './jwa'; import type { SignatureKey } from './jws'; import type { JWTPayload } from './types'; export interface TokenHeader { alg: SignatureAlgorithm; typ?: 'JWT'; } export declare function isTokenHeader(obj: unknown): obj is TokenHeader; export declare const sign: (payload: JWTPayload, privateKey: SignatureKey, alg?: SignatureAlgorithm) => Promise<string>; export declare const verify: (token: string, publicKey: SignatureKey, alg?: SignatureAlgorithm) => Promise<JWTPayload>; export declare const decode: (token: string) => { header: TokenHeader; payload: JWTPayload; };