Skip to main content

BlsSigner

Struct BlsSigner 

Source
pub struct BlsSigner { /* private fields */ }
Expand description

BLS12-381 signer for Ethereum PoS.

Implementations§

Source§

impl BlsSigner

Source

pub fn public_key(&self) -> BlsPublicKey

Get the public key.

Trait Implementations§

Source§

impl Drop for BlsSigner

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl KeyPair for BlsSigner

Source§

fn generate() -> Result<Self, SignerError>

Generate a new random key pair using OS entropy (CSPRNG).
Source§

fn from_bytes(private_key: &[u8]) -> Result<Self, SignerError>

Reconstruct a key pair from raw private key bytes (32 bytes).
Source§

fn private_key_bytes(&self) -> Zeroizing<Vec<u8>>

Export the private key as auto-zeroizing bytes. The returned Zeroizing<Vec<u8>> will scrub the memory on drop.
Source§

fn from_keypair_bytes(keypair: &[u8]) -> Result<Self, <Self as Signer>::Error>
where Self: Sized,

Reconstruct a key pair from a 64-byte expanded keypair (seed ∥ pubkey). Default impl uses only the first 32 bytes (seed).
Source§

fn keypair_bytes(&self) -> Zeroizing<Vec<u8>>

Export the full keypair as private_key ∥ public_key. Default: 32B seed + compressed pubkey.
Source§

impl Signer for BlsSigner

Source§

fn sign_prehashed(&self, digest: &[u8]) -> Result<BlsSignature, SignerError>

Note: BLS uses hash-to-curve (H2C) internally. This method is identical to sign() — the digest parameter is treated as a raw message, not a pre-computed hash. For consistency with the Signer trait, this is provided as-is.

Source§

type Signature = BlsSignature

The signature type produced by this signer.
Source§

type Error = SignerError

The error type returned on failure.
Source§

fn sign(&self, message: &[u8]) -> Result<BlsSignature, SignerError>

Sign a raw message. The implementation applies chain-specific hashing internally (e.g., Keccak-256 for Ethereum, double-SHA-256 for Bitcoin).
Source§

fn public_key_bytes(&self) -> Vec<u8>

Return the public key as bytes (compressed format where applicable). Read more
Source§

fn public_key_bytes_uncompressed(&self) -> Vec<u8>

Return the public key in uncompressed format. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.