7 lines
225 B
TypeScript
7 lines
225 B
TypeScript
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;
|
|
};
|