1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
//! This crate provides: //! //! - `MultiSignature` trait for specifying curves with multi signature support. //! - `bn256` module implementing the aforementioned trait for the BLS curve bn256. pub mod bn256; /// The `MultiSignature` trait specifies an interface common for curves with multi signature support. /// /// This trait requires to define the types for `PublicKey`, `SecretKey` and `Signature`. pub trait MultiSignature<PublicKey, SecretKey, Signature> { type Error; /// Function to derive public key given a secret key. /// /// # Arguments /// /// * `secret_key` - The secret key to derive the public key /// /// # Returns /// /// * If successful, a vector of bytes with the public key fn derive_public_key(&mut self, secret_key: SecretKey) -> Result<Vec<u8>, Self::Error>; /// Function to sign a message given a private key. /// /// # Arguments /// /// * `message` - The message to be signed /// * `secret_key` - The secret key for signing /// /// # Returns /// /// * If successful, a vector of bytes with the signature fn sign(&mut self, secret_key: SecretKey, message: &[u8]) -> Result<Vec<u8>, Self::Error>; /// Function to verify a signature given a public key. /// /// # Arguments /// /// * `signature` - The signature /// * `message` - The message to be signed /// * `public_key` - The public key to verify /// /// # Returns /// /// * If successful, `Ok(())`; otherwise `Error` fn verify( &mut self, signature: Signature, message: &[u8], public_key: PublicKey, ) -> Result<(), Self::Error>; /// Function to aggregate public keys in their corresponding group. /// /// # Arguments /// /// * `public_key` - An array of public keys to be aggregated /// /// # Returns /// /// * If successful, a vector of bytes with the aggregated public key fn aggregate_public_keys(&mut self, public_keys: &[PublicKey]) -> Result<Vec<u8>, Self::Error>; /// Function to aggregate signatures in their corresponding group. /// /// # Arguments /// /// * `signatures` - An array of signatures to be aggregated /// /// # Returns /// /// * If successful, a vector of bytes with the aggregated signature fn aggregate_signatures(&mut self, signatures: &[Signature]) -> Result<Vec<u8>, Self::Error>; }