From d5d7efd657c715be8d42c0a6e26807ef95bcdbae Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 26 Jun 2024 19:03:54 +0530 Subject: [PATCH] doc 3 --- web/packages/new/photos/services/embedding.ts | 5 ++--- web/packages/shared/crypto/internal/crypto.worker.ts | 1 + web/packages/shared/crypto/internal/libsodium.ts | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/web/packages/new/photos/services/embedding.ts b/web/packages/new/photos/services/embedding.ts index 5ec03a7319..5b422eaff1 100644 --- a/web/packages/new/photos/services/embedding.ts +++ b/web/packages/new/photos/services/embedding.ts @@ -73,9 +73,8 @@ const RemoteEmbedding = z.object({ type RemoteEmbedding = z.infer; /** - * Ask remote for what all changes have happened to the face embeddings that it - * knows about since the last time we synced. Update our local state to reflect - * those changes. + * Fetch new or updated face embeddings with the server and save them locally. + * Also prune local embeddings for any files no longer exist locally. * * It takes no parameters since it saves the last sync time in local storage. * diff --git a/web/packages/shared/crypto/internal/crypto.worker.ts b/web/packages/shared/crypto/internal/crypto.worker.ts index ef4f6a062e..e709aa74d6 100644 --- a/web/packages/shared/crypto/internal/crypto.worker.ts +++ b/web/packages/shared/crypto/internal/crypto.worker.ts @@ -4,6 +4,7 @@ import type { StateAddress } from "libsodium-wrappers"; const textDecoder = new TextDecoder(); const textEncoder = new TextEncoder(); + export class DedicatedCryptoWorker { async decryptMetadata( encryptedMetadata: string, diff --git a/web/packages/shared/crypto/internal/libsodium.ts b/web/packages/shared/crypto/internal/libsodium.ts index 56094c9b2d..9906c1a858 100644 --- a/web/packages/shared/crypto/internal/libsodium.ts +++ b/web/packages/shared/crypto/internal/libsodium.ts @@ -1,3 +1,11 @@ +/** + * @file A thin-ish layer over the actual libsodium APIs, to make them more + * palatable to the rest of our Javascript code. + * + * All functions are stateless, async, and safe to use in Web Workers. + * + * Docs for the JS library: https://github.com/jedisct1/libsodium.js + */ import { mergeUint8Arrays } from "@/utils/array"; import { CustomError } from "@ente/shared/error"; import sodium, { type StateAddress } from "libsodium-wrappers";