Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
rooooooooob committed Dec 5, 2023
1 parent 34cb797 commit b57223a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
9 changes: 2 additions & 7 deletions crypto/rust/src/emip3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use hex::ToHex;

use std::iter::repeat;


// taken from js-cardano-wasm

mod password_encryption_parameter {
Expand Down Expand Up @@ -64,7 +63,7 @@ pub fn emip3_encrypt_with_password(
return Err(EmIP3Error::NonceLen(NONCE_SIZE, nonce.len()));
}
if password.is_empty() {
return Err(EmIP3Error::EmptyPassword);
return Err(EmIP3Error::EmptyPassword);
}

let key = {
Expand All @@ -90,10 +89,7 @@ pub fn emip3_encrypt_with_password(
}

/// Decrypt using Emip3: https://github.com/Emurgo/EmIPs/blob/master/specs/emip-003.md
pub fn emip3_decrypt_with_password(
password: &str,
data: &str,
) -> Result<String, EmIP3Error> {
pub fn emip3_decrypt_with_password(password: &str, data: &str) -> Result<String, EmIP3Error> {
use password_encryption_parameter::*;
let password = hex::decode(password)?;
let data = hex::decode(data)?;
Expand Down Expand Up @@ -126,7 +122,6 @@ pub fn emip3_decrypt_with_password(
}
}


#[cfg(test)]
mod tests {
use super::*;
Expand Down
9 changes: 3 additions & 6 deletions crypto/wasm/src/emip3.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use wasm_bindgen::prelude::{JsError, wasm_bindgen};
use wasm_bindgen::prelude::{wasm_bindgen, JsError};

/// Encrypt using Emip3: https://github.com/Emurgo/EmIPs/blob/master/specs/emip-003.md
#[wasm_bindgen]
Expand All @@ -13,9 +13,6 @@ pub fn emip3_encrypt_with_password(

/// Decrypt using Emip3: https://github.com/Emurgo/EmIPs/blob/master/specs/emip-003.md
#[wasm_bindgen]
pub fn emip3_decrypt_with_password(
password: &str,
data: &str,
) -> Result<String, JsError> {
pub fn emip3_decrypt_with_password(password: &str, data: &str) -> Result<String, JsError> {
cml_crypto::emip3::emip3_decrypt_with_password(password, data).map_err(Into::into)
}
}

0 comments on commit b57223a

Please sign in to comment.