Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ target/
venv/
__pycache__
.pytest_cache
.idea/**
.idea/**
.DS_Store
42 changes: 36 additions & 6 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ hmac = "0.12.1"
sha1 = "0.10.6"
sha2 = "0.10.8"
chacha20poly1305 = "0.10.1"
getrandom = "0.2.15"
getrandom = "0.3.1"
rust-argon2 = "2.1.0"
scrypt = "0.11.0"
aes-gcm = "0.10.3"
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/cryptography.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn argon_derive_key(password_bytes: &[u8], salt: &[u8]) -> color_eyre::Resul

pub fn gen_salt() -> color_eyre::Result<[u8; ARGON2ID_SALT_LENGTH]> {
let mut salt: [u8; ARGON2ID_SALT_LENGTH] = [0; ARGON2ID_SALT_LENGTH];
getrandom::getrandom(&mut salt).map_err(ErrReport::from)?;
getrandom::fill(&mut salt).map_err(|e| eyre!(e))?;
Ok(salt)
}

Expand All @@ -41,7 +41,7 @@ pub fn encrypt_string_with_key(
let mut nonce_bytes: [u8; XCHACHA20_POLY1305_NONCE_LENGTH] =
[0; XCHACHA20_POLY1305_NONCE_LENGTH];

getrandom::getrandom(&mut nonce_bytes).map_err(ErrReport::from)?;
getrandom::fill(&mut nonce_bytes).map_err(|e| eyre!(e))?;

let nonce = XNonce::from_slice(&nonce_bytes);
let cipher_text = aead
Expand Down
10 changes: 6 additions & 4 deletions src/interface/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,12 @@ impl<'a> App<'a> {
)
.highlight_symbol("-> ");

let selected_element = match self.table.state.selected() {
Some(index) => self.database.get_element(index),
None => None,
};
let selected_element = self
.table
.state
.selected()
.and_then(|i| self.database.get_element(i));

let mut text = if let Some(element) = selected_element {
format!(
"
Expand Down