Skip to content

armgit / ente

Public Imported from GitHub
0

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

Doc

Manav Rathi2d1a8e5b85c5
diff --git a/web/packages/shared/crypto/internal/crypto.worker.ts b/web/packages/shared/crypto/internal/crypto.worker.ts
index 0b63ec15f3..7b6c9bcb9f 100644
--- a/web/packages/shared/crypto/internal/crypto.worker.ts
+++ b/web/packages/shared/crypto/internal/crypto.worker.ts
@@ -3,6 +3,18 @@ import * as libsodium from "@ente/shared/crypto/internal/libsodium";
import * as Comlink from "comlink";
import type { StateAddress } from "libsodium-wrappers";
+/**
+ * A web worker that exposes some of the functions defined in either the Ente
+ * specific layer (base/crypto/ente.ts) or the internal libsodium layer
+ * (internal/libsodium.ts).
+ *
+ * Running these in a web worker allows us to use potentially CPU-intensive
+ * crypto operations from the main thread without stalling the UI.
+ *
+ * See: [Note: Crypto code hierarchy].
+ *
+ * Note: Keep these methods logic free. They should just act as trivial proxies.
+ */
export class DedicatedCryptoWorker {
async decryptThumbnail(
fileData: Uint8Array,