1
0
mirror of https://github.com/sasjs/server.git synced 2026-04-09 15:13:13 +00:00

chore: restructured controllers

This commit is contained in:
Saad Jutt
2021-11-11 03:40:57 +05:00
parent 7a8123eb52
commit 1814c3a1f4
27 changed files with 84 additions and 66 deletions

View File

@@ -0,0 +1,7 @@
import jwt from 'jsonwebtoken'
import { InfoJWT } from '../types'
export const generateAccessToken = (data: InfoJWT) =>
jwt.sign(data, process.env.ACCESS_TOKEN_SECRET as string, {
expiresIn: '1h'
})

View File

@@ -0,0 +1,7 @@
import jwt from 'jsonwebtoken'
import { InfoJWT } from '../types'
export const generateAuthCode = (data: InfoJWT) =>
jwt.sign(data, process.env.AUTH_CODE_SECRET as string, {
expiresIn: '30s'
})

View File

@@ -0,0 +1,7 @@
import jwt from 'jsonwebtoken'
import { InfoJWT } from '../types'
export const generateRefreshToken = (data: InfoJWT) =>
jwt.sign(data, process.env.REFRESH_TOKEN_SECRET as string, {
expiresIn: '1day'
})

View File

@@ -1,4 +1,7 @@
export * from './file'
export * from './generateAccessToken'
export * from './generateAuthCode'
export * from './generateRefreshToken'
export * from './removeTokensInDB'
export * from './saveTokensInDB'
export * from './sleep'