Skip to content

armgit / ente

Public Imported from GitHub
0

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

[photos] Remove comments from streaming download changes

AswinAsok3a7ccbd70c50
diff --git a/web/apps/photos/tests/download-integrity.test.ts b/web/apps/photos/tests/download-integrity.test.ts
index 4c4bc89120..20d18852fd 100644
--- a/web/apps/photos/tests/download-integrity.test.ts
+++ b/web/apps/photos/tests/download-integrity.test.ts
@@ -13,7 +13,6 @@ import { FileType } from "ente-media/file-type";
import { Buffer } from "node:buffer";
import { beforeAll, describe, expect, test, vi } from "vitest";
-// Exercise the real cryptography without needing a browser Comlink worker.
vi.mock("ente-base/crypto", () => import("ente-base/crypto/libsodium"));
vi.mock("ente-base/log", () => ({
default: { info: vi.fn(), error: vi.fn() },
diff --git a/web/packages/base/crypto/libsodium.ts b/web/packages/base/crypto/libsodium.ts
index 63a19e8987..4ba8d4f39a 100644
--- a/web/packages/base/crypto/libsodium.ts
+++ b/web/packages/base/crypto/libsodium.ts
@@ -282,14 +282,12 @@ export const initChunkDecryption = async (
return { pullState, decryptionChunkSize };
};
-/** If supplied, isFinalChunk must match the authenticated final tag. */
export const decryptStreamChunk = async (
data: Uint8Array,
pullState: SodiumStateAddress,
isFinalChunk?: boolean,
): Promise<Uint8Array<ArrayBuffer>> => {
await sodium.ready;
- // The sodium typings omit the false returned on authentication failure.
const pullResult = sodium.crypto_secretstream_xchacha20poly1305_pull(
pullState,
data,
diff --git a/web/packages/gallery/services/download-core.ts b/web/packages/gallery/services/download-core.ts
index 48e700861a..a875b2c2ed 100644
--- a/web/packages/gallery/services/download-core.ts
+++ b/web/packages/gallery/services/download-core.ts
@@ -353,8 +353,6 @@ class DownloadManagerCore {
);
}
- // Keep the last chunk until EOF, even if it is full-size,
- // so its authenticated final tag can be checked.
while (data.length > decryptionChunkSize) {
const decryptedData = await decryptStreamChunk(
data.slice(0, decryptionChunkSize),