- Connecting the dots?
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2023-05-02 21:47:45 -04:00
parent 5fba4c6643
commit 68f58329e8
10 changed files with 81 additions and 39 deletions

View File

@@ -1,5 +1,7 @@
import jwt from 'jsonwebtoken';
import { JWT_SECRET } from '../constants/defaults';
export const getJwtSecret = () => process.env.JWT_SECRET || JWT_SECRET;
export interface TokenProps {
aud?: string;
exp?: number | Date;
@@ -28,8 +30,8 @@ export const sign = (props: SignProps) => {
iat: today.getTime(),
iss: rest.iss || process.env.JWT_ISSUER,
},
process.env.JWT_SECRET || 'secret',
getJwtSecret(),
);
};
export const verify = (token: string) => jwt.verify(token, process.env.JWT_SECRET || 'secret');
export const verify = (token: string) => jwt.verify(token, getJwtSecret());