Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
SIGN_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
SIGN_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
MAVEN_PROFILE_ID: ${{ secrets.MAVEN_PROFILE_ID }}
run: nix develop .#android --command ./gradlew :library:build publishToSonatype closeAndReleaseSonatypeStagingRepository
run: nix develop .#android --command ./gradlew :library:build publishToSonatype closeAndReleaseSonatypeStagingRepository --info

- name: Tag release
env:
Expand Down
42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 59 additions & 5 deletions bindings/mobile/src/mls.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(deprecated)]

use crate::fork_recovery::FfiForkRecoveryOpts;
use crate::identity::{FfiCollectionExt, FfiCollectionTryExt, FfiIdentifier};
pub use crate::inbox_owner::SigningError;
Expand Down Expand Up @@ -129,18 +131,68 @@ impl XmtpApiClient {
}
}

/// connect to the XMTP backend
/// Not specifying `gateway_host` uses the default gateway.
/// This builds a client that will auto-migrate on D14n cutover date.
#[uniffi::export(async_runtime = "tokio")]
pub async fn connect_to_backend(
v3_host: String,
gateway_host: Option<String>,
client_mode: Option<FfiClientMode>,
app_version: Option<String>,
auth_callback: Option<Arc<dyn gateway_auth::FfiAuthCallback>>,
auth_handle: Option<Arc<gateway_auth::FfiAuthHandle>>,
) -> Result<Arc<XmtpApiClient>, FfiError> {
connect_to_backend_internal(
v3_host,
gateway_host,
client_mode,
app_version,
auth_callback,
auth_handle,
false,
)
.await
}

/// connect to the XMTP backend
/// specifying `gateway_host` enables the D14n backend
/// and assumes `host` is set to the correct
/// d14n backend url.
/// d14n backend url. This will exclusively use
/// v3 or d14n and _will not migrate_. it is
/// provided for the convenience of testing v3/d14n
/// but should not be used and will be removed on cutover.
#[deprecated]
#[uniffi::export(async_runtime = "tokio")]
pub async fn connect_to_backend(
pub async fn connect_to_backend_exclusive(
v3_host: String,
gateway_host: Option<String>,
client_mode: Option<FfiClientMode>,
app_version: Option<String>,
auth_callback: Option<Arc<dyn gateway_auth::FfiAuthCallback>>,
auth_handle: Option<Arc<gateway_auth::FfiAuthHandle>>,
) -> Result<Arc<XmtpApiClient>, FfiError> {
connect_to_backend_internal(
v3_host,
gateway_host,
client_mode,
app_version,
auth_callback,
auth_handle,
true,
)
.await
}

#[uniffi::export(async_runtime = "tokio")]
async fn connect_to_backend_internal(
v3_host: String,
gateway_host: Option<String>,
client_mode: Option<FfiClientMode>,
app_version: Option<String>,
auth_callback: Option<Arc<dyn gateway_auth::FfiAuthCallback>>,
auth_handle: Option<Arc<gateway_auth::FfiAuthHandle>>,
exclusive: bool,
) -> Result<Arc<XmtpApiClient>, FfiError> {
init_logger();

Expand All @@ -163,9 +215,11 @@ pub async fn connect_to_backend(
)
.readonly(matches!(client_mode, FfiClientMode::Notification))
.maybe_auth_handle(auth_handle.map(|handle| handle.as_ref().clone().into()));
// switch v3/d14n based on presence of gateway host to preserve
// previous behavior and avoid breaking changes
let client_bundle = client_bundle.build_optional_d14n()?;
let client_bundle = if exclusive {
client_bundle.build_optional_d14n()
} else {
client_bundle.build()
}?;
let backend = MessageBackendBuilder::default().from_bundle(client_bundle.clone())?;
let api: ApiClientWrapper<xmtp_mls::XmtpApiClient> =
ApiClientWrapper::new(backend, strategies::exponential_cooldown());
Expand Down
6 changes: 5 additions & 1 deletion bindings/node/src/client/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ impl BackendBuilder {
.maybe_auth_handle(auth_handle.map(|h: AuthHandle| h.into()));

let v3_host = builder.get_v3_host().map(ToString::to_string);
let bundle = builder.build_optional_d14n().map_err(ErrorWrapper::from)?;
let bundle = if self.env.is_migration() {
builder.build().map_err(ErrorWrapper::from)?
} else {
builder.build_optional_d14n().map_err(ErrorWrapper::from)?
};
Ok(Backend {
bundle,
env: self.env,
Expand Down
15 changes: 15 additions & 0 deletions bindings/node/src/client/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ pub enum XmtpEnv {
TestnetDev,
Testnet,
Mainnet,
MigrationLocal,
MigrationStaging,
MigrationProduction,
}

impl XmtpEnv {
pub fn is_migration(&self) -> bool {
matches!(
self,
Self::MigrationLocal | Self::MigrationStaging | Self::MigrationProduction
)
}
}

impl From<XmtpEnv> for CoreXmtpEnv {
Expand All @@ -74,6 +86,9 @@ impl From<XmtpEnv> for CoreXmtpEnv {
XmtpEnv::TestnetDev => Self::TestnetDev,
XmtpEnv::Testnet => Self::Testnet,
XmtpEnv::Mainnet => Self::Mainnet,
XmtpEnv::MigrationLocal => Self::Local,
XmtpEnv::MigrationStaging => Self::TestnetStaging,
XmtpEnv::MigrationProduction => Self::Production,
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions bindings/wasm/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ pub enum XmtpEnv {
TestnetDev = 4,
Testnet = 5,
Mainnet = 6,
MigrationLocal = 7,
MigrationStaging = 8,
MigrationProduction = 9,
}

impl XmtpEnv {
pub fn is_migration(&self) -> bool {
matches!(
self,
Self::MigrationLocal | Self::MigrationStaging | Self::MigrationProduction
)
}
}

impl From<XmtpEnv> for xmtp_configuration::XmtpEnv {
Expand All @@ -114,6 +126,9 @@ impl From<XmtpEnv> for xmtp_configuration::XmtpEnv {
XmtpEnv::TestnetDev => Self::TestnetDev,
XmtpEnv::Testnet => Self::Testnet,
XmtpEnv::Mainnet => Self::Mainnet,
XmtpEnv::MigrationLocal => Self::Local,
XmtpEnv::MigrationStaging => Self::TestnetStaging,
XmtpEnv::MigrationProduction => Self::Production,
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions bindings/wasm/src/client/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ impl BackendBuilder {
.maybe_auth_handle(self.auth_handle.take().map(|h| h.handle));

let v3_host = builder.get_v3_host().map(ToString::to_string);
let bundle = builder
.build_optional_d14n()
.map_err(|e| JsError::new(&e.to_string()))?;
let bundle = if self.env.is_migration() {
builder.build().map_err(|e| JsError::new(&e.to_string()))?
} else {
builder
.build_optional_d14n()
.map_err(|e| JsError::new(&e.to_string()))?
};
Ok(Backend {
bundle,
env: self.env,
Expand Down
4 changes: 2 additions & 2 deletions crates/xmtp-workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ hpke-rs = { version = "0.6", features = ["hazmat", "libcrux", "serialization"] }
hyper = { version = "1", features = ["http1", "http2", "server"] }
idna = { version = "1" }
indexmap = { version = "2", features = ["serde"] }
itertools = { version = "0.14" }
itertools = { version = "0.13" }
k256 = { version = "0.13", default-features = false, features = ["ecdh", "ecdsa", "std"] }
log = { version = "0.4", default-features = false, features = ["std"] }
memchr = { version = "2" }
Expand Down Expand Up @@ -137,7 +137,7 @@ hpke-rs = { version = "0.6", features = ["hazmat", "libcrux", "serialization"] }
hyper = { version = "1", features = ["http1", "http2", "server"] }
idna = { version = "1" }
indexmap = { version = "2", features = ["serde"] }
itertools = { version = "0.14" }
itertools = { version = "0.13" }
k256 = { version = "0.13", default-features = false, features = ["ecdh", "ecdsa", "std"] }
log = { version = "0.4", default-features = false, features = ["std"] }
memchr = { version = "2" }
Expand Down
2 changes: 1 addition & 1 deletion nix/lib/packages/swiftlint.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
unzip,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation {
pname = "swiftlint";
version = "0.62.1";

Expand Down
Loading
Loading