Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Doc

Manav Rathi3b749f0e75f4
diff --git a/web/packages/accounts/services/srp.ts b/web/packages/accounts/services/srp.ts
index 337464b105..7332221140 100644
--- a/web/packages/accounts/services/srp.ts
+++ b/web/packages/accounts/services/srp.ts
@@ -151,15 +151,13 @@ export interface SRPAttributes {
/**
* The mem limit used during the KEK derivation from the passphrase.
*
- * This is the same value as the {@link memLimit} in {@link KeyAttributes},
- * made available by remote also as part of SRP attributes for convenience.
+ * See also the discussion in {@link kekSalt}.
*/
memLimit: number;
/**
* The ops limit used during the KEK derivation from the passphrase.
*
- * This is the same value as the {@link opsLimit} in {@link KeyAttributes},
- * made available by remote also as part of SRP attributes for convenience.
+ * See also the discussion in {@link kekSalt}.
*/
opsLimit: number;
/**
@@ -167,6 +165,7 @@ export interface SRPAttributes {
*
* This is the same value as the {@link kekSalt} in {@link KeyAttributes},
* made available by remote also as part of SRP attributes for convenience.
+ * See: [Note: KEK three tuple] for more details.
*/
kekSalt: string;
/**
diff --git a/web/packages/accounts/services/user.ts b/web/packages/accounts/services/user.ts
index 3848e245bd..6f86e287e8 100644
--- a/web/packages/accounts/services/user.ts
+++ b/web/packages/accounts/services/user.ts
@@ -181,7 +181,29 @@ export interface KeyAttributes {
*
* Base64 encoded.
*
- * See: [Note: Key encryption key].
+ * [Note: KEK three tuple]
+ *
+ * The three tuple (kekSalt, opsLimit, memLimit) is needed (along with the
+ * user's passphrase) to rederive the KEK when the user logs in on a new
+ * client (See: [Note: Key encryption key]).
+ *
+ * The client can obtain these three by fetching their key attributes from
+ * remote, however unless {@link isEmailMFAEnabled} is enabled (which is not
+ * by default), then the user's credentials are verified using SRP instead
+ * of email verification. So as a convenience for this (majority) flow,
+ * remote also provides this exact same three tuple as part of the
+ * {@link SRPAttributes} fetched from remote.
+ *
+ * So on remote the KEK three tuple is the same whether it be part of key
+ * attributes or SRP attributes. When the user changes their password, both
+ * of them also get updated simulataneously (they use the same storage).
+ *
+ * However, on the client side these two sets of three tuples might diverge
+ * because of the client generating interactive key attributes. When that
+ * happens, the locally saved key attributes will be overwritten by the KEK
+ * three tuple for the new generated interactive KEK parameters, while the
+ * SRP attributes will continue to reflect the "original" KEK three tuple we
+ * got from remote.
*/
kekSalt: string;
/**