修改打包脚本, 完成后复制相关文件至web项目

This commit is contained in:
CounterFire2023 2023-09-22 16:27:47 +08:00
parent 5e4f502b37
commit 6fccde5494
2 changed files with 20 additions and 1 deletions

View File

@ -1,2 +1,7 @@
AR=/opt/homebrew/opt/llvm/bin/llvm-ar CC=/opt/homebrew/opt/llvm/bin/clang wasm-pack build --target web --release
# AR=/opt/homebrew/opt/llvm/bin/llvm-ar CC=/opt/homebrew/opt/llvm/bin/clang wasm-pack build --target nodejs --release
# AR=/opt/homebrew/opt/llvm/bin/llvm-ar CC=/opt/homebrew/opt/llvm/bin/clang wasm-pack build --target nodejs --release
cp pkg/rustwallet_bg.wasm ~/Documents/workspace/crypto/web-wallet/assets/wasm/rustwallet_bg.wasm
cp pkg/rustwallet.js ~/Documents/workspace/crypto/web-wallet/assets/wasm/rustwallet.js
cp pkg/rustwallet.d.ts ~/Documents/workspace/crypto/web-wallet/assets/wasm/rustwallet.d.ts
cp pkg/rustwallet_bg.wasm.d.ts ~/Documents/workspace/crypto/web-wallet/assets/wasm/rustwallet_bg.wasm.d.ts

View File

@ -226,6 +226,20 @@ pub fn wdecrypt(
r
}
#[wasm_bindgen]
pub fn encrypt_content(content: String, key: String) -> String {
let pass = key + "0x741482aE1480E552735E44Ff3A733448AcBbeD8d";
let pass = utils::crypto_utils::keccak256_hash(&pass);
let msg_hex = utils::crypto_utils::aes_encrypt(&content, &pass);
msg_hex
}
#[wasm_bindgen]
pub fn decrypt_content(content: String, key: String) -> String {
let pass = key + "0x741482aE1480E552735E44Ff3A733448AcBbeD8d";
let pass = utils::crypto_utils::keccak256_hash(&pass);
let msg_hex = utils::crypto_utils::aes_decrypt(&content, &pass);
msg_hex
}
#[wasm_bindgen]
pub fn aes_encrypt(content: String, key: String) -> String {
let pass = utils::crypto_utils::keccak256_hash(&key);