Prettier...
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
2023-05-24 10:33:41 -04:00
parent 40645f58e3
commit 65e30ba1c7
33 changed files with 548 additions and 423 deletions

View File

@@ -1,12 +1,12 @@
import { pbkdf2Sync, randomBytes } from 'crypto';
import { pbkdf2Sync, randomBytes } from "crypto";
export const encrypt = (password: string) => {
const salt = randomBytes(16).toString('hex');
const hash = pbkdf2Sync(password, salt, 10000, 512, 'sha512').toString('hex');
return `${salt}:${hash}`;
const salt = randomBytes(16).toString("hex");
const hash = pbkdf2Sync(password, salt, 10000, 512, "sha512").toString("hex");
return `${salt}:${hash}`;
};
export const verify = (test: string, secret: string) => {
const [salt, hash] = secret.split(':');
return pbkdf2Sync(test, salt, 10000, 512, 'sha512').toString('hex') === hash;
const [salt, hash] = secret.split(":");
return pbkdf2Sync(test, salt, 10000, 512, "sha512").toString("hex") === hash;
};