Implement PBKDF

This commit is contained in:
2024-05-21 16:00:24 +02:00
parent 4b94352d8b
commit 271d87827d
2 changed files with 47 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: KeyUsage[] = ['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)
}
})