Merge pull request #6 from Dione-Software/make-wasm-work

Added wasm support
This commit is contained in:
Hannes 2021-10-07 14:56:47 +02:00 committed by GitHub
commit 97216c0170
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -18,7 +18,8 @@ maintenance = { status = "actively-developed" }
[dependencies] [dependencies]
p256 = {version = "0.9", features = ["zeroize", "ecdh", "arithmetic", "pem", "jwk"]} 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" hkdf = "0.11.0"
hmac = "0.11.0" hmac = "0.11.0"
aes-gcm-siv = {version = "0.10.0"} aes-gcm-siv = {version = "0.10.0"}
@ -43,4 +44,5 @@ opt-level = 3
[features] [features]
default = ["sha2"] default = ["sha2"]
ring = ["ring-compat/digest"] ring = ["ring-compat/digest"]
wasm = ["getrandom/js"]

View file

@ -118,9 +118,12 @@ assert_eq!(im_ratchet, bob_ratchet)
## Features ## 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. 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: TODO:
- [x] Standard Double Ratchet - [x] Standard Double Ratchet

View file

@ -263,7 +263,7 @@ impl From<&ExRatchetEncHeader> for RatchetEncHeader {
private_key: private_dhs, private_key: private_dhs,
public_key: public_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 { Self {
dhs, dhs,
dhr, dhr,