Reduce duplicate code, move shit out to common package
This commit is contained in:
6
src/utils/password/verify.ts
Normal file
6
src/utils/password/verify.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { pbkdf2Sync } from 'crypto';
|
||||
|
||||
export const verify = (test: string, secret: string) => {
|
||||
const [salt, hash] = secret.split(':');
|
||||
return pbkdf2Sync(test, salt, 10000, 512, 'sha512').toString('hex') === hash;
|
||||
};
|
||||
Reference in New Issue
Block a user