import {expect} from 'bun:test' import {hkdf, pbkdf, Usage} from '../src/kdf' import {PrivateWrap, SecretWrap} from '../index' const salt = new Uint8Array(32) const pwd = "test" const keypair = await PrivateWrap.gen_keypair() const kd = await pbkdf(salt, pwd) const k = await hkdf(kd, Usage.wrap) as CryptoKey const cipher = await SecretWrap.encrypt(keypair.privateKey, k) const box = cipher.toString() const unbox = SecretWrap.fromString(box) const plain = await unbox.decrypt(k) expect(plain).toEqual(keypair.privateKey) console.log("pwd-wraps-ecdh OK")