Skip to content

armgit / ente

Public Imported from GitHub
0

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

Prune

Manav Rathicf5b006cab24
diff --git a/web/packages/base/crypto/libsodium.ts b/web/packages/base/crypto/libsodium.ts
index 064a396057..701c8bf041 100644
--- a/web/packages/base/crypto/libsodium.ts
+++ b/web/packages/base/crypto/libsodium.ts
@@ -100,16 +100,6 @@ export const fromB64URLSafeNoPaddingString = async (input: string) => {
return sodium.to_string(await fromB64URLSafeNoPadding(input));
};
-export async function fromUTF8(input: string) {
- await sodium.ready;
- return sodium.from_string(input);
-}
-
-export async function toUTF8(input: string) {
- await sodium.ready;
- return sodium.to_string(await fromB64(input));
-}
-
export async function toHex(input: string) {
await sodium.ready;
return sodium.to_hex(await fromB64(input));
@@ -612,7 +602,8 @@ export async function generateKeyAndEncryptToB64(data: string) {
}
export async function encryptUTF8(data: string, key: string) {
- const b64Data = await toB64(await fromUTF8(data));
+ await sodium.ready;
+ const b64Data = await toB64(sodium.from_string(data));
return await encryptToB64(b64Data, key);
}
@@ -752,7 +743,7 @@ export const deriveKey = async (
return await toB64(
sodium.crypto_pwhash(
sodium.crypto_secretbox_KEYBYTES,
- await fromUTF8(passphrase),
+ sodium.from_string(passphrase),
await fromB64(salt),
opsLimit,
memLimit,
@@ -787,7 +778,7 @@ export async function deriveInteractiveKey(passphrase: string, salt: string) {
const key = await toB64(
sodium.crypto_pwhash(
sodium.crypto_secretbox_KEYBYTES,
- await fromUTF8(passphrase),
+ sodium.from_string(passphrase),
await fromB64(salt),
sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE,
sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE,