Created
March 9, 2024 23:31
-
-
Save antonkalik/58c5a0e3d269ba02ffa409c507568d78 to your computer and use it in GitHub Desktop.
Token service with constructor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class TokenService { | |
private jwt_secret: string; | |
constructor() { | |
if (!process.env.JWT_SECRET) { | |
throw new Error('JWT secret not found in environment variables!'); | |
} | |
this.jwt_secret = process.env.JWT_SECRET; | |
} | |
public verify(token: string) { | |
// Implementation... | |
} | |
public sign(payload) { | |
// Implementation... | |
} | |
} | |
const tokenService = new TokenService(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment