From 4a94d280cb2cf3f43e78d811bfd8a34f23cd548b Mon Sep 17 00:00:00 2001 From: Collin Duncan <3679940+cgduncan7@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:35:30 +0200 Subject: [PATCH] Removing old password service --- src/common/password.ts | 55 ------------------------------------------ 1 file changed, 55 deletions(-) delete mode 100644 src/common/password.ts diff --git a/src/common/password.ts b/src/common/password.ts deleted file mode 100644 index ab5d21c..0000000 --- a/src/common/password.ts +++ /dev/null @@ -1,55 +0,0 @@ -// TODO: refactor to nestjs if needed -// import argon2 from 'argon2' -// import crypto from 'crypto' -// import { asyncLocalStorage } from './logger' - -// const SALT_LENGTH = Number.parseInt(process.env.SALT_LENGTH || '32', 10) - -// const randomFillPromise = (buffer: Buffer) => { -// return new Promise((res, rej) => { -// crypto.randomFill(buffer, (err, buff) => { -// if (err) { -// rej(err) -// } -// res(buff) -// }) -// }) -// } - -// export const generateSalt = async () => { -// const saltBuffer = Buffer.alloc(SALT_LENGTH) -// return randomFillPromise(saltBuffer) -// } - -// export const generateHash = async (password: string, saltBuffer: Buffer) => { -// const hashOptions: argon2.Options & { raw: false } = { -// hashLength: 32, -// parallelism: 1, -// memoryCost: 1 << 14, -// timeCost: 2, -// type: argon2.argon2id, -// salt: saltBuffer, -// saltLength: saltBuffer.length, -// raw: false, -// } - -// const hash = await argon2.hash(password, hashOptions) -// return hash -// } - -// export const hashPassword = async (password: string) => { -// try { -// const saltBuffer = await generateSalt() -// const hash = await generateHash(password, saltBuffer) -// return hash -// } catch (err: any) { -// asyncLocalStorage -// .getStore() -// ?.error('Error hashing and salting password', { message: err.message }) -// throw err -// } -// } - -// export const verifyPassword = async (hash: string, password: string) => { -// return await argon2.verify(hash, password) -// }