Skip to content

Commit

Permalink
crypto: Don't panic on unsupported key types
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
  • Loading branch information
lexnv committed Apr 23, 2024
1 parent 1f19eac commit fa632d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ impl TryFrom<keys_proto::PublicKey> for PublicKey {
match key_type {
keys_proto::KeyType::Ed25519 =>
Ok(ed25519::PublicKey::decode(&pubkey.data).map(PublicKey::Ed25519)?),
_ => unimplemented!("unsupported key type"),
_ => Err(Error::Other(format!(
"Unsupported key type: {}",
key_type.as_str_name()
))),
}
}
}
Expand Down

0 comments on commit fa632d2

Please sign in to comment.