Fix cargo clippy issue
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -1,12 +1,10 @@
|
|||||||
use std::error::Error;
|
|
||||||
use std::io::ErrorKind;
|
|
||||||
|
|
||||||
use aes_gcm::aead::{Aead, OsRng};
|
use aes_gcm::aead::{Aead, OsRng};
|
||||||
use aes_gcm::{Aes256Gcm, Key, KeyInit, Nonce};
|
use aes_gcm::{Aes256Gcm, Key, KeyInit, Nonce};
|
||||||
use base64::engine::general_purpose::STANDARD as BASE64_STANDARD;
|
use base64::engine::general_purpose::STANDARD as BASE64_STANDARD;
|
||||||
use base64::Engine as _;
|
use base64::Engine as _;
|
||||||
use bincode::{Decode, Encode};
|
use bincode::{Decode, Encode};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
use std::error::Error;
|
||||||
|
|
||||||
/// The lenght of the nonce used to initialize encryption
|
/// The lenght of the nonce used to initialize encryption
|
||||||
const NONCE_LEN: usize = 12;
|
const NONCE_LEN: usize = 12;
|
||||||
@ -45,8 +43,7 @@ impl CryptoWrapper {
|
|||||||
let bytes = BASE64_STANDARD.decode(input)?;
|
let bytes = BASE64_STANDARD.decode(input)?;
|
||||||
|
|
||||||
if bytes.len() < NONCE_LEN {
|
if bytes.len() < NONCE_LEN {
|
||||||
return Err(Box::new(std::io::Error::new(
|
return Err(Box::new(std::io::Error::other(
|
||||||
ErrorKind::Other,
|
|
||||||
"Input string is smaller than nonce!",
|
"Input string is smaller than nonce!",
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
@ -60,8 +57,7 @@ impl CryptoWrapper {
|
|||||||
Ok(d) => d,
|
Ok(d) => d,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::error!("Failed to decrypt wrapped data! {:#?}", e);
|
log::error!("Failed to decrypt wrapped data! {:#?}", e);
|
||||||
return Err(Box::new(std::io::Error::new(
|
return Err(Box::new(std::io::Error::other(
|
||||||
ErrorKind::Other,
|
|
||||||
"Failed to decrypt wrapped data!",
|
"Failed to decrypt wrapped data!",
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user