mirror of
https://github.com/atuinsh/atuin.git
synced 2024-12-27 09:29:24 +01:00
Trim whitespace from end of encryption key (#496)
This commit is contained in:
parent
0c5e250800
commit
2abac5d853
@ -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 New Issue
Block a user