Added error check for domain name decryption.

This commit is contained in:
Revertron
2021-05-09 22:08:29 +02:00
parent 6da89bcf0d
commit 4d446829c4
+9 -2
View File
@@ -28,6 +28,8 @@ use std::cell::RefCell;
use self::ed25519_dalek::{Signer, PublicKey, Verifier, SecretKey};
use self::ed25519_dalek::ed25519::signature::Signature;
use rand_old::{CryptoRng, RngCore};
use ecies_ed25519::Error;
use std::alloc::Global;
#[derive(Debug)]
pub struct Keystore {
@@ -187,8 +189,13 @@ impl Keystore {
}
pub fn decrypt(&self, message: &[u8]) -> Bytes {
let decrypted = self.crypto_box.reveal(message).unwrap();
Bytes::from_bytes(&decrypted)
match self.crypto_box.reveal(message) {
Ok(decrypted) => { Bytes::from_bytes(&decrypted) }
Err(_) => {
warn!("Decryption failed");
Bytes::default()
}
}
}
}