Skip to content

Commit 3f4c32e

Browse files
committed
Add documentation on how PublicKey::verify_signature can panic
1 parent 8da1884 commit 3f4c32e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/crypto.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ pub struct PublicKey {
1515

1616
impl PublicKey {
1717
/// Verify that `sig` is a valid signature on `data` from this key.
18+
///
19+
/// # Panics
20+
///
21+
/// Panics if the public key bytes are not a valid Ed25519 public key.
1822
pub fn verify_signature(&self, data: impl AsRef<[u8]>, sig: &Signature) -> bool {
1923
let verifier = ed25519_dalek::VerifyingKey::from_bytes(&self.bytes).unwrap();
2024
let signature = ed25519_dalek::Signature::from(&sig.bytes);

0 commit comments

Comments
 (0)