mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
24 lines
527 B
TypeScript
24 lines
527 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/'
|
|
|
|
export default (token: string): any => {
|
|
if (!token) return null
|
|
let sessionId = null
|
|
const email = null
|
|
try {
|
|
const decoded = jwt.verify(token, CONFIG.JWT_SECRET)
|
|
sessionId = decoded.sub
|
|
// email = decoded.email
|
|
return {
|
|
token,
|
|
sessionId,
|
|
email,
|
|
}
|
|
} catch (err) {
|
|
return null
|
|
}
|
|
}
|