Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Reuse

Manav Rathifc40b8fdd424
diff --git a/web/packages/base/crypto/libsodium.ts b/web/packages/base/crypto/libsodium.ts
index 701c8bf041..def955601d 100644
--- a/web/packages/base/crypto/libsodium.ts
+++ b/web/packages/base/crypto/libsodium.ts
@@ -774,22 +774,11 @@ export async function deriveSensitiveKey(passphrase: string, salt: string) {
}
export async function deriveInteractiveKey(passphrase: string, salt: string) {
- await sodium.ready;
- const key = await toB64(
- sodium.crypto_pwhash(
- sodium.crypto_secretbox_KEYBYTES,
- sodium.from_string(passphrase),
- await fromB64(salt),
- sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE,
- sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE,
- sodium.crypto_pwhash_ALG_ARGON2ID13,
- ),
- );
- return {
- key,
- opsLimit: sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE,
- memLimit: sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE,
- };
+ const opsLimit = sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE;
+ const memLimit = sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE;
+
+ const key = await deriveKey(passphrase, salt, opsLimit, memLimit);
+ return { key, opsLimit, memLimit };
}
export async function generateEncryptionKey() {