PwdWrap : No given salt !

This commit is contained in:
2024-09-11 22:08:51 +02:00
parent f2fee1d56f
commit 38632cc159
+2 -2
View File
@@ -16,9 +16,9 @@ export default class PwdWrap {
return await hkdf(k, Usage.wrap) as CryptoKey
}
public static async wrap(data: CryptoKey, pwd: string, salt?: Uint8Array): Promise<PwdWrap> {
public static async wrap(data: CryptoKey, pwd: string): Promise<PwdWrap> {
log.trace('wrap')
salt = salt ?? crypto.getRandomValues(new Uint8Array(16))
const salt = crypto.getRandomValues(new Uint8Array(16))
const k = await PwdWrap.derive(pwd, salt)
const box = await SecretWrap.wrap(data, k)
return new PwdWrap(box, salt)