π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Funnel point
Manav Rathi4acd17f06bfc
diff --git a/web/packages/next/local-user.ts b/web/packages/next/local-user.tsindex 8e9fd05f62..e7bf356c15 100644--- a/web/packages/next/local-user.ts+++ b/web/packages/next/local-user.ts@@ -1,6 +1,8 @@// TODO: This file belongs to the accounts packageimport { z } from "zod";+// TODO: During login the only field present is email. Which makes this+// optionality indicated by these types incorrect.const LocalUser = z.object({/** The user's ID. */id: z.number(),diff --git a/web/packages/shared/storage/localStorage/index.ts b/web/packages/shared/storage/localStorage/index.tsindex 5a22e9db21..ad3b580aec 100644--- a/web/packages/shared/storage/localStorage/index.ts+++ b/web/packages/shared/storage/localStorage/index.ts@@ -1,4 +1,5 @@import log from "@/next/log";+import { removeKV, setKV } from "packages/next/kv";export enum LS_KEYS {USER = "user",@@ -46,3 +47,16 @@ export const getData = (key: LS_KEYS) => {};export const clearData = () => localStorage.clear();++// TODO: Migrate this to `local-user.ts`, with (a) more precise optionality+// indication of the constituent fields, (b) moving any fields that need to be+// accessed from web workers to KV DB.+//+// Creating a new function here to act as a funnel point.+export const setLSUser = (user: object) => {+ const token = user["token"];+ token && typeof token == "string"+ ? setKV("token", token)+ : removeKV("token");+ setData(LS_KEYS.USER, user);+};