π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
accessor
Manav Rathi560533b2d434
diff --git a/web/packages/accounts/services/user.ts b/web/packages/accounts/services/user.tsindex 440fc01045..f75c72679f 100644--- a/web/packages/accounts/services/user.ts+++ b/web/packages/accounts/services/user.ts@@ -221,6 +221,19 @@ export const RemoteKeyAttributes = z.object({recoveryKeyDecryptionNonce: z.string().nullish().transform(nullToUndefined),});+/**+ * Return {@link KeyAttributes} if they are present in local storage.+ *+ * The key attributes are stored in the browser's localStorage. Thus, this+ * function only works from the main thread, not from web workers (local storage+ * is not accessible to web workers).+ */+export const savedKeyAttributes = (): KeyAttributes | undefined => {+ const jsonString = localStorage.getItem("keyAttributes");+ if (!jsonString) return undefined;+ return RemoteKeyAttributes.parse(JSON.parse(jsonString));+};+export interface UserVerificationResponse {id: number;keyAttributes?: KeyAttributes | undefined;diff --git a/web/packages/shared/storage/localStorage/index.ts b/web/packages/shared/storage/localStorage/index.tsindex ec8491e04d..f5878c3c0c 100644--- a/web/packages/shared/storage/localStorage/index.ts+++ b/web/packages/shared/storage/localStorage/index.ts@@ -3,6 +3,7 @@ import log from "ente-base/log";export type LocalStorageKey =| "user"+ // See also savedKeyAttributes.| "keyAttributes"| "originalKeyAttributes"| "isFirstLogin"