-
Notifications
You must be signed in to change notification settings - Fork 58
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(sdk): Add WASI and synchronous validation for WASM32 #653
feat(sdk): Add WASI and synchronous validation for WASM32 #653
Conversation
sdk/Cargo.toml
Outdated
[target.'cfg(not(target_os = "wasi"))'.dependencies] | ||
chrono = { version = "0.4.38", default-features = false, features = [ | ||
"serde", | ||
"wasmbind", |
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 it makes more sense to add the wasmbind feature only when we are building for wasm.
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.
Yes. Makes sense.
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.
Done
@@ -631,7 +631,21 @@ pub(crate) fn verify_timestamp(ts: &[u8], data: &[u8]) -> Result<TstInfo> { | |||
validator.validate(&sig_val.to_bytes(), &tbs, &signing_key_der) | |||
} | |||
|
|||
#[cfg(not(feature = "openssl"))] |
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.
Can we still make a regular build without openssl? This needs to work with the c2pa-min repo.
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.
Yes. The build logic for native builds without openssl remains unchanged. I've only added a new section for synchronous calls to verify_timestamp
for wasm32. This mirrors the asynchronous logic.
certs: &[Vec<u8>], | ||
ee_der: &[u8], | ||
) -> Result<bool> { | ||
#[async_generic] |
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.
good to have these work async!
Synchronous web validation.
3b8fb7b
to
6d3b5b2
Compare
- wasip2 will require +nightly until rust-lang/rust#130323 is resolved and/or std::os::wasip2 is available in stable. - Support was added to rustix for version 0.38.39 bytecodealliance/rustix#1205 - Support was added to tempfile for version 3.14 Stebalien/tempfile#305
8ece89f
to
920b0a5
Compare
thiserror = "1.0.61" | ||
treeline = "0.1.0" | ||
url = "2.5.2" | ||
uuid = { version = "1.10.0", features = ["serde", "v4", "js"] } | ||
url = "2.5.3" |
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.
FYI we can't take the 2.5.3 version of url
until we've had Legal review a new license introduced by that version.
Superseded by feat: Wasm32 wasi 0.41.0 #888 |
Changes in this pull request
Add WASI (Wasm System Interface) as a build target.
Add synchronous validation for wasm crypto validation and trust handlers. For ECDSA, this means RustCrypto p256 and p284, for both wasi and web. P512 is not supported in the synchronous implementation.
Most changes are excluding WASI from tests, as wasm_bindgen does not support WASI.
TODO:
Checklist
TO DO
items (or similar) have been entered as GitHub issues and the link to that issue has been included in a comment.