Skip to content

Commit

Permalink
fix features
Browse files Browse the repository at this point in the history
  • Loading branch information
conradludgate committed Apr 22, 2022
1 parent 157dae1 commit 1f5faaf
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 22 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ atuin = { path = "/usr/bin/atuin" }
members = ["./atuin-client", "./atuin-server", "./atuin-common"]

[features]
# TODO(conradludgate)
# Currently, this keeps the same default built behaviour for v0.8
# We should rethink this by the time we hit a new breaking change
default = ["sync", "server"]
sync = ["atuin-client/sync"]
server = ["atuin-server"]
server = ["atuin-server", "tracing-subscriber"]

[dependencies]
atuin-server = { path = "atuin-server", version = "0.8.1", optional = true }
atuin-client = { path = "atuin-client", version = "0.8.1" }
atuin-client = { path = "atuin-client", version = "0.8.1", default-features = false }
atuin-common = { path = "atuin-common", version = "0.8.1" }

log = "0.4"
Expand All @@ -63,7 +66,6 @@ clap = { version = "3.1.11", features = ["derive"] }
clap_complete = "3.1.2"
fs-err = "2.7"


[dependencies.tracing-subscriber]
version = "0.3"
default-features = false
Expand All @@ -73,8 +75,4 @@ features = [
"registry",
"env-filter",
]

[profile.release]
lto = "fat"
codegen-units = 1
opt-level = 3
optional = true
22 changes: 16 additions & 6 deletions atuin-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ repository = "https://github.com/ellie/atuin"

[features]
default = ["sync"]
sync = ["urlencoding", "sodiumoxide", "reqwest"]
sync = [
"urlencoding",
"sodiumoxide",
"reqwest",
"rust-crypto",
"rmp-serde",
"base64",
]

[dependencies]
atuin-common = { path = "../atuin-common", version = "0.8.1" }
Expand All @@ -27,16 +34,12 @@ 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"
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"
itertools = "0.10.3"
shellexpand = "2"
sqlx = { version = "0.5", features = [
"runtime-tokio-rustls",
"uuid",
"chrono",
"sqlite",
Expand All @@ -45,9 +48,16 @@ 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"] }
6 changes: 3 additions & 3 deletions atuin-client/src/encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// to decrypt

use fs_err as fs;
use serde::{Deserialize, Serialize};
use serde::{Serialize, Deserialize};
use std::io::prelude::*;
use std::path::PathBuf;

Expand Down Expand Up @@ -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)
Expand All @@ -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)
}
Expand Down

0 comments on commit 1f5faaf

Please sign in to comment.