impl ECScalar<SK> for Secp256k1Scalar {
fn new_random() -> Self {
let mut arr = [0u8; 32];
thread_rng().fill(&mut arr[..]);
Self {
purpose: "random",
fe: SK::from_slice(&arr[0..arr.len()]).unwrap(),
}
}
// ...
}
This is not enough, a valid secret key should be [1, Group order), and group order is fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141