[][src]Trait enr::EnrKey

pub trait EnrKey {
    type PublicKey: EnrPublicKey + Clone;
    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...

Implementations on Foreign Types

impl EnrKey for Keypair[src]

type PublicKey = PublicKey

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

Performs ENR-specific signing.

Using ed25519 keys do not currently follow the v4 identity scheme, which dictates secp256k1 keys should be used.

fn public(&self) -> Self::PublicKey[src]

Returns the public key associated with the private key.

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.

impl EnrKey for SecretKey[src]

type PublicKey = PublicKey

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

Performs ENR-specific signing.

currently lists the v4 identity scheme which requires the secp256k1 signing algorithm. Using secp256k1 keys follow the v4 identity scheme.

fn public(&self) -> Self::PublicKey[src]

Returns the public key associated with the private key.

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.

impl EnrKey for SecretKey[src]

type PublicKey = PublicKey

Loading content...

Implementors

impl EnrKey for CombinedKey[src]

type PublicKey = CombinedPublicKey

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 public(&self) -> Self::PublicKey[src]

Returns the public key associated with the private key.

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...