add deserialize_uncompressed to GenericSignature

This commit is contained in:
Daniel Knopik
2025-01-15 13:35:40 +01:00
parent 5dfda40285
commit f551579e32
3 changed files with 11 additions and 0 deletions

View File

@@ -40,6 +40,9 @@ pub trait TSignature<GenericPublicKey>: Sized + Clone {
/// Deserialize `self` from compressed bytes.
fn deserialize(bytes: &[u8]) -> Result<Self, Error>;
/// Serialize `self` from uncompressed bytes.
fn deserialize_uncompressed(bytes: &[u8]) -> Result<Self, Error>;
/// Returns `true` if `self` is a signature across `msg` by `pubkey`.
fn verify(&self, pubkey: &GenericPublicKey, msg: Hash256) -> bool;
}

View File

@@ -198,6 +198,10 @@ impl TSignature<blst_core::PublicKey> for blst_core::Signature {
Self::from_bytes(bytes).map_err(Into::into)
}
fn deserialize_uncompressed(bytes: &[u8]) -> Result<Self, Error> {
Self::deserialize(bytes).map_err(Into::into)
}
fn verify(&self, pubkey: &blst_core::PublicKey, msg: Hash256) -> bool {
// Public keys have already been checked for subgroup and infinity
// Check Signature inside function for subgroup

View File

@@ -119,6 +119,10 @@ impl TSignature<PublicKey> for Signature {
Ok(signature)
}
fn deserialize_uncompressed(bytes: &[u8]) -> Result<Self, Error> {
Self::deserialize(bytes)
}
fn verify(&self, _pubkey: &PublicKey, _msg: Hash256) -> bool {
true
}