diff --git a/Cargo.toml b/Cargo.toml index 9561129c11..56a076aed5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ readme = "README.md" [features] default = ["full-native-tls", "cached-client", "tuf"] +wasm = ["getrandom/js"] full-native-tls = ["fulcio-native-tls", "rekor-native-tls", "cosign-native-tls", "mock-client-native-tls"] full-rustls-tls = ["fulcio-rustls-tls", "rekor-rustls-tls", "cosign-rustls-tls", "mock-client-rustls-tls"] @@ -28,7 +29,7 @@ oauth = [] rekor-native-tls = [ "reqwest/native-tls", "rekor"] rekor-rustls-tls = [ "reqwest/rustls-tls", "rekor" ] -rekor = ["dep:reqwest"] +rekor = ["reqwest"] tuf = [ "tough", "regex" ] @@ -64,7 +65,6 @@ lazy_static = "1.4.0" oci-distribution = { version = "0.9", default-features = false, optional = true } olpc-cjson = "0.1" openidconnect = { version = "2.3", default-features = false, features = [ "reqwest" ], optional = true} -getrandom = { version = "0.2.8", features = ["js"] } p256 = "0.12" p384 = "0.12" webbrowser = "0.8.4" @@ -73,6 +73,7 @@ picky = { version = "7.0.0-rc.3", default-features = false, features = [ "x509", pkcs1 = "0.4.0" pkcs8 = { version = "0.9.0", features = ["pem", "alloc", "pkcs5", "encryption"] } rand = { version = "0.8.5", features = [ "getrandom", "std" ] } +getrandom = "0.2.8" regex = { version = "1.5.5", optional = true } reqwest = { version = "0.11", default-features = false, features = ["json", "multipart"], optional = true} rsa = "0.8.0" diff --git a/README.md b/README.md index f5afba2c0e..d119b1192f 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,16 @@ For example, `openidconnect` can be run with the following command: cargo run --example openidconnect ``` +## WebAssembly/WASM support + +To embedded this crate in WASM modules, build it using the `wasm` cargo feature: + +```bash +cargo build --no-default-features --features wasm --target wasm32-unknown-unknown +``` + +NOTE: The wasm32-wasi target architecture is not yet supported. + ## Contributing Contributions are welcome! Please see the [contributing guidelines](CONTRIBUTING.md).