diff --git a/.env.template b/.env.template index 84b7e732..7484053f 100644 --- a/.env.template +++ b/.env.template @@ -413,7 +413,7 @@ ## Requires the Microsoft Store (appx) build of the desktop app. Stable releases up to and including 2026.9.1 lack the required plugin registration, so it has no effect there yet. ## - "pm-27278-v2-password-registration": Register new accounts with v2 encryption. (Web >= 2026.6.4, Desktop/Browser/CLI >= 2026.7.0, Android >= 2026.4.1, iOS >= 2026.5.1) ## - "enable-account-encryption-v2-jit-password-registration": Give SSO users who set their master password on their first login v2 encryption. (Web >= 2026.1.1, Desktop/Browser/CLI >= 2026.1.0, Android >= 2026.4.1, iOS >= 2026.6.0) -## These two flags can't be undone: a v2 account stays v2, and it can only log in from clients that are 2025.11.0 or newer and send their version, which rules out some older and third-party clients. +## These two flags can't be undone: a v2 account stays v2, and it can only log in from clients that are 2026.10.1 or newer (2026.10.2 for the desktop app), so the versions above are only enough to create one. # EXPERIMENTAL_CLIENT_FEATURE_FLAGS= ## Require new device emails. When a user logs in an email is required to be sent. diff --git a/src/api/core/accounts.rs b/src/api/core/accounts.rs index 5c8ddd6f..b2dd5845 100644 --- a/src/api/core/accounts.rs +++ b/src/api/core/accounts.rs @@ -386,7 +386,8 @@ impl ValidatedAccountKeys { } /// Sets the keys on the user. Save [`Self::save_signature_key_pair`] before the user: a v2 user without its key - /// pair can't unlock, while a key pair is ignored until its user is v2, and replaced on the next try. + /// pair can't unlock, while a key pair saved for a user who isn't v2 yet is ignored until it is, and replaced on + /// the next try. A rotation of a v2 account replaces its key pair, see `rotate_account`. fn apply(&self, user: &mut User) -> EmptyResult { user.private_key = Some(self.private_key.clone()); user.public_key = Some(self.public_key.clone()); @@ -1782,7 +1783,8 @@ async fn rotate_account(data: RotateData, headers: Headers, conn: DbConn, nt: No } // The key pair first, so that a v2 account is never saved without one. The data above is already re-encrypted by - // now, so a failure here still leaves it under a key that isn't stored (see the TODO before the first write). + // now, and for an account that was already v2 so is the signing key saved here, so a failure in either save + // leaves them under a key that isn't stored (see the TODO before the first write). data.account_keys.save_signature_key_pair(&user.uuid, &conn).await?; user.save(&conn).await?;