Trim whitespace from end of encryption key (#496)
This commit is contained in:
parent
0c5e250800
commit
2abac5d853
1 changed files with 2 additions and 1 deletions
|
@ -74,7 +74,8 @@ pub fn encode_key(key: secretbox::Key) -> Result<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decode_key(key: String) -> Result<secretbox::Key> {
|
pub fn decode_key(key: String) -> Result<secretbox::Key> {
|
||||||
let buf = base64::decode(key).wrap_err("encryption key is not a valid base64 encoding")?;
|
let buf =
|
||||||
|
base64::decode(key.trim_end()).wrap_err("encryption key is not a valid base64 encoding")?;
|
||||||
let buf: secretbox::Key = rmp_serde::from_slice(&buf)
|
let buf: secretbox::Key = rmp_serde::from_slice(&buf)
|
||||||
.wrap_err("encryption key is not a valid message pack encoding")?;
|
.wrap_err("encryption key is not a valid message pack encoding")?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue