[][src]Trait enr::EnrKey

pub trait EnrKey {
    type PublicKey: EnrPublicKey + Clone + Into<String>;
    fn sign_v4(&self, msg: &[u8]) -> Result<Vec<u8>, SigningError>;
fn public(&self) -> Self::PublicKey;
fn enr_to_public(
        content: &BTreeMap<String, Vec<u8>>
    ) -> Result<Self::PublicKey, DecoderError>; }

The trait required for a key to sign and modify an ENR record.

Associated Types

Loading content...

Required methods

fn sign_v4(&self, msg: &[u8]) -> Result<Vec<u8>, SigningError>

Performs ENR-specific signing for the v4 identity scheme.

fn public(&self) -> Self::PublicKey

Returns the public key associated with current key pair.

fn enr_to_public(
    content: &BTreeMap<String, Vec<u8>>
) -> Result<Self::PublicKey, DecoderError>

Provides a method to decode a raw public key from an ENR BTreeMap to a useable public key.

This method allows a key type to decode the raw bytes in an ENR to a useable EnrPublicKey. It takes the ENR's BTreeMap and returns a public key.

Note: This specifies the supported key schemes for an ENR.

Loading content...

Implementors

impl EnrKey for DefaultKey[src]

type PublicKey = DefaultPublicKey

fn sign_v4(&self, msg: &[u8]) -> Result<Vec<u8>, SigningError>[src]

Performs ENR-specific signing.

Note: that this library supports a number of signing algorithms. The ENR specification currently lists the v4 identity scheme which requires the secp256k1 signing algorithm. Using secp256k1 keys follow the v4 identity scheme, using other types do not, although they are supported.

fn enr_to_public(
    content: &BTreeMap<String, Vec<u8>>
) -> Result<Self::PublicKey, DecoderError>
[src]

Decodes the raw bytes of an ENR's content into a public key if possible.

Loading content...