diff --git a/Cargo.toml b/Cargo.toml index f4cdb7f..964c133 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,8 @@ maintenance = { status = "actively-developed" } [dependencies] p256 = {version = "0.9", features = ["zeroize", "ecdh", "arithmetic", "pem", "jwk"]} -rand_core = {version = "0.6", features = ["getrandom"]} +rand_core = {version = "0.6"} +getrandom = {version = "0.2.3"} hkdf = "0.11.0" hmac = "0.11.0" aes-gcm-siv = {version = "0.10.0"} @@ -43,4 +44,5 @@ opt-level = 3 [features] default = ["sha2"] -ring = ["ring-compat/digest"] \ No newline at end of file +ring = ["ring-compat/digest"] +wasm = ["getrandom/js"] \ No newline at end of file diff --git a/README.md b/README.md index 42a571c..547826a 100644 --- a/README.md +++ b/README.md @@ -118,9 +118,12 @@ assert_eq!(im_ratchet, bob_ratchet) ## Features -Currently the crate only supports one feature: ring. If feature is enabled the crate switches +The crate supports a feature for better performance: ring. If feature is enabled the crate switches to ring-compat and uses ring as backend for Sha512 Hashing. May result in slightly better performance. +### WASM + +For WASM support enable the feature `wasm`. TODO: - [x] Standard Double Ratchet diff --git a/src/ratchet.rs b/src/ratchet.rs index 0351fe2..e638aab 100644 --- a/src/ratchet.rs +++ b/src/ratchet.rs @@ -263,7 +263,7 @@ impl From<&ExRatchetEncHeader> for RatchetEncHeader { private_key: private_dhs, public_key: public_dhs }; - let dhr = ex_reh.dhr.as_ref().map(|e| PublicKey::from_jwk_str(&e).unwrap()); + let dhr = ex_reh.dhr.as_ref().map(|e| PublicKey::from_jwk_str(e).unwrap()); Self { dhs, dhr,