π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Introduce idb
Manav Rathif5947a0c4a72
diff --git a/web/apps/photos/src/services/face/db.ts b/web/apps/photos/src/services/face/db.tsindex 1710f4382e..e099e823e3 100644--- a/web/apps/photos/src/services/face/db.ts+++ b/web/apps/photos/src/services/face/db.ts@@ -20,6 +20,8 @@ import type { FaceIndex } from "./types";* In tandem, these serve as the underlying storage for the functions exposed by* this file.*/+// eslint-disable-next-line @typescript-eslint/no-unused-vars+const openFaceDB = () => {};/*** Save the given {@link faceIndex} locally.@@ -58,3 +60,10 @@ export const addFileEntry = (fileID: string) => {};*/// eslint-disable-next-line @typescript-eslint/no-unused-varsexport const markIndexingFailed = (fileID: string) => {};++/**+ * Clear any data stored by the face module.+ *+ * Meant to be called during logout.+ */+export const clearFaceData = () => {};diff --git a/web/docs/dependencies.md b/web/docs/dependencies.mdindex 3ea8fb2409..6f959e61f5 100644--- a/web/docs/dependencies.md+++ b/web/docs/dependencies.md@@ -161,11 +161,16 @@ some cases.- [heic-convert](https://github.com/catdad-experiments/heic-convert) is usedfor converting HEIC files (which browsers don't natively support) into JPEG.-## Processing+## General- [comlink](https://github.com/GoogleChromeLabs/comlink) provides a minimallayer on top of Web Workers to make them more easier to use.+- [idb](https://github.com/jakearchibald/idb) provides a promise API over the+ browser-native IndexedDB APIs.++ > For more details about IDB and its role, see [storage.md](storage.md).+## Photos app specific- [react-dropzone](https://github.com/react-dropzone/react-dropzone/) is adiff --git a/web/docs/storage.md b/web/docs/storage.mdindex 9f19a6a46d..ae6d01eec5 100644--- a/web/docs/storage.md+++ b/web/docs/storage.md@@ -1,9 +1,15 @@# Storage+## Session Storage++Data tied to the browser tab's lifetime.++We store the user's encryption key here.+## Local Storage-Data in the local storage is persisted even after the user closes the tab (or-the browser itself). This is in contrast with session storage, where the data is+Data in the local storage is persisted even after the user closes the tab, or+the browser itself. This is in contrast with session storage, where the data iscleared when the browser tab is closed.The data in local storage is tied to the Document's origin (scheme + host).@@ -15,19 +21,23 @@ Some things that get stored here are:- Various user preferences-## Session Storage+## IndexedDB-Data tied to the browser tab's lifetime.+IndexedDB is a transactional NoSQL store provided by browsers. It has quite+large storage limits, and data is stored per origin (and remains persistent+across tab restarts).-We store the user's encryption key here.+Older code used the LocalForage library for storing things in Indexed DB. This+library falls back to localStorage in case Indexed DB storage is not available.++Newer code uses the idb library which provides a promise API over the IndexedDB,+but otherwise does not introduce any new abstractions.-## Indexed DB+For more details, see:-We use the LocalForage library for storing things in Indexed DB. This library-falls back to localStorage in case Indexed DB storage is not available.+- https://web.dev/articles/indexeddb+- https://github.com/jakearchibald/idb-Indexed DB allows for larger sizes than local/session storage, and is generally-meant for larger, tabular data.## OPFS