diff --git a/Cargo.lock b/Cargo.lock index 9cc39d39d..ced615591 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8377,7 +8377,7 @@ dependencies = [ "dirs 6.0.0", "dunce", "embed_plist", - "getrandom 0.2.15", + "getrandom 0.3.3", "glob", "gtk", "heck 0.5.0", @@ -8810,7 +8810,7 @@ dependencies = [ "cargo_metadata", "ctor", "dunce", - "getrandom 0.2.15", + "getrandom 0.3.3", "glob", "html5ever", "http 1.3.1", diff --git a/crates/tauri-utils/Cargo.toml b/crates/tauri-utils/Cargo.toml index 69dc2971d..4f8a7e488 100644 --- a/crates/tauri-utils/Cargo.toml +++ b/crates/tauri-utils/Cargo.toml @@ -30,7 +30,7 @@ quote = { version = "1", optional = true } schemars = { version = "0.8.21", features = ["url", "uuid1"], optional = true } serde_with = "3" aes-gcm = { version = "0.10", optional = true } -getrandom = { version = "0.2", optional = true, features = ["std"] } +getrandom = { version = "0.3", optional = true, features = ["std"] } serialize-to-javascript = { version = "=0.1.1", optional = true } ctor = "0.2" json5 = { version = "0.4", optional = true } @@ -55,7 +55,7 @@ http = "1" swift-rs = { version = "1", optional = true, features = ["build"] } [dev-dependencies] -getrandom = { version = "0.2", features = ["std"] } +getrandom = { version = "0.3", features = ["std"] } serial_test = "3" [features] diff --git a/crates/tauri-utils/src/pattern/isolation.rs b/crates/tauri-utils/src/pattern/isolation.rs index b92ed0f3e..c99f474e2 100644 --- a/crates/tauri-utils/src/pattern/isolation.rs +++ b/crates/tauri-utils/src/pattern/isolation.rs @@ -9,7 +9,7 @@ use std::string::FromUtf8Error; use aes_gcm::aead::Aead; use aes_gcm::{Aes256Gcm, KeyInit, Nonce}; -use getrandom::{getrandom, Error as CsprngError}; +use getrandom::Error as CsprngError; use serialize_to_javascript::{default_template, Template}; /// The style for the isolation iframe. @@ -56,7 +56,7 @@ impl Debug for AesGcmPair { impl AesGcmPair { fn new() -> Result { let mut raw = [0u8; 32]; - getrandom(&mut raw)?; + getrandom::fill(&mut raw)?; let key = aes_gcm::Key::::from_slice(&raw); Ok(Self { raw, diff --git a/crates/tauri-utils/src/resources.rs b/crates/tauri-utils/src/resources.rs index 739aabcb6..d13f4e421 100644 --- a/crates/tauri-utils/src/resources.rs +++ b/crates/tauri-utils/src/resources.rs @@ -328,7 +328,7 @@ mod tests { fn setup_test_dirs() { let mut random = [0; 1]; - getrandom::getrandom(&mut random).unwrap(); + getrandom::fill(&mut random).unwrap(); let temp = std::env::temp_dir(); let temp = temp.join(format!("tauri_resource_paths_iter_test_{}", random[0])); diff --git a/crates/tauri/Cargo.toml b/crates/tauri/Cargo.toml index 3fc70a99e..80a07fb43 100644 --- a/crates/tauri/Cargo.toml +++ b/crates/tauri/Cargo.toml @@ -62,7 +62,7 @@ tauri-utils = { version = "2.5.0", features = [ "resources", ], path = "../tauri-utils" } tauri-runtime-wry = { version = "2.7.0", path = "../tauri-runtime-wry", default-features = false, optional = true } -getrandom = "0.2" +getrandom = "0.3" serde_repr = "0.1" http = "1" dirs = "6" diff --git a/crates/tauri/src/ipc/protocol.rs b/crates/tauri/src/ipc/protocol.rs index 7e01f28fb..1b1e08b8f 100644 --- a/crates/tauri/src/ipc/protocol.rs +++ b/crates/tauri/src/ipc/protocol.rs @@ -658,7 +658,7 @@ mod tests { }; let mut nonce = [0u8; 12]; - getrandom::getrandom(&mut nonce).unwrap(); + getrandom::fill(&mut nonce).unwrap(); let body_raw = vec![1, 41, 65, 12, 78]; let body_bytes = crypto_keys.aes_gcm().encrypt(&nonce, &body_raw).unwrap(); diff --git a/crates/tauri/src/lib.rs b/crates/tauri/src/lib.rs index 48fe2b4b7..979ebd577 100644 --- a/crates/tauri/src/lib.rs +++ b/crates/tauri/src/lib.rs @@ -1260,6 +1260,6 @@ mod z85 { /// [Z85]: https://rfc.zeromq.org/spec/32/ pub(crate) fn generate_invoke_key() -> Result { let mut bytes = [0u8; 16]; - getrandom::getrandom(&mut bytes)?; + getrandom::fill(&mut bytes)?; Ok(z85::encode(&bytes)) } diff --git a/crates/tauri/src/manager/mod.rs b/crates/tauri/src/manager/mod.rs index d3335cb7d..d95f35dd3 100644 --- a/crates/tauri/src/manager/mod.rs +++ b/crates/tauri/src/manager/mod.rs @@ -135,7 +135,7 @@ fn replace_csp_nonce( let mut raw = [0u8; 4]; #[cfg(target_pointer_width = "16")] let mut raw = [0u8; 2]; - getrandom::getrandom(&mut raw).expect("failed to get random bytes"); + getrandom::fill(&mut raw).expect("failed to get random bytes"); let nonce = usize::from_ne_bytes(raw); nonces.push(nonce); nonce.to_string() diff --git a/crates/tauri/src/protocol/asset.rs b/crates/tauri/src/protocol/asset.rs index 632ae1b5f..a5007d294 100644 --- a/crates/tauri/src/protocol/asset.rs +++ b/crates/tauri/src/protocol/asset.rs @@ -225,7 +225,7 @@ fn get_response( fn random_boundary() -> String { let mut x = [0_u8; 30]; - getrandom::getrandom(&mut x).expect("failed to get random bytes"); + getrandom::fill(&mut x).expect("failed to get random bytes"); (x[..]) .iter() .map(|&x| format!("{x:x}")) diff --git a/crates/tauri/src/resources/mod.rs b/crates/tauri/src/resources/mod.rs index d4dce68ce..d393bca65 100644 --- a/crates/tauri/src/resources/mod.rs +++ b/crates/tauri/src/resources/mod.rs @@ -80,7 +80,7 @@ pub struct ResourceTable { impl ResourceTable { fn new_random_rid() -> u32 { let mut bytes = [0_u8; 4]; - getrandom::getrandom(&mut bytes).expect("failed to get random bytes"); + getrandom::fill(&mut bytes).expect("failed to get random bytes"); u32::from_ne_bytes(bytes) } diff --git a/crates/tauri/src/webview/webview_window.rs b/crates/tauri/src/webview/webview_window.rs index 8c55e1a02..b8ba7eebc 100644 --- a/crates/tauri/src/webview/webview_window.rs +++ b/crates/tauri/src/webview/webview_window.rs @@ -139,7 +139,7 @@ impl<'a, R: Runtime, M: Manager> WebviewWindowBuilder<'a, R, M> { /// let mut conf = app.config().app.windows.iter().find(|c| c.label == "template-for-multiwindow").unwrap().clone(); /// // This should be a unique label for all windows. For example, we can use a random suffix: /// let mut buf = [0u8; 1]; - /// assert_eq!(getrandom::getrandom(&mut buf), Ok(())); + /// assert_eq!(getrandom::fill(&mut buf), Ok(())); /// conf.label = format!("my-multiwindow-{}", buf[0]); /// let webview_window = tauri::WebviewWindowBuilder::from_config(&app, &conf) /// .unwrap() diff --git a/examples/streaming/main.rs b/examples/streaming/main.rs index f92add446..b2f7f1ef1 100644 --- a/examples/streaming/main.rs +++ b/examples/streaming/main.rs @@ -152,7 +152,7 @@ fn get_stream_response( fn random_boundary() -> String { let mut x = [0_u8; 30]; - getrandom::getrandom(&mut x).expect("failed to get random bytes"); + getrandom::fill(&mut x).expect("failed to get random bytes"); (x[..]) .iter() .map(|&x| format!("{x:x}"))