Browse Source
Add UserDecryptionOptions on /sync too
pull/6574/head
Daniel García
3 weeks ago
No known key found for this signature in database
GPG Key ID: FC8A7D14C3CD543A
2 changed files with
25 additions and
4 deletions
-
src/api/core/ciphers.rs
-
src/api/core/mod.rs
|
|
|
@ -159,7 +159,25 @@ async fn sync(data: SyncData, headers: Headers, client_version: Option<ClientVer |
|
|
|
let domains_json = if data.exclude_domains { |
|
|
|
Value::Null |
|
|
|
} else { |
|
|
|
api::core::_get_eq_domains(headers, true).into_inner() |
|
|
|
api::core::_get_eq_domains(&headers, true).into_inner() |
|
|
|
}; |
|
|
|
|
|
|
|
// This is very similar to the the userDecryptionOptions sent in connect/token,
|
|
|
|
// but as of 2025-12-19 they're both using different casing conventions.
|
|
|
|
let has_master_password = !headers.user.password_hash.is_empty(); |
|
|
|
let master_password_unlock = if has_master_password { |
|
|
|
json!({ |
|
|
|
"kdf": { |
|
|
|
"kdfType": headers.user.client_kdf_type, |
|
|
|
"iterations": headers.user.client_kdf_iter, |
|
|
|
"memory": headers.user.client_kdf_memory, |
|
|
|
"parallelism": headers.user.client_kdf_parallelism |
|
|
|
}, |
|
|
|
"masterKeyEncryptedUserKey": headers.user.akey, |
|
|
|
"salt": headers.user.email |
|
|
|
}) |
|
|
|
} else { |
|
|
|
Value::Null |
|
|
|
}; |
|
|
|
|
|
|
|
Ok(Json(json!({ |
|
|
|
@ -170,6 +188,9 @@ async fn sync(data: SyncData, headers: Headers, client_version: Option<ClientVer |
|
|
|
"ciphers": ciphers_json, |
|
|
|
"domains": domains_json, |
|
|
|
"sends": sends_json, |
|
|
|
"userDecryption": { |
|
|
|
"masterPasswordUnlock": master_password_unlock, |
|
|
|
}, |
|
|
|
"object": "sync" |
|
|
|
}))) |
|
|
|
} |
|
|
|
|
|
|
|
@ -74,11 +74,11 @@ const GLOBAL_DOMAINS: &str = include_str!("../../static/global_domains.json"); |
|
|
|
|
|
|
|
#[get("/settings/domains")] |
|
|
|
fn get_eq_domains(headers: Headers) -> Json<Value> { |
|
|
|
_get_eq_domains(headers, false) |
|
|
|
_get_eq_domains(&headers, false) |
|
|
|
} |
|
|
|
|
|
|
|
fn _get_eq_domains(headers: Headers, no_excluded: bool) -> Json<Value> { |
|
|
|
let user = headers.user; |
|
|
|
fn _get_eq_domains(headers: &Headers, no_excluded: bool) -> Json<Value> { |
|
|
|
let user = &headers.user; |
|
|
|
use serde_json::from_str; |
|
|
|
|
|
|
|
let equivalent_domains: Vec<Vec<String>> = from_str(&user.equivalent_domains).unwrap(); |
|
|
|
|