diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-04-05 02:53:59 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-04-05 02:53:59 -0400 |
commit | 4ad2f0a0dc3abb4cb10a6b82ca6a1f3a829eb1fb (patch) | |
tree | 7daaf7d6d79ab4e11efec32ed2e3d27d269a567f | |
parent | cd894c27e0b0d5746b95b9c2933da3ba6e9a3f5b (diff) | |
download | rbw-4ad2f0a0dc3abb4cb10a6b82ca6a1f3a829eb1fb.tar.gz rbw-4ad2f0a0dc3abb4cb10a6b82ca6a1f3a829eb1fb.zip |
rename
-rw-r--r-- | src/cipherstring.rs (renamed from src/secret.rs) | 4 | ||||
-rw-r--r-- | src/main.rs | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/secret.rs b/src/cipherstring.rs index 9f896c7..75edec4 100644 --- a/src/secret.rs +++ b/src/cipherstring.rs @@ -3,14 +3,14 @@ use crate::prelude::*; use block_modes::BlockMode as _; use hmac::Mac as _; -pub struct Secret { +pub struct CipherString { ty: u8, iv: Vec<u8>, ciphertext: Vec<u8>, mac: Option<Vec<u8>>, } -impl Secret { +impl CipherString { pub fn new(s: &str) -> Result<Self> { let parts: Vec<&str> = s.split('.').collect(); if parts.len() != 2 { diff --git a/src/main.rs b/src/main.rs index fd57794..171bb6f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,8 @@ mod api; +mod cipherstring; mod error; mod identity; mod prelude; -mod secret; fn main() { let client = api::Client::new_self_hosted("https://bitwarden.tozt.net"); @@ -18,7 +18,8 @@ fn main() { .login(&identity.email, &identity.master_password_hash) .unwrap(); - let protected_key = secret::Secret::new(&protected_key).unwrap(); + let protected_key = + cipherstring::CipherString::new(&protected_key).unwrap(); let master_key = protected_key .decrypt(&identity.enc_key, &identity.mac_key) .unwrap(); @@ -28,13 +29,14 @@ fn main() { let ciphers = client.sync(&access_token).unwrap(); for cipher in ciphers { - let secret_name = secret::Secret::new(&cipher.name).unwrap(); + let secret_name = + cipherstring::CipherString::new(&cipher.name).unwrap(); let name = secret_name.decrypt(enc_key, mac_key).unwrap(); let secret_username = - secret::Secret::new(&cipher.login.username).unwrap(); + cipherstring::CipherString::new(&cipher.login.username).unwrap(); let username = secret_username.decrypt(enc_key, mac_key).unwrap(); let secret_password = - secret::Secret::new(&cipher.login.password).unwrap(); + cipherstring::CipherString::new(&cipher.login.password).unwrap(); let password = secret_password.decrypt(enc_key, mac_key).unwrap(); println!("{}:", String::from_utf8(name).unwrap()); println!(" Username: {}", String::from_utf8(username).unwrap()); |