mirror of https://github.com/dswd/zvault
Check for private key when encryption is set
This commit is contained in:
parent
a02a0a7c7f
commit
289a412a12
1
TODO.md
1
TODO.md
|
@ -12,7 +12,6 @@
|
|||
|
||||
## Usability
|
||||
* Verbosity control
|
||||
* Check for private key when encryption is set
|
||||
* Display backup name and path on backup integrity error
|
||||
* Better control over what is checked in `check` subcommand
|
||||
* Nice error when remote storage is not mounted
|
||||
|
|
|
@ -167,6 +167,9 @@ impl Repository {
|
|||
#[inline]
|
||||
pub fn set_encryption(&mut self, public: Option<&PublicKey>) {
|
||||
if let Some(key) = public {
|
||||
if !self.crypto.lock().unwrap().contains_secret_key(key) {
|
||||
warn!("The secret key for that public key is not stored in the repository.")
|
||||
}
|
||||
let mut key_bytes = Vec::new();
|
||||
key_bytes.extend_from_slice(&key[..]);
|
||||
self.config.encryption = Some((EncryptionMethod::Sodium, key_bytes.into()))
|
||||
|
|
Loading…
Reference in New Issue