import { Pbkdf2PasswordHasher } from '../Pbkdf2PasswordHasher' const passwords = ['', 'a', 'abc', 'test'] it('hashes and verifies passwords', async () => { const hasher = new Pbkdf2PasswordHasher('hmac-sha256', 10, 128) await Promise.all( passwords.map(async password => expect(await hasher.verify(password, await hasher.hash(password))).toBe(true)) ) await Promise.all( passwords.map(async password => expect(await hasher.verify(password + '!', await hasher.hash(password))).toBe(false) ) ) })