π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Sketch
Manav Rathia5a7c4fcb294
diff --git a/web/apps/photos/src/services/embeddingService.ts b/web/apps/photos/src/services/embeddingService.tsindex 04c5089f9e..f78d410042 100644--- a/web/apps/photos/src/services/embeddingService.ts+++ b/web/apps/photos/src/services/embeddingService.ts@@ -1,3 +1,4 @@+import type { EmbeddingModel } from "@/new/photos/services/embedding";import { inWorker } from "@/next/env";import log from "@/next/log";import { apiOrigin } from "@/next/origins";@@ -9,7 +10,6 @@ import localForage from "@ente/shared/storage/localForage";import { getToken } from "@ente/shared/storage/localStorage/helpers";import type {Embedding,- EmbeddingModel,EncryptedEmbedding,GetEmbeddingDiffResponse,PutEmbeddingRequest,diff --git a/web/apps/photos/src/types/embedding.tsx b/web/apps/photos/src/types/embedding.tsxindex 161244c159..c14b4a137d 100644--- a/web/apps/photos/src/types/embedding.tsx+++ b/web/apps/photos/src/types/embedding.tsx@@ -1,11 +1,4 @@-/**- * The embeddings that we (the current client) knows how to handle.- *- * This is an exhaustive set of values we pass when PUT-ting encrypted- * embeddings on the server. However, we should be prepared to receive an- * {@link EncryptedEmbedding} with a model value different from these.- */-export type EmbeddingModel = "onnx-clip" | "file-ml-clip-face";+import type { EmbeddingModel } from "@/new/photos/services/embedding";export interface EncryptedEmbedding {fileID: number;diff --git a/web/packages/new/photos/services/embedding.ts b/web/packages/new/photos/services/embedding.tsnew file mode 100644index 0000000000..9acd7ccd20--- /dev/null+++ b/web/packages/new/photos/services/embedding.ts@@ -0,0 +1,46 @@+/**+ * The embeddings that we (the current client) knows how to handle.+ *+ * It is vernacularly called a model, but strictly speaking this is not the+ * model, but the embedding produced by a particular model with a particular set+ * of pre-/post- processing steps and related hyperparameters. It is better+ * thought of as an "type" of embedding produced or consumed by the client.+ *+ * The embeddings themselves have a version included in them, so it is possible+ * for us to make backward compatible updates to the indexing process on newer+ * clients. Alternatively, if the changes are not backward compatible and can+ * only be consumed by clients with the relevant scaffolding, then we change+ * this "model" (i.e "type") field to create a new universe of embeddings.+ *+ * This is an exhaustive set of values we pass when GET-ing or PUT-ting+ * encrypted embeddings from remote. However, we should be prepared to receive+ * an {@link EncryptedEmbedding} with a model value different from these.+ */+export type EmbeddingModel = "onnx-clip" | "file-ml-clip-face";++/**+ * Ask remote for what all changes have happened to the face embeddings that it+ * knows about since the last time we synced. Then update our local state to+ * reflect those changes.+ *+ * It takes no parameters since it saves the last sync time in local storage.+ */+export const syncRemoteFaceEmbeddings = async () => {+ return 0;+};++// const getFaceEmbeddings = async () => {++// }++/**+ * GET /embeddings/diff for the given model and changes {@link sinceTime}.+ *+ * @param model The {@link EmbeddingModel} whose diff we wish for.+ *+ * @param sinceTime The last time we synced (epoch ms).+ */+// const getEmbeddingsDiff = async (model: EmbeddingModel, sinceTime: number) => {+// // const params = new URLSearchParams()++// }