✨ feat: create token validation endpoint
This commit is contained in:
12
src/modules/auth/services/http/tokenValidation.service.ts
Normal file
12
src/modules/auth/services/http/tokenValidation.service.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { AppError } from "../../../../helpers/error/instances/app";
|
||||
import { jwtDecode } from "../../../../helpers/http/jwt/decode";
|
||||
import { jwtEncode } from "../../../../helpers/http/jwt/encode";
|
||||
|
||||
export const tokenValidationService = (payload: string) => {
|
||||
try {
|
||||
const decoded = jwtDecode(payload);
|
||||
return decoded;
|
||||
} catch (error) {
|
||||
throw new AppError(500, "Token validation failed", error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user