-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix decoder tests and do rustfmt (#4)
* Update decoder tests to match new builder params * rustfmt all of the things * Provide more control over output location
- Loading branch information
Showing
16 changed files
with
330 additions
and
107 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,4 +57,4 @@ macro_rules! builder { | |
)* | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
use sodiumoxide::crypto::secretbox; | ||
|
||
use super::{ BufResult, errors, tarbox }; | ||
use super::{errors, tarbox, BufResult}; | ||
|
||
pub fn encrypt_buffer(buf: &Vec<u8>, secret: &tarbox::TarboxSecret) -> BufResult { | ||
Ok(secretbox::seal(buf.as_slice(), &secret.nonce(), &secret.key())) | ||
Ok(secretbox::seal( | ||
buf.as_slice(), | ||
&secret.nonce(), | ||
&secret.key(), | ||
)) | ||
} | ||
|
||
pub fn decrypt_buffer(buf: &Vec<u8>, secret: &tarbox::TarboxSecret) -> BufResult { | ||
secretbox::open(buf.as_slice(), &secret.nonce(), &secret.key()) | ||
.or_else(|_| { bail!(errors::ErrorKind::SecretBoxOpenFail) }) | ||
.or_else(|_| bail!(errors::ErrorKind::SecretBoxOpenFail)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,4 @@ error_chain! { | |
display("could not open secretbox"), | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.