dalek-cryptography / x25519-dalek

X25519 elliptic curve Diffie-Hellman key exchange in pure-Rust, using curve25519-dalek.
BSD 3-Clause "New" or "Revised" License
331 stars 134 forks source link

Reexport rand_core #85

Closed tomleavy closed 1 year ago

tomleavy commented 2 years ago

There are issues with conflicting versions of rand_core since x25519 does not use the latest version. It would be helpful if rand_core was exported to avoid conflicts

cipriancraciun commented 1 year ago

Although, given that this crate already depends on rand_core, wouldn't there be more useful to have an additional feature flag, say getrandom, that just enables OsRng on rand_core, and then if this flag is set, to provide a wrapper say new_from_os_rng that just uses new(rand_core::OsRng).

The current crate has a great API that makes it hard for misuse, and key generation should fall into this category.

tarcieri commented 1 year ago

I think a getrandom feature flag that activates rand_core/getrandom is a good idea.

A convenience method for generating a key using OsRng is a good idea as well.