mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-20 18:13:49 +01:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0488ccd5f6 | ||
|
|
62d16e03cf | ||
|
|
c92f78b5c8 | ||
|
|
b034e1d4e3 | ||
|
|
43b76d4791 |
No files matched your search
Generated
+4
-6
@@ -3934,8 +3934,6 @@ dependencies = [
|
||||
"dbus-secret-service",
|
||||
"dbus-secret-service-keyring-store",
|
||||
"keyring-core",
|
||||
"proton-sdk",
|
||||
"serde_json",
|
||||
"thiserror 2.0.21",
|
||||
"tracing",
|
||||
"windows-native-keyring-store",
|
||||
@@ -3954,9 +3952,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proton-drive-rs"
|
||||
version = "0.12.1"
|
||||
version = "0.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d05ad4be849ce2104759631063dd06867fbe6b6f0e5c37a172a84b5a90203fa7"
|
||||
checksum = "bdeb7ee7495bc34198c78d7ec569f6371ad01a88f188b5eee418b013b082626a"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"base64 0.23.1",
|
||||
@@ -4061,9 +4059,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proton-sdk"
|
||||
version = "0.12.1"
|
||||
version = "0.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80c381e9066c0bca3c32597df2e902eecaa4c6e05e202e70ec9d0ac2eec78bfe"
|
||||
checksum = "3189873dcdf0bc0a3d0fa5619cea80594085252d1d66a57459ec6adfd1f35ac1"
|
||||
dependencies = [
|
||||
"aes-gcm 0.11.1",
|
||||
"async-trait",
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@ keywords = ["proton", "drive", "fuse", "sync", "linux"]
|
||||
categories = ["filesystem", "command-line-utilities"]
|
||||
|
||||
[workspace.dependencies]
|
||||
proton-sdk = { version = "0.12.1" }
|
||||
proton-drive-rs = { version = "0.12.1" }
|
||||
proton-sdk = { version = "0.12.2" }
|
||||
proton-drive-rs = { version = "0.12.2" }
|
||||
proton-gallery-app-rs = "0.1.0"
|
||||
proton-gallery-rs = "0.1.1"
|
||||
chrono = { version = "0.4", default-features = false, features = ["std"] }
|
||||
|
||||
@@ -25,7 +25,7 @@ shell-words.workspace = true
|
||||
sha2.workspace = true
|
||||
rusqlite.workspace = true
|
||||
keyring-core.workspace = true
|
||||
proton-auth-rs = { workspace = true, features = ["keyring", "session"] }
|
||||
proton-auth-rs = { workspace = true, features = ["keyring"] }
|
||||
proton-base-rs.workspace = true
|
||||
dbus-secret-service-keyring-store.workspace = true
|
||||
dbus-secret-service.workspace = true
|
||||
|
||||
@@ -28,7 +28,6 @@ use std::time::Duration;
|
||||
use base64::Engine as _;
|
||||
use base64::engine::general_purpose::STANDARD as BASE64;
|
||||
use keyring_core::Entry;
|
||||
use proton_auth_rs::session::{self, SignInError, Step};
|
||||
use proton_auth_rs::{KeyringStore, SecretStore};
|
||||
use proton_drive_rs::{KeySalt, ProtonDriveClient};
|
||||
use proton_sdk::account::KeyPassphrases;
|
||||
@@ -37,6 +36,7 @@ use proton_sdk::cache::EncryptedCacheRepository;
|
||||
use proton_sdk::config::ProtonClientConfiguration;
|
||||
use proton_sdk::error::ProtonError;
|
||||
use proton_sdk::http::Tokens;
|
||||
use proton_sdk::login::{self, LoginError, Step};
|
||||
use proton_sdk::session::{PasswordMode, ProtonApiSession, ResumeParameters};
|
||||
use proton_sdk::telemetry::TracingTelemetry;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -280,12 +280,12 @@ pub async fn login_verified(
|
||||
get_totp: impl Fn() -> Result<String>,
|
||||
get_mailbox: impl Fn(u32) -> Result<Mailbox>,
|
||||
) -> Result<()> {
|
||||
// The sequence is `proton_auth_rs::session`, shared with the other Proton
|
||||
// The sequence is `proton_sdk::login`, shared with the other Proton
|
||||
// apps. It reads the key salts before unlocking, while this access token
|
||||
// still has the `locked` scope: after its first refresh it never will
|
||||
// again, and without them no later resume can unlock the key chain. See
|
||||
// `StoredSession::key_salts`.
|
||||
let mut step = session::begin(client_config(), username, password, verification)
|
||||
let mut step = login::begin(client_config(), username, password, verification)
|
||||
.await
|
||||
.map_err(sign_in_error)?;
|
||||
let (unlocked, remember) = loop {
|
||||
@@ -305,9 +305,7 @@ pub async fn login_verified(
|
||||
let mailbox = get_mailbox(attempt)?;
|
||||
match pending.mailbox_password(&mailbox.password).await {
|
||||
Ok(unlocked) => break (unlocked, mailbox.remember),
|
||||
Err(SignInError::WrongMailboxPassword)
|
||||
if attempt + 1 < MAILBOX_ATTEMPTS =>
|
||||
{
|
||||
Err(LoginError::WrongMailboxPassword) if attempt + 1 < MAILBOX_ATTEMPTS => {
|
||||
attempt += 1;
|
||||
}
|
||||
Err(e) => return Err(sign_in_error(e)),
|
||||
@@ -317,16 +315,16 @@ pub async fn login_verified(
|
||||
};
|
||||
};
|
||||
|
||||
let tokens = unlocked.tokens().await;
|
||||
let tokens = unlocked.resume_parameters().await;
|
||||
register_refresh_handler(&unlocked.session, tokens.refresh_token.clone());
|
||||
let stored = StoredSession {
|
||||
session_id: tokens.session_id,
|
||||
session_id: tokens.session_id.as_str().to_owned(),
|
||||
username: tokens.username,
|
||||
user_id: tokens.user_id,
|
||||
user_id: tokens.user_id.as_str().to_owned(),
|
||||
access_token: tokens.access_token,
|
||||
refresh_token: tokens.refresh_token,
|
||||
scopes: tokens.scopes,
|
||||
password_mode: session::password_mode_to_wire(tokens.password_mode),
|
||||
password_mode: tokens.password_mode.to_wire() as u8,
|
||||
mailbox_password: String::new(),
|
||||
key_salts: unlocked.key_salts,
|
||||
key_passphrases: None,
|
||||
@@ -412,15 +410,15 @@ fn decode_secret(secret: &[u8]) -> Option<KeyPassphrases> {
|
||||
/// names a solvable method is a [`Error::HumanVerificationRequired`]: one that
|
||||
/// offers only `email`/`sms` stays a plain API error, because sending the UI to
|
||||
/// open a page it cannot complete reads as a hang rather than a refusal.
|
||||
fn sign_in_error(e: SignInError) -> Error {
|
||||
fn sign_in_error(e: LoginError) -> Error {
|
||||
match e {
|
||||
SignInError::HumanVerification(hv) => Error::HumanVerificationRequired(hv),
|
||||
SignInError::SecurityKeyOnly => Error::SecurityKeyOnly,
|
||||
SignInError::Blocked(api) | SignInError::Rejected(api) | SignInError::WrongCode(api) => {
|
||||
LoginError::HumanVerification(hv) => Error::HumanVerificationRequired(hv),
|
||||
LoginError::SecurityKeyOnly => Error::SecurityKeyOnly,
|
||||
LoginError::Blocked(api) | LoginError::Rejected(api) | LoginError::WrongCode(api) => {
|
||||
Error::Proton(ProtonError::Api(api))
|
||||
}
|
||||
SignInError::WrongMailboxPassword => Error::WrongMailboxPassword,
|
||||
SignInError::Proton(e) => e.into(),
|
||||
LoginError::WrongMailboxPassword => Error::WrongMailboxPassword,
|
||||
LoginError::Proton(e) => e.into(),
|
||||
other => Error::Other(other.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ scratch (user data in `staging/` and `recovery/` is never touched by this).
|
||||
|
||||
### Changed
|
||||
|
||||
- Signing in runs through `proton_auth_rs::session`, the sequence Proton Gallery and
|
||||
Proton Stream use too. The stored session, the lock/unlock choice for two-password
|
||||
- Signing in runs through `proton_sdk::login` (proton-sdk 0.12.2), the sequence Proton
|
||||
Gallery and Proton Stream use too. The stored session, the lock/unlock choice for two-password
|
||||
accounts, the three mailbox-password tries and the messages stay as they were.
|
||||
- An account whose only second factor is a security key now gets a clear message at
|
||||
sign-in instead of a code prompt that could only fail.
|
||||
|
||||
+587
-460
File diff suppressed because it is too large.
Load diff
+577
-451
File diff suppressed because it is too large.
Load diff
+582
-455
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user