diff --git a/package.json b/package.json index d76468da8fd1a95af4a260cf8165c49c3e4391da..a3eb89ca03bf568974f9330ddf1fd24a9aa1bf95 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "author": "", "license": "ISC", "devDependencies": { + "@types/cookie-parser": "^1.4.6", "@types/cors": "^2.8.16", "@types/express": "^4.17.1", "@types/jest": "^29.5.6", @@ -37,6 +38,7 @@ "@prisma/client": "^5.4.2", "argon2": "^0.31.1", "axios": "^1.6.1", + "cookie-parser": "^1.4.6", "cors": "^2.8.5", "dotenv": "^16.3.1", "express": "^4.17.1", diff --git a/src/utils/token.ts b/src/utils/token.ts index b0afdd8f320d1119c3d83c6c8d887e102bff0250..14e892deab16c4d59993796472260c1a7b3f1e31 100644 --- a/src/utils/token.ts +++ b/src/utils/token.ts @@ -4,13 +4,13 @@ import * as crypto from "crypto"; const generateFingerprint = async (numberOfBytes: number): Promise<string> => { const randomBytes: Buffer = crypto.randomBytes(numberOfBytes); - return randomBytes.toString("utf8"); + return randomBytes.toString("hex"); }; const hashFingerprint = async (fgp: string): Promise<string> => { const hash: crypto.Hash = crypto.createHash("sha256"); hash.update(fgp, "utf8"); - return hash.digest().toString("utf8"); + return hash.digest("hex"); }; const generateAccessTokenAndFingerprint = async (data: {