Implement PBKDF

Closes #12
This commit is contained in:
2024-05-15 12:12:33 +02:00
parent 0347f30bd0
commit b0e34f3716
3 changed files with 41 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import {expect, test} from 'bun:test'
import {pbkdf} from 'pbkdf'
test('Fields are set correctly', async () => {
const pwd = 'password'
const salt = new TextEncoder().encode('salt')
const usages = ['unwrapKey', 'encrypt']
const k1 = await pbkdf(pwd, salt, usages)
expect(k1.extractable).toBeFalse()
expect(k1.type).toBe('secret')
expect(k1.usages.length).toBe(usages.length)
for (const usage of usages) {
expect(k1.usages).toContain(usage)
}
})