aboutsummaryrefslogtreecommitdiffstats
path: root/src/api.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-05-03 01:07:58 -0400
committerJesse Luehrs <doy@tozt.net>2020-05-03 01:07:58 -0400
commite28b23f713fda315d28aaf6a375a720aae166f78 (patch)
tree4e4d833a234a06e1c3efbd21030a8ac9984a2ae0 /src/api.rs
parent047550f2368d134c9d5dca60aeb0b56fe151a323 (diff)
downloadrbw-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.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/api.rs b/src/api.rs
index 768b005..41ed7be 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -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)