huskies: merge 925
This commit is contained in:
@@ -65,7 +65,7 @@ pub type SignatureHex = String;
|
||||
/// which must respond with a valid signature from its node keypair.
|
||||
pub fn generate_challenge() -> ChallengeHex {
|
||||
let mut bytes = [0u8; 32];
|
||||
rand::thread_rng().fill_bytes(&mut bytes);
|
||||
rand::rng().fill_bytes(&mut bytes);
|
||||
hex_encode(&bytes)
|
||||
}
|
||||
|
||||
@@ -184,8 +184,9 @@ pub fn load_or_create_keypair_file(path: &std::path::Path) -> std::io::Result<No
|
||||
SigningKey::from_bytes(&seed)
|
||||
} else {
|
||||
// Generate a fresh keypair and persist the seed.
|
||||
let sk = SigningKey::generate(&mut rand::rngs::OsRng);
|
||||
let seed = sk.to_bytes();
|
||||
let mut seed = [0u8; 32];
|
||||
rand::rng().fill_bytes(&mut seed);
|
||||
let sk = SigningKey::from_bytes(&seed);
|
||||
|
||||
// Create the file with mode 0600 at creation time (Unix) so the seed
|
||||
// is never visible to other users even transiently.
|
||||
|
||||
Reference in New Issue
Block a user