diff --git a/Cargo.lock b/Cargo.lock index 40aa04b739..d73f0d3c35 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -201,7 +201,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.34", + "time 0.3.36", ] [[package]] @@ -517,9 +517,9 @@ checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "blake3" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" +checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" dependencies = [ "arrayref", "arrayvec", @@ -3065,9 +3065,9 @@ dependencies = [ [[package]] name = "netlink-sys" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6471bf08e7ac0135876a9581bf3217ef0333c191c128d34878079f42ee150411" +checksum = "416060d346fbaf1f23f9512963e3e878f1a78e707cb699ba9215761754244307" dependencies = [ "bytes", "libc", @@ -3126,11 +3126,10 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] @@ -3421,9 +3420,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pem" @@ -3779,9 +3778,9 @@ checksum = "4339fc7a1021c9c1621d87f5e3505f2805c8c105420ba2f2a4df86814590c142" [[package]] name = "quic-rpc" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1428fcf30c17a159ff10c1f3c69fca92fd7cfa11e9fef7d573f3c6f0da3b5920" +checksum = "4574b485c0ac86e1a087ad616d99daecd3742820b74172e3cd98b34707130c52" dependencies = [ "bincode", "educe", @@ -3996,7 +3995,7 @@ checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" dependencies = [ "pem", "ring 0.16.20", - "time 0.3.34", + "time 0.3.36", "yasna", ] @@ -4291,9 +4290,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.11" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "ring 0.17.8", "rustls-webpki", @@ -5004,9 +5003,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -5025,9 +5024,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -5910,7 +5909,7 @@ dependencies = [ "oid-registry", "rusticata-macros", "thiserror", - "time 0.3.34", + "time 0.3.36", ] [[package]] @@ -5936,7 +5935,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" dependencies = [ - "time 0.3.34", + "time 0.3.36", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index eeb0e4fc98..390065ed65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,7 +60,6 @@ hex = "0.4.0" hickory-resolver = "0.24" humansize = "2" image = { version = "0.25.1", default-features=false, features = ["gif", "jpeg", "ico", "png", "pnm", "webp", "bmp"] } -iroh = { version = "0.4.2", default-features = false } kamadak-exif = "0.5.3" lettre_email = { git = "https://github.com/deltachat/lettre", branch = "master" } libc = "0.2" @@ -110,6 +109,9 @@ uuid = { version = "1", features = ["serde", "v4"] } # 3.1 branch will be supported until 2025-03-14. openssl-src = "~300.1" +[target.'cfg(not(target_os = "openbsd"))'.dependencies] +iroh = { version = "0.4.2", default-features = false } + [dev-dependencies] ansi_term = "0.12.0" anyhow = { version = "1", features = ["backtrace"] } # Enable `backtrace` feature in tests. diff --git a/src/imex.rs b/src/imex.rs index e672410926..2bbe863eea 100644 --- a/src/imex.rs +++ b/src/imex.rs @@ -34,8 +34,10 @@ use crate::tools::{ create_folder, delete_file, get_filesuffix_lc, open_file_std, read_file, time, write_file, }; +#[cfg(not(target_os = "openbsd"))] mod transfer; +#[cfg(not(target_os = "openbsd"))] pub use transfer::{get_backup, BackupProvider}; // Name of the database file in the backup. diff --git a/src/qr.rs b/src/qr.rs index 0c349e8488..9850919e93 100644 --- a/src/qr.rs +++ b/src/qr.rs @@ -109,6 +109,7 @@ pub enum Qr { /// /// This contains all the data needed to connect to a device and download a backup from /// it to configure the receiving device with the same account. + #[cfg(not(target_os = "openbsd"))] Backup { /// Printable version of the provider information. /// @@ -291,6 +292,7 @@ pub async fn check_qr(context: &Context, qr: &str) -> Result { /// /// TODO: Refactor this so all variants have a correct [`Display`] and transform `check_qr` /// into `FromStr`. +#[cfg(not(target_os = "openbsd"))] pub fn format_backup(qr: &Qr) -> Result { match qr { Qr::Backup { ref ticket } => Ok(format!("{DCBACKUP_SCHEME}{ticket}")), @@ -298,6 +300,12 @@ pub fn format_backup(qr: &Qr) -> Result { } } +/// Placeholder for OpenBSD which does not support iroh backup transfer. +#[cfg(target_os = "openbsd")] +pub fn format_backup(_qr: &Qr) -> Result { + Err(anyhow!("Backup is not supported on OpenBSD")) +} + /// scheme: `OPENPGP4FPR:FINGERPRINT#a=ADDR&n=NAME&i=INVITENUMBER&s=AUTH` /// or: `OPENPGP4FPR:FINGERPRINT#a=ADDR&g=GROUPNAME&x=GROUPID&i=INVITENUMBER&s=AUTH` /// or: `OPENPGP4FPR:FINGERPRINT#a=ADDR` @@ -520,6 +528,7 @@ fn decode_webrtc_instance(_context: &Context, qr: &str) -> Result { /// /// The format of this scheme is `DCBACKUP:`. The encoding is the /// [`iroh::provider::Ticket`]'s `Display` impl. +#[cfg(not(target_os = "openbsd"))] fn decode_backup(qr: &str) -> Result { let payload = qr .strip_prefix(DCBACKUP_SCHEME) @@ -528,6 +537,11 @@ fn decode_backup(qr: &str) -> Result { Ok(Qr::Backup { ticket }) } +#[cfg(target_os = "openbsd")] +fn decode_backup(_qr: &str) -> Result { + bail!("Backup transfer is not supported on OpenBSD"); +} + #[derive(Debug, Deserialize)] struct CreateAccountSuccessResponse { /// Email address. diff --git a/src/qr_code_generator.rs b/src/qr_code_generator.rs index 85c3ecba68..60062ea638 100644 --- a/src/qr_code_generator.rs +++ b/src/qr_code_generator.rs @@ -296,11 +296,9 @@ fn inner_generate_secure_join_qr_code( #[cfg(test)] mod tests { - use testdir::testdir; + #[cfg(not(target_os = "openbsd"))] use crate::imex::BackupProvider; - use crate::qr::format_backup; - use crate::test_utils::TestContextManager; use super::*; @@ -318,7 +316,12 @@ mod tests { } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] + #[cfg(not(target_os = "openbsd"))] async fn test_generate_backup_qr() { + use crate::qr::format_backup; + use crate::test_utils::TestContextManager; + use testdir::testdir; + let dir = testdir!(); let mut tcm = TestContextManager::new(); let ctx = tcm.alice().await; diff --git a/src/stock_str.rs b/src/stock_str.rs index 984a658f82..08e2f630df 100644 --- a/src/stock_str.rs +++ b/src/stock_str.rs @@ -1386,6 +1386,7 @@ pub(crate) async fn backup_transfer_qr(context: &Context) -> Result { .replace1(&full_name)) } +#[cfg(not(target_os = "openbsd"))] pub(crate) async fn backup_transfer_msg_body(context: &Context) -> String { translated(context, StockMessage::BackupTransferMsgBody).await }