breez_sdk_core/
crypt.rs

1use anyhow::{anyhow, Result};
2
3pub fn encrypt(key: Vec<u8>, msg: Vec<u8>) -> Result<Vec<u8>> {
4    match ecies::encrypt(key.as_slice(), msg.as_slice()) {
5        Ok(res) => Ok(res),
6        Err(err) => Err(anyhow!(err.to_string())),
7    }
8}
9
10#[allow(dead_code)]
11pub fn decrypt(key: Vec<u8>, msg: Vec<u8>) -> Result<Vec<u8>> {
12    match ecies::decrypt(key.as_slice(), msg.as_slice()) {
13        Ok(res) => Ok(res),
14        Err(err) => Err(anyhow!(err.to_string())),
15    }
16}