jsm-core
Version:
Core library for JSM project
18 lines (17 loc) • 673 B
TypeScript
import { Request } from 'express';
/**
* We are assuming that the JWT will come in a header with the form
*
* Authorization: Bearer ${JWT}
*
* But it could come in a query parameter with the name that you want like
* GET https://drsalmi-api.com/stats?apiKey=${JWT}
* Luckily this API follow _common sense_ ergo a _good design_ and don't allow that ugly stuff
*/
export declare const getTokenFromHeader: (req: Request) => string | null;
export declare const ExpirationHandler: (req: Request) => void;
/**
* @description This middleware will check if the JWT is valid and attach the payload to the request
*/
declare const handleJWT: any;
export default handleJWT;