Skip to content

Commit 3aba612

Browse files
committed
fix PR feedback #1
1 parent ead2c25 commit 3aba612

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/util/storable_builder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ impl StorableBuilder {
2121

2222
let mut data_blob = PlaintextBlob { value: input, version }.encode_to_vec();
2323

24-
let mut cipher = ChaCha20Poly1305::new(&self.data_encryption_key, &nonce, &vec![]);
24+
let mut cipher = ChaCha20Poly1305::new(&self.data_encryption_key, &nonce, &[]);
2525
let mut tag = [0u8; 16];
2626
cipher.encrypt_inplace(&mut data_blob, &mut tag);
2727
Storable {
2828
data: data_blob,
29-
encryption_metadata: Option::from(EncryptionMetadata {
29+
encryption_metadata: Some(EncryptionMetadata {
3030
nonce: nonce.to_vec(),
3131
tag: tag.to_vec(),
3232
cipher_format: CHACHA20_CIPHER_NAME.to_string(),
@@ -36,11 +36,11 @@ impl StorableBuilder {
3636

3737
pub fn deconstruct(&self, mut storable: Storable) -> io::Result<(Vec<u8>, i64)> {
3838
let encryption_metadata = storable.encryption_metadata.unwrap();
39-
let mut cipher = ChaCha20Poly1305::new(&self.data_encryption_key, &encryption_metadata.nonce, &vec![]);
39+
let mut cipher = ChaCha20Poly1305::new(&self.data_encryption_key, &encryption_metadata.nonce, &[]);
4040
let input_output = storable.data.as_mut();
4141

4242
if cipher.decrypt_inplace(input_output, encryption_metadata.tag.borrow()) {
43-
let data_blob = PlaintextBlob::decode(&*input_output).map_err(|e| Error::new(ErrorKind::InvalidData, e))?;
43+
let data_blob = PlaintextBlob::decode(&input_output[..]).map_err(|e| Error::new(ErrorKind::InvalidData, e))?;
4444
Ok((data_blob.value, data_blob.version))
4545
} else {
4646
Err(Error::new(ErrorKind::InvalidData, "Invalid Tag"))

0 commit comments

Comments
 (0)