feat: Add bls12381 signing provider - #214
Conversation
There was a problem hiding this comment.
Thanks a lot for the PR 🙌🏼 Left few comments. Please add a test that generates a private key, signs a message, and verifies the signature with the public key.
Would appreciate if you filled in bls12381_min_pk.rs too.
Would be great if you could merge these two structs Bls12381<T> and have two implementations at Bls12381<MinPk> and Bls12381<MinSig>.
…imal-public-key variants using a type-parameterized generic design
|
@rnbguy has refactored BLS12-381 signature scheme support with minimal-signature and minimal-public-key variants using a type-parameterized generic design |
|
can we have something like this ? // bls12381.rs
pub trait BlsVariant: Copy + 'static {
type SecretKey; type PublicKey: Clone; type Signature: Clone;
const PK_LEN: usize;
const SIG_LEN: usize;
const DST: &'static [u8];
fn verify(sig: &Self::Signature, msg: &[u8], pk: &Self::PublicKey) -> BLST_ERROR;
// + from_bytes/to_bytes for each type
}
// impl `SigningScheme` for any `Bls12381<V: BlsVariant>`
impl<V: BlsVariant> SigningScheme for Bls12381<V> {
type Signature = Signature<V>;
type PublicKey = PublicKey<V>;
// ...
}
// impl `SigningProvier` for `BlsProvider<V: BlsVariant>`
impl<C, V: BlsVariant> SigningProvider<C> for BlsProvider<V> ... { ... }
impl BlsVariant for MinPk { /* PK=48, SIG=96, blst::min_pk::* */ }
impl BlsVariant for MinSig { /* PK=96, SIG=48, blst::min_sig::* */ }then we can directly use, // minpk
type Bls12381MinPkScheme = Bls12381<MinPk>;
type Bls12381MinPkProvier = BlsProvider<MinPk>; |
…ts, eliminating duplication while keeping MinSig/MinPk type-safe and ergonomic
943d033 to
2720fff
Compare
|
@rnbguy Refactor BLS signing to a generic BlsVariant/Bls12381 with shared tests, eliminating duplication while keeping MinSig/MinPk type-safe and ergonomic. |
Uh oh!
There was an error while loading. Please reload this page.