Skip to content

armgit / ente

Public Imported from GitHub
0

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

Swap

Manav Rathi94c5cf316b78
diff --git a/web/apps/photos/src/services/publicCollectionService.ts b/web/apps/photos/src/services/publicCollectionService.ts
index 59f904b5bd..09966f3d0d 100644
--- a/web/apps/photos/src/services/publicCollectionService.ts
+++ b/web/apps/photos/src/services/publicCollectionService.ts
@@ -325,9 +325,11 @@ export const getPublicCollection = async (
const collectionName = (fetchedCollection.name =
fetchedCollection.name ||
- (await cryptoWorker.decryptToUTF8(
- fetchedCollection.encryptedName,
- fetchedCollection.nameDecryptionNonce,
+ (await cryptoWorker.decryptBoxUTF8(
+ {
+ encryptedData: fetchedCollection.encryptedName,
+ nonce: fetchedCollection.nameDecryptionNonce,
+ },
collectionKey,
)));
diff --git a/web/packages/base/crypto/libsodium.ts b/web/packages/base/crypto/libsodium.ts
index 7107a9a98c..b2c273bb77 100644
--- a/web/packages/base/crypto/libsodium.ts
+++ b/web/packages/base/crypto/libsodium.ts
@@ -678,17 +678,6 @@ export async function generateKeyAndEncryptToB64(data: string) {
return await encryptToB64(data, await toB64(key));
}
-/** Deprecated */
-export async function decryptToUTF8(
- encryptedData: string,
- nonce: string,
- keyB64: string,
-) {
- await sodium.ready;
- const decrypted = await decryptBoxBytes({ encryptedData, nonce }, keyB64);
- return sodium.to_string(decrypted);
-}
-
/**
* An opaque object meant to be threaded through {@link chunkHashInit},
* {@link chunkHashUpdate} and {@link chunkHashFinal}.
diff --git a/web/packages/base/crypto/worker.ts b/web/packages/base/crypto/worker.ts
index 39a12d19be..555becb4e4 100644
--- a/web/packages/base/crypto/worker.ts
+++ b/web/packages/base/crypto/worker.ts
@@ -49,10 +49,6 @@ export class CryptoWorker {
// TODO: -- AUDIT BELOW --
- async decryptToUTF8(data: string, nonce: string, key: string) {
- return libsodium.decryptToUTF8(data, nonce, key);
- }
-
async generateKeyAndEncryptToB64(data: string) {
return libsodium.generateKeyAndEncryptToB64(data);
}
diff --git a/web/packages/new/photos/services/collections.ts b/web/packages/new/photos/services/collections.ts
index fa67c710d9..ed58b32544 100644
--- a/web/packages/new/photos/services/collections.ts
+++ b/web/packages/new/photos/services/collections.ts
@@ -226,9 +226,11 @@ export const getCollectionWithSecrets = async (
}
const collectionName =
collection.name ||
- (await cryptoWorker.decryptToUTF8(
- collection.encryptedName,
- collection.nameDecryptionNonce,
+ (await cryptoWorker.decryptBoxUTF8(
+ {
+ encryptedData: collection.encryptedName,
+ nonce: collection.nameDecryptionNonce,
+ },
collectionKey,
));