mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
15 lines
460 B
TypeScript
15 lines
460 B
TypeScript
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
|
|
import jwt from 'jsonwebtoken'
|
|
import CONFIG from '../config/'
|
|
|
|
// Generate an Access Token
|
|
export default function encode(sessionId: number, pubKey: Buffer): string {
|
|
const token = jwt.sign({ sessionId, pubKey }, CONFIG.JWT_SECRET, {
|
|
expiresIn: CONFIG.JWT_EXPIRES_IN,
|
|
subject: sessionId.toString(),
|
|
})
|
|
return token
|
|
}
|