summaryrefslogtreecommitdiffstats
path: root/atuin-client
diff options
context:
space:
mode:
Diffstat (limited to 'atuin-client')
-rw-r--r--atuin-client/Cargo.toml37
-rw-r--r--atuin-client/src/api_client.rs2
-rw-r--r--atuin-client/src/encryption.rs4
-rw-r--r--atuin-client/src/lib.rs8
4 files changed, 34 insertions, 17 deletions
diff --git a/atuin-client/Cargo.toml b/atuin-client/Cargo.toml
index 49ff933e..c3a567d8 100644
--- a/atuin-client/Cargo.toml
+++ b/atuin-client/Cargo.toml
@@ -10,6 +10,17 @@ repository = "https://github.com/ellie/atuin"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+[features]
+default = ["sync"]
+sync = [
+ "urlencoding",
+ "sodiumoxide",
+ "reqwest",
+ "rust-crypto",
+ "rmp-serde",
+ "base64",
+]
+
[dependencies]
atuin-common = { path = "../atuin-common", version = "0.8.1" }
@@ -23,20 +34,8 @@ chrono-english = "0.1.4"
config = "0.13"
serde = { version = "1.0.126", features = ["derive"] }
serde_json = "1.0.75"
-rmp-serde = "1.0.0"
-sodiumoxide = "0.2.6"
-reqwest = { version = "0.11", features = [
- "blocking",
- "json",
- "rustls-tls",
-], default-features = false }
-base64 = "0.13.0"
parse_duration = "2.1.1"
-rand = "0.8.4"
-rust-crypto = "^0.2"
-tokio = { version = "1", features = ["full"] }
async-trait = "0.1.49"
-urlencoding = "2.1.0"
itertools = "0.10.3"
shellexpand = "2"
sqlx = { version = "0.5", features = [
@@ -48,3 +47,17 @@ sqlx = { version = "0.5", features = [
minspan = "0.1.1"
regex = "1.5.4"
fs-err = "2.7"
+
+# sync
+urlencoding = { version = "2.1.0", optional = true }
+sodiumoxide = { version = "0.2.6", optional = true }
+reqwest = { version = "0.11", features = [
+ "json",
+ "rustls-tls",
+], default-features = false, optional = true }
+rust-crypto = { version = "^0.2", optional = true }
+rmp-serde = { version = "1.0.0", optional = true }
+base64 = { version = "0.13.0", optional = true }
+
+[dev-dependencies]
+tokio = { version = "1", features = ["full"] }
diff --git a/atuin-client/src/api_client.rs b/atuin-client/src/api_client.rs
index 171012ac..d907265b 100644
--- a/atuin-client/src/api_client.rs
+++ b/atuin-client/src/api_client.rs
@@ -38,7 +38,7 @@ pub async fn register(
map.insert("password", password);
let url = format!("{}/user/{}", address, username);
- let resp = reqwest::blocking::get(url)?;
+ let resp = reqwest::get(url).await?;
if resp.status().is_success() {
bail!("username already in use");
diff --git a/atuin-client/src/encryption.rs b/atuin-client/src/encryption.rs
index 4746c23e..f805cbd5 100644
--- a/atuin-client/src/encryption.rs
+++ b/atuin-client/src/encryption.rs
@@ -77,7 +77,7 @@ pub fn encode_key(key: secretbox::Key) -> Result<String> {
pub fn decode_key(key: String) -> Result<secretbox::Key> {
let buf = base64::decode(key).wrap_err("encryption key is not a valid base64 encoding")?;
- let buf: secretbox::Key = rmp_serde::from_read_ref(&buf)
+ let buf: secretbox::Key = rmp_serde::from_slice(&buf)
.wrap_err("encryption key is not a valid message pack encoding")?;
Ok(buf)
@@ -98,7 +98,7 @@ pub fn decrypt(encrypted_history: &EncryptedHistory, key: &secretbox::Key) -> Re
let plaintext = secretbox::open(&encrypted_history.ciphertext, &encrypted_history.nonce, key)
.map_err(|_| eyre!("failed to open secretbox - invalid key?"))?;
- let history = rmp_serde::from_read_ref(&plaintext)?;
+ let history = rmp_serde::from_slice(&plaintext)?;
Ok(history)
}
diff --git a/atuin-client/src/lib.rs b/atuin-client/src/lib.rs
index 98e2f3ae..497c5e74 100644
--- a/atuin-client/src/lib.rs
+++ b/atuin-client/src/lib.rs
@@ -3,11 +3,15 @@
#[macro_use]
extern crate log;
+#[cfg(feature = "sync")]
pub mod api_client;
-pub mod database;
+#[cfg(feature = "sync")]
pub mod encryption;
+#[cfg(feature = "sync")]
+pub mod sync;
+
+pub mod database;
pub mod history;
pub mod import;
pub mod ordering;
pub mod settings;
-pub mod sync;