Skip to content

Commit eab5450

Browse files
committed
Default to using getrandom.
1 parent 2aa6461 commit eab5450

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

crates/core/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ features = []
3030

3131

3232
[features]
33+
default = ["getrandom"]
34+
3335
loadable_extension = ["sqlite_nostd/loadable_extension"]
3436
static = ["sqlite_nostd/static"]
3537
omit_load_extension = ["sqlite_nostd/omit_load_extension"]

crates/core/src/util.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ pub fn deserialize_optional_string_to_i64<'de, D>(deserializer: D) -> Result<Opt
8585
}
8686
}
8787

88-
// Use getrandom crate to generate UUID
88+
// Use getrandom crate to generate UUID.
89+
// This is not available in all WASM builds - use the default in those cases.
8990
#[cfg(feature = "getrandom")]
9091
pub fn gen_uuid() -> Uuid {
9192
let id = Uuid::new_v4();
@@ -95,7 +96,7 @@ pub fn gen_uuid() -> Uuid {
9596
// Default - use sqlite3_randomness to generate UUID
9697
// This uses ChaCha20 PRNG, with /dev/urandom as a seed on unix.
9798
// On Windows, it uses custom logic for the seed, which may not be secure.
98-
// Rather avoid this version for Windows builds.
99+
// Rather avoid this version for most builds.
99100
#[cfg(not(feature = "getrandom"))]
100101
pub fn gen_uuid() -> Uuid {
101102
let mut random_bytes: [u8; 16] = [0; 16];

crates/shell/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ powersync_core = { path="../core" }
1313
sqlite_nostd = { workspace=true }
1414

1515
[features]
16-
default = ["powersync_core/static", "powersync_core/omit_load_extension", "powersync_core/getrandom", "sqlite_nostd/static", "sqlite_nostd/omit_load_extension"]
16+
default = ["powersync_core/static", "powersync_core/omit_load_extension", "sqlite_nostd/static", "sqlite_nostd/omit_load_extension"]
1717

1818
[build-dependencies]
1919
cc = "1.0.46"

0 commit comments

Comments
 (0)