Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
♻️ Use TWT of length 10
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Aug 11, 2020
1 parent 6e121dc commit e70fa98
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/_staart/helpers/prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ prisma.$use(async (params, next) => {
console.log("Secret it", config("twtSecret"));
if (typeof result === "object" && !Array.isArray(result))
if (typeof result.id === "number")
result.id = sign(String(result.id), config("twtSecret"));
result.id = sign(String(result.id), config("twtSecret"), 10);
if (Array.isArray(result))
result.map((result) => {
if (typeof result.id === "number")
result.id = sign(String(result.id), config("twtSecret"));
result.id = sign(String(result.id), config("twtSecret"), 10);
return result;
});
return result;
Expand Down
2 changes: 1 addition & 1 deletion src/_staart/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
export const twtToId = (twt: string, userId?: number) =>
twt === "me" && userId
? userId
: parseInt(verify(twt, config("twtSecret")), 10);
: parseInt(verify(twt, config("twtSecret"), 10), 10);

/**
* Delete any sensitive information for a user like passwords and tokens
Expand Down

0 comments on commit e70fa98

Please sign in to comment.