π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Thumb
Manav Rathid599a6dcfa97
diff --git a/web/apps/photos/src/services/upload/uploadService.ts b/web/apps/photos/src/services/upload/uploadService.tsindex b6e28d9d12..d07179edf7 100644--- a/web/apps/photos/src/services/upload/uploadService.ts+++ b/web/apps/photos/src/services/upload/uploadService.ts@@ -1124,10 +1124,14 @@ const encryptFile = async (worker,);- const encryptedThumbnail = await worker.encryptThumbnail(- file.thumbnail,- fileKey,- );+ const {+ encryptedData: thumbEncryptedData,+ decryptionHeaderB64: thumbDecryptionHeader,+ } = await worker.encryptThumbnail(file.thumbnail, fileKey);+ const encryptedThumbnail = {+ encryptedData: thumbEncryptedData,+ decryptionHeader: thumbDecryptionHeader,+ };const encryptedMetadata = await worker.encryptMetadata2(file.metadata,diff --git a/web/packages/base/crypto/ente.ts b/web/packages/base/crypto/ente.tsindex 61bce30ed2..fb93370ec5 100644--- a/web/packages/base/crypto/ente.ts+++ b/web/packages/base/crypto/ente.ts@@ -37,6 +37,20 @@ import * as libsodium from "@ente/shared/crypto/internal/libsodium";*/export const encryptAssociatedData = libsodium.encryptChaChaOneShot;+/**+ * Encrypt the thumbnail for a file.+ *+ * This is just an alias for {@link encryptAssociatedData}.+ *+ * @param data The thumbnail's data.+ *+ * @param keyB64 The key associated with the file whose thumbnail this is.+ *+ * @returns The encrypted thumbnail, and the associated decryption header+ * (Base64 encoded).+ */+export const encryptThumbnail = encryptAssociatedData;+/*** Encrypted the embedding associated with a file using the file's key.*diff --git a/web/packages/shared/crypto/internal/crypto.worker.ts b/web/packages/shared/crypto/internal/crypto.worker.tsindex 917fe0d0cb..520e1eb589 100644--- a/web/packages/shared/crypto/internal/crypto.worker.ts+++ b/web/packages/shared/crypto/internal/crypto.worker.ts@@ -32,22 +32,8 @@ export class DedicatedCryptoWorker {);}- /**- * Encrypt the thumbnail associated with a file.- *- * This defers to {@link encryptChaChaOneShot}.- *- * @param data The thumbnail's data.- *- * @param keyB64 The key associated with the file whose thumbnail this is.- *- * @returns The encrypted thumbnail, and the associated decryption header- * (Base64 encoded).- */async encryptThumbnail(data: Uint8Array, keyB64: string) {- const { encryptedData, decryptionHeaderB64: decryptionHeader } =- await libsodium.encryptChaChaOneShot(data, keyB64);- return { encryptedData, decryptionHeader };+ return ente.encryptThumbnail(data, keyB64);}async encryptFile(fileData: Uint8Array) {