signature.rs - panic cleanup

This commit is contained in:
Jackson Sandland 2018-05-08 23:21:45 -07:00
parent 670a6c50c9
commit fe51669e85
1 changed files with 2 additions and 2 deletions

View File

@ -19,8 +19,8 @@ impl KeyPairUtil for Ed25519KeyPair {
/// Return a new ED25519 keypair
fn new() -> Self {
let rng = rand::SystemRandom::new();
let pkcs8_bytes = signature::Ed25519KeyPair::generate_pkcs8(&rng).unwrap();
signature::Ed25519KeyPair::from_pkcs8(untrusted::Input::from(&pkcs8_bytes)).unwrap()
let pkcs8_bytes = signature::Ed25519KeyPair::generate_pkcs8(&rng).expect("failed to generate_pkcs8");
signature::Ed25519KeyPair::from_pkcs8(untrusted::Input::from(&pkcs8_bytes)).expect("failed to construct Ed25519KeyPair")
}
/// Return the public key for the given keypair