mod.rs

Overview

This file defines the primary traits and module structure for a Boneh–Lynn–Shacham (BLS) signature scheme implementation. It declares a generic trait BLSSignatureScheme that abstracts the signing, verification, and signature aggregation operations typical in BLS cryptography. The file also organizes submodules that provide concrete implementations and utilities related to the BLS scheme.

Modules

The GoshBLS type is publicly re-exported from the gosh_bls module for external use.

BLSSignatureScheme Trait

The BLSSignatureScheme trait defines the interface required for any BLS signature scheme implementation. It is designed to be:

Associated Types

Methods

sign

fn sign<TData: Serialize>(
    secret: &Self::Secret,
    data: &TData,
) -> anyhow::Result<Self::Signature>;

verify

fn verify<TData: Serialize>(
    signature: &Self::Signature,
    pubkeys_occurrences: &mut dyn Iterator<Item = &(Self::PubKey, usize)>,
    data: &TData,
) -> anyhow::Result<bool>;

merge

fn merge(one: &Self::Signature, another: &Self::Signature) -> anyhow::Result<Self::Signature>;

Implementation Details

Interaction With Other Parts

Diagram: Structure of mod.rs

classDiagram
class BLSSignatureScheme {
<<trait>>
+sign()
+verify()
+merge()
+PubKey
+Secret
+Signature
}
BLSSignatureScheme <|.. GoshBLS
class GoshBLS {
+PubKey
+Secret
+Signature
+sign()
+verify()
+merge()
}
class create_signed
class envelope
class gosh_bls
mod.rs --> create_signed
mod.rs --> envelope
mod.rs --> gosh_bls
mod.rs ..> BLSSignatureScheme
gosh_bls ..> GoshBLS

The diagram illustrates the main trait BLSSignatureScheme with its core methods and associated types, the GoshBLS concrete implementation, and the submodules included in the file. The trait is implemented by GoshBLS, and the file exposes these components through its module structure.