-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: node crypto module #92
Conversation
.github/workflows/examples.yml
Outdated
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- -e all --version=$VERSION --tf-version=$VERSION --tf-deps-version=$VERSION --tf-tools-version=$VERSION --image-version=$VERSION --image-deps-version=$VERSION -p /usr/local | ||
VERSION=0.11.2 | ||
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- -e all --version=$VERSION --tf-version=$VERSION --tf-deps-version=$VERSION --tf-tools-version=$VERSION --image-version=$VERSION --image-deps-version=$VERSION -p /usr/local | ||
curl -sLO https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-plugin-wasi_crypto-0.11.2-manylinux2014_x86_64.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this workflows is run on ubuntu-20.04, so we should use WasmEdge-plugin-wasi_crypto-0.11.2-ubuntu20.04_x86_64.tar.gz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like only wasmedge-tensorflow-lite didn't recognize the wasi_crypto plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasmedge-tensorflow-lite may have some bug. please add a feature that is about crypto, and close this feature in tensorflow test.
please sync #95 |
src/internal_module/crypto/mod.rs
Outdated
} | ||
|
||
fn finalizer(data: &mut Self::RefType, _event_loop: Option<&mut EventLoop>) { | ||
std::mem::drop(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will drop when this Box is drop.
https://github.com/L-jasmine/wasmedge-quickjs/blob/f31efaff7568cc92973a44ac5524031cdd981321/src/quickjs_sys/js_class.rs#L478
src/internal_module/crypto/mod.rs
Outdated
} | ||
|
||
fn finalizer(data: &mut Self::RefType, _event_loop: Option<&mut EventLoop>) { | ||
std::mem::drop(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before
src/internal_module/crypto/mod.rs
Outdated
} | ||
|
||
fn finalizer(data: &mut Self::RefType, _event_loop: Option<&mut EventLoop>) { | ||
std::mem::drop(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before
diffieHellman, | ||
DiffieHellmanGroup, | ||
ECDH, | ||
} from "./internal/crypto/diffiehellman";*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why comment this code when you have diffiehellman.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It hasn't implemented for wasi and tested. It's just copied from nodejs now.
@@ -248,6 +248,7 @@ function parseCode(code, offset) { | |||
} | |||
|
|||
function getErrMessage(message, fn) { | |||
return "assert.getErrMessage unsupported"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What support is missing for this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message format from quickjs is a little different from v8, this function can't get the correct result.
flows summarize |
Hello, I am a serverless review bot on flows.network. Here are my reviews of code commits in this PR. This extensive patch covers various components within the crypto modules and related files. It adds new tests, modifies several crypto class implementations, and addresses potential issues related to the update, final, and transform methods. The patch primarily focuses on introducing new features and functionalities, such as cryptography algorithms, FIPS support, PBKDF2, HKDF, scrypt hashing, and cipher/decipher support. Several potential problems across these patches include:
The most important findings include:
Recommendations on mitigating potential issues include reviewing test files individually, keeping track of dependencies, separating tests into smaller groups, and implementing additional test cases. DetailsCommit 1The given GitHub patch contains a large number of new test cases related to cryptography functionality in the codebase. The patch adds 62 new files with 12,504 insertions to the project, primarily focused on testing various cryptographic algorithms and features, such as AES, DH, ECDH, ECDSA, RSA, and more. Key changes:
Potential problems:
It is recommended to:
Commit 2This patch adds a new implementation for the FIPS (Federal Information Processing Standards) in the crypto module. The following changes were made:
Key changes:
Potential problems:
Some of the tests have been marked with Commit 3The patch contains changes to the crypto module, introducing new features and fixing existing issues. Here is the summary of key changes:
Potential problems:
Commit 4Summary of key changes:
Potential problems:
Commit 5This patch introduces a new feature, the implementation of PBKDF2 functionality, as well as several other miscellaneous updates. Key changes include:
Please note that there might be potential issues:
Overall, the patch provides support for PBKDF2 functionality in the crypto module. Commit 6This patch primarily focuses on the PBKDF2 functionality in the crypto module. Key changes:
Potential problems:
Commit 7This patch introduces the implementation of the scrypt hashing algorithm. The following are the key changes:
Potential problems:
Commit 8Summary of key changes:
Potential problems:
Commit 9This patch implements internal support for the HKDF (HMAC-based Key Derivation Function) algorithm. The developer has added new files for the hkdf implementation and the key object exporting/importing system. Key changes:
Here are some potential issues:
Commit 10This patch includes a set of changes in 11 files with a total of 4488 insertions and 435 deletions. The main purpose of this patch is to remove the dependency on the wasi-crypto-guest library from the project. Key changes:
Potential issues:
Overall, this patch removes an external dependency and re-implements cryptographic functions within the project. However, potential concerns should be addressed, such as the difference in performance and maintainability of the new implementation. Commit 11This GitHub patch introduces changes and additions to the internal crypto hashing functionality. Key changes:
Potential problems:
Overall, the patch adds new functionality for hashing and stream transformations, which might have some potential issues in error handling, performance, or compatibility. Commit 12The patch makes changes to the files related to the crypto module:
Key Findings:
Potential Problems:
Commit 13This patch implements cipheriv and decipheriv for the crypto module. Key changes include:
Potential problems:
It is important to ensure the error handling and functionality work as expected, especially with the mix of inheritance and function-based classes. Given the empty function bodies for key encryption/decryption methods, it is necessary to verify the correct behavior of the code prior to merging this pull request. Commit 14This patch includes changes related to the crypto-cipheriv-decipheriv test module. Key changes include:
Potential issues that may arise:
Commit 15This patch updates the GitHub Actions workflow file (examples.yml) to use the Ubuntu 20.04 version of the Key changes:
Potential problems or concerns:
Commit 16Summary of key changes:
Potential problems:
Commit 17This patch adds a new feature to enable the Node.js crypto module for the project. It introduces changes in 4 files:
Possible issues:
Other than these potential issues, the patch seems straightforward and enables a new feature to include the crypto module in the build process. Commit 18Summary of Key Changes:
Potential Problems: It is difficult to identify any potential problems without looking at the actual implementation of the new modules. However, here are some points of consideration:
Commit 19Summary: Key Changes:
Potential Problems:
Commit 20Key changes:
Potential problems:
Aside from the mentioned problems, the implementation seems satisfactory, and the test cases have been updated appropriately. |
What's it going to take to get this PR merged? |
tests/test-path.rs
Outdated
@@ -14,9 +14,6 @@ fn test_js_file(file_path: &str) { | |||
Ok(code) => { | |||
ctx.put_args(vec![file_path.clone()]); | |||
ctx.eval_module_str(code, &file_path); | |||
if let JsValue::Bool(false) = ctx.get_global().get("assertPass") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why delete these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I deleted it by mistake. I will put it back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this been completed?
@Puellaquae https://github.com/second-state/wasmedge-quickjs/actions/runs/7643352809/job/20825160000?pr=92#step:26:81 Actually, the tests for crypto probably did not run because an error was encountered, indicating that the plugin is not installed. Please install the WASI-Crypto plugin in the CI environment. You should be able to install it using a script. |
No description provided.