[][src]Struct types::PublicKey

pub struct PublicKey(_);

A single BLS signature.

This struct is a wrapper upon a base type and provides helper functions (e.g., SSZ serialization).


impl PublicKey[src]

pub fn from_secret_key(secret_key: &SecretKey) -> PublicKey[src]

pub fn from_raw(raw: PublicKey) -> PublicKey[src]

pub fn as_raw(&self) -> &PublicKey[src]

Returns the underlying signature.

pub fn as_bytes(&self) -> Vec<u8>[src]

Returns the underlying point as compressed bytes.

Identical to self.as_uncompressed_bytes().

pub fn from_bytes(bytes: &[u8]) -> Result<PublicKey, DecodeError>[src]

Converts compressed bytes to PublicKey

pub fn as_uncompressed_bytes(&self) -> Vec<u8>[src]

Returns the PublicKey as (x, y) bytes

pub fn from_uncompressed_bytes(bytes: &[u8]) -> Result<PublicKey, DecodeError>[src]

Converts (x, y) bytes to PublicKey

pub fn concatenated_hex_id(&self) -> String[src]

Returns the last 6 bytes of the SSZ encoding of the public key, as a hex string.

Useful for providing a short identifier to the user.

pub fn as_hex_string(&self) -> String[src]

Returns the point as a hex string of the SSZ encoding.

Note: the string is prefixed with 0x.

Trait Implementations

impl Debug for PublicKey[src]

impl Clone for PublicKey[src]

impl Decode for PublicKey[src]

impl Hash for PublicKey[src]

fn hash<H>(&self, state: &mut H) where
    H: Hasher

Note: this is distinct from consensus serialization, it will produce a different hash.

This method uses the uncompressed bytes, which are much faster to obtain than the compressed bytes required for consensus serialization.

Use ssz::Encode to obtain the bytes required for consensus hashing.

impl Default for PublicKey[src]

impl Eq for PublicKey[src]

impl Display for PublicKey[src]

impl From<PublicKey> for PublicKeyBytes[src]

impl TreeHash for PublicKey[src]

impl<'_> TryInto<PublicKey> for &'_ PublicKeyBytes[src]

type Error = DecodeError

The type returned in the event of a conversion error.

impl<'de> Deserialize<'de> for PublicKey[src]

impl Encode for PublicKey[src]

impl Serialize for PublicKey[src]

impl PartialEq<PublicKey> for PublicKey[src]

impl TestRandom for PublicKey[src]

Auto Trait Implementations

impl Send for PublicKey

impl Unpin for PublicKey

impl Sync for PublicKey

impl UnwindSafe for PublicKey

impl RefUnwindSafe for PublicKey

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

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

impl<T> From<T> for T[src]

impl<T> ToString for T where
    T: Display + ?Sized

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized