Fold a few panics
Removes a few panics we don't need by folding them in the Error case of their enclosing Result return.
This commit is contained in:
+8
-1
@@ -160,7 +160,14 @@ impl KeyPair for X25519KeyPair {
|
||||
}
|
||||
|
||||
fn check_public_key(key: Self::Repr) -> Result<Self::Repr, InternalPakeError> {
|
||||
let key_bytes: [u8; 32] = (&key[..]).try_into().expect("Key invariant broken");
|
||||
let key_bytes: [u8; 32] =
|
||||
(&key[..])
|
||||
.try_into()
|
||||
.map_err(|_| InternalPakeError::SizeError {
|
||||
name: "key",
|
||||
len: 32,
|
||||
actual_len: key.len(),
|
||||
})?;
|
||||
let point = ::curve25519_dalek::montgomery::MontgomeryPoint(key_bytes)
|
||||
.to_edwards(1)
|
||||
.ok_or(InternalPakeError::PointError)?;
|
||||
|
||||
Reference in New Issue
Block a user