mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
20 lines
575 B
TypeScript
20 lines
575 B
TypeScript
import { compareSync as bcryptCompareSync, hashSync as bcryptHashSync } from '@node-rs/bcrypt';
|
|
import crypto from 'crypto';
|
|
|
|
import { SALT_ROUNDS } from '../../constants/auth';
|
|
|
|
/**
|
|
* @deprecated Use the methods built into `bcrypt` instead
|
|
*/
|
|
export const hashSync = (password: string) => {
|
|
return bcryptHashSync(password, SALT_ROUNDS);
|
|
};
|
|
|
|
export const compareSync = (password: string, hash: string) => {
|
|
return bcryptCompareSync(password, hash);
|
|
};
|
|
|
|
export const hashString = (input: string) => {
|
|
return crypto.createHash('sha512').update(input).digest('hex');
|
|
};
|