diff --git a/Cargo.toml b/Cargo.toml index d1ef6f3539..475a3d33a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ branch = "otak/fix-1.0.3" [patch.crates-io.proteus-traits] package = "proteus-traits" git = "https://github.com/wireapp/proteus" -branch = "otak/2.0-ec-send-sync" +branch = "2.x" [patch.crates-io.openmls] package = "openmls" diff --git a/crypto/Cargo.toml b/crypto/Cargo.toml index 84d7cae9ff..bc0332b617 100644 --- a/crypto/Cargo.toml +++ b/crypto/Cargo.toml @@ -46,11 +46,11 @@ wire-e2e-identity = { version = "0.4", default-features = false } indexmap = "2" [dependencies.proteus-wasm] -version = "2.0" +version = "2.1" features = ["hazmat"] optional = true git = "https://github.com/wireapp/proteus" -branch = "otak/2.0-ec-send-sync" +branch = "2.x" [dependencies.proteus-traits] optional = true diff --git a/crypto/src/error.rs b/crypto/src/error.rs index ef82274569..4bea5c674b 100644 --- a/crypto/src/error.rs +++ b/crypto/src/error.rs @@ -307,6 +307,10 @@ pub enum ProteusError { ProteusEncodeError(#[from] proteus_wasm::EncodeError), #[cfg(feature = "proteus")] #[error(transparent)] + /// Various internal Proteus errors + ProteusInternalError(#[from] proteus_wasm::error::ProteusError), + #[cfg(feature = "proteus")] + #[error(transparent)] /// Error when there's a critical error within a proteus Session ProteusSessionError(#[from] proteus_wasm::session::Error), } @@ -321,6 +325,7 @@ impl ProteusError { ProteusError::ProteusDecodeError(e) => e.code() as u32, ProteusError::ProteusEncodeError(e) => e.code() as u32, ProteusError::ProteusSessionError(e) => e.code() as u32, + ProteusError::ProteusInternalError(e) => e.code() as u32, } } else { 0 diff --git a/crypto/src/proteus.rs b/crypto/src/proteus.rs index 1402e2cce3..66af0ade61 100644 --- a/crypto/src/proteus.rs +++ b/crypto/src/proteus.rs @@ -324,7 +324,7 @@ impl ProteusCentral { let pk = identity.pk_raw(); // SAFETY: Byte lengths are ensured at the keystore level so this function is safe to call, despite being cursed - unsafe { IdentityKeyPair::from_raw_key_pair(*sk, *pk) } + unsafe { IdentityKeyPair::from_raw_key_pair(*sk, *pk).map_err(ProteusError::from)? } } else { Self::create_identity(keystore).await? }; @@ -339,7 +339,7 @@ impl ProteusCentral { let pk = hex::decode(pk_fingerprint)?; let ks_identity = ProteusIdentity { - sk: kp.secret_key.as_slice().into(), + sk: kp.secret_key.to_keypair_bytes().into(), pk, }; keystore.save(ks_identity).await?; @@ -669,7 +669,10 @@ impl ProteusCentral { let prekey_dir = root_dir.join("prekeys"); let mut identity = if let Some(store_kp) = keystore.find::(&[]).await? { - Some(unsafe { IdentityKeyPair::from_raw_key_pair(*store_kp.sk_raw(), *store_kp.pk_raw()) }) + Some(unsafe { + IdentityKeyPair::from_raw_key_pair(*store_kp.sk_raw(), *store_kp.pk_raw()) + .map_err(ProteusError::from)? + }) } else { let identity_dir = root_dir.join("identities"); @@ -696,7 +699,7 @@ impl ProteusCentral { let pk = kp.public_key.public_key.as_slice().into(); let ks_identity = ProteusIdentity { - sk: kp.secret_key.as_slice().into(), + sk: kp.secret_key.to_keypair_bytes().into(), pk, }; @@ -824,6 +827,7 @@ impl ProteusCentral { let mut proteus_identity = if let Some(store_kp) = keystore.find::(&[]).await? { Some(unsafe { proteus_wasm::keys::IdentityKeyPair::from_raw_key_pair(*store_kp.sk_raw(), *store_kp.pk_raw()) + .map_err(ProteusError::from)? }) } else { let transaction = db @@ -850,7 +854,7 @@ impl ProteusCentral { let pk = hex::decode(pk_fingerprint)?; let ks_identity = ProteusIdentity { - sk: kp.secret_key.as_slice().into(), + sk: kp.secret_key.to_keypair_bytes().into(), pk, }; keystore.save(ks_identity).await?; diff --git a/interop/Cargo.toml b/interop/Cargo.toml index 36bb6f58a4..a9927b8f17 100644 --- a/interop/Cargo.toml +++ b/interop/Cargo.toml @@ -51,11 +51,11 @@ webdriver-install = "0.3" fantoccini = "0.19" [dependencies.proteus-wasm] -version = "2.0" +version = "2.1" features = ["hazmat"] optional = true git = "https://github.com/wireapp/proteus" -branch = "otak/2.0-ec-send-sync" +branch = "2.x" diff --git a/keystore/Cargo.toml b/keystore/Cargo.toml index 954fb2ce84..92a0b963ad 100644 --- a/keystore/Cargo.toml +++ b/keystore/Cargo.toml @@ -53,7 +53,7 @@ log = { version = "0.4", optional = true } optional = true package = "proteus-traits" git = "https://github.com/wireapp/proteus" -branch = "otak/2.0-ec-send-sync" +branch = "2.x" [target.'cfg(not(target_family = "wasm"))'.dependencies] async-fs = "1.5" @@ -107,9 +107,9 @@ core-crypto-keystore = { path = ".", features = ["idb-regression-test", "log-que pretty_env_logger = "0.5" [dev-dependencies.proteus-wasm] -version = "2.0" +version = "2.1" git = "https://github.com/wireapp/proteus" -branch = "otak/2.0-ec-send-sync" +branch = "2.x" [target.'cfg(not(target_family = "wasm"))'.dev-dependencies.criterion] version = "0.5" diff --git a/package.json b/package.json index bc0d0799f9..a7ed3d9d6b 100644 --- a/package.json +++ b/package.json @@ -62,4 +62,4 @@ "ts-loader": "^9.4.2", "typescript": "^4.9.5" } -} \ No newline at end of file +}