diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-05-03 01:07:58 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-05-03 01:07:58 -0400 |
commit | e28b23f713fda315d28aaf6a375a720aae166f78 (patch) | |
tree | 4e4d833a234a06e1c3efbd21030a8ac9984a2ae0 /src/api.rs | |
parent | 047550f2368d134c9d5dca60aeb0b56fe151a323 (diff) | |
download | rbw-e28b23f713fda315d28aaf6a375a720aae166f78.tar.gz rbw-e28b23f713fda315d28aaf6a375a720aae166f78.zip |
save the private key to the local db
Diffstat (limited to 'src/api.rs')
-rw-r--r-- | src/api.rs | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -146,6 +146,8 @@ impl SyncResCipher { struct SyncResProfile { #[serde(rename = "Key")] key: String, + #[serde(rename = "PrivateKey")] + private_key: String, } #[derive(serde::Deserialize, Debug, Clone)] @@ -319,7 +321,7 @@ impl Client { pub async fn sync( &self, access_token: &str, - ) -> Result<(String, Vec<crate::db::Entry>)> { + ) -> Result<(String, String, Vec<crate::db::Entry>)> { let client = reqwest::Client::new(); let res = client .get(&self.api_url("/sync")) @@ -337,7 +339,11 @@ impl Client { .iter() .filter_map(|cipher| cipher.to_entry(&folders)) .collect(); - Ok((sync_res.profile.key, ciphers)) + Ok(( + sync_res.profile.key, + sync_res.profile.private_key, + ciphers, + )) } reqwest::StatusCode::UNAUTHORIZED => { Err(Error::RequestUnauthorized) |