whisperfish / libsignal-service-rs

A Rust version of the libsignal-service-java library for communicating with Signal servers.
https://whisperfish.github.io/libsignal-service-rs/libsignal_service
GNU Affero General Public License v3.0
69 stars 32 forks source link

[Partial revert] Make sure we use the provided CSPRNG everywhere #342

Closed gferon closed 3 weeks ago

gferon commented 4 weeks ago

I just merged #341 but after talking with @boxdot the correct change is to do the opposite: make sure we use whatever the library user provide as CSPRNG.

Note: the csprng: &mut R is supposed to be at the end of function parameters to mimick what libsignal does and make it consistent.

There are only two places where we still use rand::thread_rng: in tests and when generating an ID for the next websocket request.

rubdos commented 4 weeks ago

It makes sense both ways. By #331, we chose that we are an opinionated library. By being generic, we show we're flexible. Either way is fine by me.

rubdos commented 3 weeks ago

@gferon conflicts here :-(