@the-node-forge/jwt-utils
Version:
A flexible, lightweight Node.js JWT library for generating, verifying, and managing JSON Web Tokens (JWTs). Supports access and refresh tokens with customizable secrets for authentication and role-based access control. Includes middleware for Express, Fas
23 lines • 795 B
text/typescript
import jwt, { SignOptions } from 'jsonwebtoken';
export interface TokenPayload {
id: string;
role: string;
}
interface TokenOptions extends SignOptions {
accessExpiresIn?: string;
refreshExpiresIn?: string;
}
export declare function generateTokens(payload: TokenPayload, accessSecret: string, refreshSecret: string, options?: TokenOptions): {
accessToken: string;
refreshToken: string;
};
export declare function verifyToken(token: string, accessSecret: string, options?: {
audience?: string;
issuer?: string;
}): string | jwt.JwtPayload | null;
export declare function verifyRefreshToken(token: string, refreshSecret: string, options?: {
audience?: string;
issuer?: string;
}): string | jwt.JwtPayload | null;
export {};
//# sourceMappingURL=jwt.d.ts.map