Tidied up Bruno files. Implemented builder utility to have more powerful route definitions.
This commit is contained in:
@@ -23,7 +23,7 @@ async function login(request: UnwrappedRequest<LoginRequest>): Promise<Response>
|
||||
u: verify.userId.raw,
|
||||
r: verify.refreshCount,
|
||||
},
|
||||
process.env.JWT_SECRET_KEY as string,
|
||||
process.env.JWT_REFRESH_KEY as string,
|
||||
{ expiresIn: `${tokenLifeSpanInDays * 24}h` },
|
||||
);
|
||||
const cookies = request?.request?.cookies;
|
||||
@@ -52,7 +52,7 @@ async function token(request: UnwrappedRequest): Promise<Response> {
|
||||
const refreshToken: {
|
||||
u: string;
|
||||
r: string;
|
||||
} = jwt.verify(refreshCookie, process.env.JWT_SECRET_KEY as string) as { u: string; r: string };
|
||||
} = jwt.verify(refreshCookie, process.env.JWT_REFRESH_KEY as string) as { u: string; r: string };
|
||||
|
||||
if (!(await orm.users.verifyRefreshCount(UserId.fromID(refreshToken.u), refreshToken.r))) {
|
||||
const response = new UnauthorizedResponse('Invalid refresh token');
|
||||
|
||||
Reference in New Issue
Block a user