-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44aeded
commit 8154994
Showing
6 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "ffi_wasm_web_equlity" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
[lib] | ||
name = "ffi_wasm_equality" | ||
crate-type = ["rlib", "cdylib"] | ||
|
||
[dependencies] | ||
wasm-bindgen = "0.2" | ||
hex = "0.4.2" | ||
wedpr_bls12_381 = { path = "../../../crypto/pairing/bls12_381" } | ||
getrandom = { version = "0.2", features = ["js"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use wasm_bindgen::prelude::*; | ||
extern crate wedpr_bls12_381; | ||
|
||
|
||
#[wasm_bindgen] | ||
pub fn encrypt_message(message: &str) -> String { | ||
let message_bytes = match hex::decode(message) { | ||
Ok(v) => v, | ||
Err(_) => return "".to_string(), | ||
}; | ||
let result = wedpr_bls12_381::encrypt_message(&message_bytes); | ||
hex::encode(result.to_bytes()) | ||
} |