huskies: merge 925
This commit is contained in:
@@ -18,7 +18,7 @@ use {
|
||||
op::{print_hex, print_path, ROOT_ID},
|
||||
},
|
||||
colored::Colorize,
|
||||
random_color::{Luminosity, RandomColor},
|
||||
random_color::{options::Luminosity, RandomColor},
|
||||
};
|
||||
|
||||
#[cfg(feature = "logging-list")]
|
||||
|
||||
@@ -10,9 +10,10 @@ pub use fastcrypto::{
|
||||
Ed25519KeyPair, Ed25519PublicKey, Ed25519Signature, ED25519_PUBLIC_KEY_LENGTH,
|
||||
ED25519_SIGNATURE_LENGTH,
|
||||
},
|
||||
traits::{KeyPair, Signer},
|
||||
traits::{KeyPair, Signer, ToFromBytes},
|
||||
// Verifier,
|
||||
};
|
||||
use rand::RngCore as _;
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
/// Represents the ID of a unique node. An Ed25519 public key
|
||||
@@ -48,8 +49,9 @@ pub fn sha256(input: String) -> [u8; 32] {
|
||||
|
||||
/// Generate a random Ed25519 keypair from OS rng
|
||||
pub fn make_keypair() -> Ed25519KeyPair {
|
||||
let mut csprng = rand::thread_rng();
|
||||
Ed25519KeyPair::generate(&mut csprng)
|
||||
let mut seed = [0u8; 32];
|
||||
rand::rng().fill_bytes(&mut seed);
|
||||
Ed25519KeyPair::from_bytes(&seed).expect("32-byte seed always yields a valid Ed25519 keypair")
|
||||
}
|
||||
|
||||
/// Sign a byte array
|
||||
|
||||
Reference in New Issue
Block a user