Skip to content

Commit

Permalink
signature verification with base64 encoded keys added
Browse files Browse the repository at this point in the history
  • Loading branch information
ph0llux committed Jul 29, 2024
1 parent 89720fc commit fd5598d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/signatures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ impl Signature {
signature.to_bytes()
}

/// verify the data with the given base64 encoded key (signing key or verifying keys are possible to use here).
pub fn verify_with_base64_key<K: Into<String>>(key: K, message: &[u8], signature: [u8; ED25519_DALEK_SIGNATURE_LEN]) -> Result<bool> {
let key = base64engine.decode(key.into())?;
Signature::verify(key, message, signature)
}

/// verify the data with the given key bytes (signing key or verifying keys are possible to use here).
pub fn verify<K>(key: K, message: &[u8], signature: [u8; ED25519_DALEK_SIGNATURE_LEN]) -> Result<bool>
where
Expand Down

0 comments on commit fd5598d

Please sign in to comment.