cml_crypto_wasm/
emip3.rs

1use wasm_bindgen::prelude::{wasm_bindgen, JsError};
2
3/// Encrypt using Emip3: https://github.com/Emurgo/EmIPs/blob/master/specs/emip-003.md
4#[wasm_bindgen]
5pub fn emip3_encrypt_with_password(
6    password: &str,
7    salt: &str,
8    nonce: &str,
9    data: &str,
10) -> Result<String, JsError> {
11    cml_crypto::emip3::emip3_encrypt_with_password(password, salt, nonce, data).map_err(Into::into)
12}
13
14/// Decrypt using Emip3: https://github.com/Emurgo/EmIPs/blob/master/specs/emip-003.md
15#[wasm_bindgen]
16pub fn emip3_decrypt_with_password(password: &str, data: &str) -> Result<String, JsError> {
17    cml_crypto::emip3::emip3_decrypt_with_password(password, data).map_err(Into::into)
18}