mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
refactor: use u64 instead of usize for nonce gen (#14708)
This commit is contained in:
@@ -129,14 +129,7 @@ fn replace_csp_nonce(
|
||||
) {
|
||||
let mut nonces = Vec::new();
|
||||
*asset = replace_with_callback(asset, token, || {
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
let mut raw = [0u8; 8];
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
let mut raw = [0u8; 4];
|
||||
#[cfg(target_pointer_width = "16")]
|
||||
let mut raw = [0u8; 2];
|
||||
getrandom::fill(&mut raw).expect("failed to get random bytes");
|
||||
let nonce = usize::from_ne_bytes(raw);
|
||||
let nonce = getrandom::u64().expect("failed to get random bytes");
|
||||
nonces.push(nonce);
|
||||
nonce.to_string()
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user