UNPKG

@fanam-pkg/core-utils

Version:

Core Functions are managed here for quick web development

14 lines (10 loc) 407 B
import {sign, decode, DecodeOptions} from "jsonwebtoken" import {JSONObject} from "../model" export const useJWT = () => { const getJwtToken = (payload: JSONObject) => sign(payload, process.env.NEXT_PUBLIC_JWT_PASSPHRASE || "") const decodeJwtToken = (token: string, option?: DecodeOptions) => decode(token, {json: true, ...option}) return { getJwtToken, decodeJwtToken, } }