π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Merge remote-tracking branch 'upstream/main' into feat/rust-recovery-key-mnemonic
r4khulfada5395a2a4
diff --cc mobile/apps/photos/lib/ui/account/recovery_page.dartindex c9dffe79ae,d4df1e0b96..84bcdd2bae--- a/mobile/apps/photos/lib/ui/account/recovery_page.dart+++ b/mobile/apps/photos/lib/ui/account/recovery_page.dart@@@ -1,4 -1,3 +1,4 @@@- import 'package:ente_base/models/two_factor.dart';++import 'package:ente_base/models/accounts.dart';import "package:ente_components/ente_components.dart";import "package:ente_strings/ente_strings.dart";import 'package:flutter/material.dart';@@@ -121,13 -122,9 +123,12 @@@ class _RecoveryPageState extends State<},),);- } catch (_) {+ } catch (e) {await dialog.hide();if (!mounted) return;+ final errMessage = e == const AccountsError.malformedRecoveryKey()+ ? context.strings.invalidRecoveryKey+ : context.strings.incorrectRecoveryKeyBody;- if (!mounted) return;// ignore: unawaited_futuresshowAlertBottomSheet(context,diff --cc rust/bindings/frb/lib/src/accounts/types.rsindex 44248abdd0,7655dc5115..2c9fc906a7--- a/rust/bindings/frb/lib/src/accounts/types.rs+++ b/rust/bindings/frb/lib/src/accounts/types.rs@@@ -7,18 -11,48 +11,50 @@@ use flutter_rust_bridge::frb#[frb(non_opaque)]pub enum AccountsError {+ NotRegistered,+ AlreadyRegistered,+ SignupIncomplete,+ EmailAlreadyInUse,+ SrpNotConfigured,+ IncorrectPassword,IncorrectRecoveryKey,+ MalformedRecoveryKey,+ IncorrectEmailCode,+ EmailCodeExpired,+ EmailCodeRateLimited,+ IncorrectTotp,+ TotpRateLimited,SessionExpired,+ KeyDerivation,+ Network { timeout: bool },Other { message: String },}impl From<Error> for AccountsError {fn from(error: Error) -> Self {match error {+ Error::NotRegistered => Self::NotRegistered,+ Error::AlreadyRegistered => Self::AlreadyRegistered,+ Error::SignupIncomplete => Self::SignupIncomplete,+ Error::EmailAlreadyInUse => Self::EmailAlreadyInUse,+ Error::SrpNotConfigured => Self::SrpNotConfigured,+ Error::IncorrectPassword => Self::IncorrectPassword,Error::IncorrectRecoveryKey => Self::IncorrectRecoveryKey,+ Error::MalformedRecoveryKey => Self::MalformedRecoveryKey,- Error::Http(ref http) if http.status_code() == Some(404) => Self::SessionExpired,+ Error::IncorrectEmailVerificationCode => Self::IncorrectEmailCode,+ Error::EmailVerificationCodeExpired => Self::EmailCodeExpired,+ Error::EmailVerificationRateLimited => Self::EmailCodeRateLimited,+ Error::IncorrectTotp => Self::IncorrectTotp,+ Error::TotpRateLimited => Self::TotpRateLimited,+ Error::SecondFactorSessionExpired => Self::SessionExpired,+ Error::InsufficientMemory+ | Error::Crypto(ente_core::crypto::Error::KeyDerivationFailed)+ | Error::Crypto(ente_core::crypto::Error::InvalidKeyDerivationParams(_)) => {+ Self::KeyDerivation+ }+ Error::Http(ref error) if error.is_connect() || error.is_timeout() => Self::Network {+ timeout: error.is_timeout(),+ },_ => Self::Other {message: ente_core::error::chain(&error),},diff --cc rust/bindings/wasm/lib/src/accounts.rsindex 76629c8285,09c0b49d51..cdf34fc032--- a/rust/bindings/wasm/lib/src/accounts.rs+++ b/rust/bindings/wasm/lib/src/accounts.rs@@@ -20,17 -16,27 +16,28 @@@ pub enum Errorimpl Error {fn name(&self) -> Option<&'static str> {- match self {- Self::Accounts(ente_accounts::Error::InsufficientMemory) => Some("insufficient_memory"),- Self::Accounts(ente_accounts::Error::IncorrectRecoveryKey) => {- Some("incorrect_recovery_key")- }- Self::Accounts(ente_accounts::Error::MalformedRecoveryKey) => {- Some("malformed_recovery_key")- }- Self::Accounts(ente_accounts::Error::Http(http)) if http.status_code() == Some(404) => {- Some("session_expired")- }+ use ente_accounts::Error;+ let Self::Accounts(error) = self else {+ return None;+ };+ match error {+ Error::InsufficientMemory => Some("insufficient_memory"),+ Error::IncorrectRecoveryKey => Some("incorrect_recovery_key"),++ Error::MalformedRecoveryKey => Some("malformed_recovery_key"),+ Error::IncorrectPassword => Some("incorrect_password"),+ Error::NotRegistered => Some("not_registered"),+ Error::AlreadyRegistered => Some("already_registered"),+ Error::SignupIncomplete => Some("signup_incomplete"),+ Error::EmailAlreadyInUse => Some("email_already_in_use"),+ Error::SrpNotConfigured => Some("srp_not_configured"),+ Error::IncorrectEmailVerificationCode => Some("incorrect_email_code"),+ Error::EmailVerificationCodeExpired => Some("email_code_expired"),+ Error::EmailVerificationRateLimited => Some("email_code_rate_limited"),+ Error::IncorrectTotp => Some("incorrect_totp"),+ Error::TotpRateLimited => Some("totp_rate_limited"),+ Error::SessionInvalid => Some("session_invalid"),+ Error::SecondFactorSessionExpired => Some("session_expired"),+ Error::TwoFactorRecoveryNotConfigured => Some("two_factor_recovery_not_configured"),_ => None,}}