pub trait BlsPublicKeyType: 'static {
    type Buffer: Clone + Debug + PartialEq + Sized + Zeroize;
    type BufferSize: ArrayLength<u8>;

    const ALG_TYPE: BlsCurves;
    const JWK_CURVE: &'static str;

    // Required methods
    fn from_secret_scalar(secret: &Scalar) -> Self::Buffer;
    fn from_public_bytes(key: &[u8]) -> Result<Self::Buffer, Error>;
    fn with_bytes<O>(
        buf: &Self::Buffer,
        alg: Option<KeyAlg>,
        f: impl FnOnce(&[u8]) -> O
    ) -> O;

    // Provided method
    fn get_jwk_curve(_alg: Option<KeyAlg>) -> &'static str { ... }
}
Available on crate feature bls only.
Expand description

Trait implemented by supported BLS public key types

Required Associated Types§

source

type Buffer: Clone + Debug + PartialEq + Sized + Zeroize

The concrete key representation

source

type BufferSize: ArrayLength<u8>

The size of the serialized public key

Required Associated Constants§

source

const ALG_TYPE: BlsCurves

The associated algorithm type

source

const JWK_CURVE: &'static str

The associated JWK curve name

Required Methods§

source

fn from_secret_scalar(secret: &Scalar) -> Self::Buffer

Initialize from the secret scalar

source

fn from_public_bytes(key: &[u8]) -> Result<Self::Buffer, Error>

Initialize from the compressed bytes

source

fn with_bytes<O>( buf: &Self::Buffer, alg: Option<KeyAlg>, f: impl FnOnce(&[u8]) -> O ) -> O

Access the bytes of the public key

Provided Methods§

source

fn get_jwk_curve(_alg: Option<KeyAlg>) -> &'static str

Get the JWK curve for a specific key algorithm

Object Safety§

This trait is not object safe.

Implementors§

source§

impl BlsPublicKeyType for G1

§

type Buffer = G1Affine

§

type BufferSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>, B0>

source§

const ALG_TYPE: BlsCurves = BlsCurves::G1

source§

const JWK_CURVE: &'static str = "BLS12381_G1"

source§

impl BlsPublicKeyType for G1G2

§

type Buffer = G1G2Pair

§

type BufferSize = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>, B0>, B0>, B0>, B0>

source§

const ALG_TYPE: BlsCurves = BlsCurves::G1G2

source§

const JWK_CURVE: &'static str = "BLS12381_G1G2"

source§

impl BlsPublicKeyType for G2

§

type Buffer = G2Affine

§

type BufferSize = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>, B0>, B0>

source§

const ALG_TYPE: BlsCurves = BlsCurves::G2

source§

const JWK_CURVE: &'static str = "BLS12381_G2"