Trait EnrKey
pub trait EnrKey:
Send
+ Sync
+ Unpin
+ 'static {
type PublicKey: EnrPublicKey + Clone;
// Required methods
fn sign_v4(&self, msg: &[u8]) -> Result<Vec<u8>, SigningError>;
fn public(&self) -> Self::PublicKey;
fn enr_to_public(
content: &BTreeMap<Vec<u8>, Bytes>,
) -> Result<Self::PublicKey, Error>;
}Expand description
The trait required for a key to sign and modify an ENR record.
Required Associated Types§
Required Methods§
fn sign_v4(&self, msg: &[u8]) -> Result<Vec<u8>, SigningError>
fn sign_v4(&self, msg: &[u8]) -> Result<Vec<u8>, SigningError>
Performs ENR-specific signing for the v4 identity scheme.
fn enr_to_public(
content: &BTreeMap<Vec<u8>, Bytes>,
) -> Result<Self::PublicKey, Error>
fn enr_to_public( content: &BTreeMap<Vec<u8>, Bytes>, ) -> Result<Self::PublicKey, Error>
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
§impl EnrKey for SigningKey
impl EnrKey for SigningKey
§fn sign_v4(&self, msg: &[u8]) -> Result<Vec<u8>, SigningError>
fn sign_v4(&self, msg: &[u8]) -> Result<Vec<u8>, SigningError>
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) -> <SigningKey as EnrKey>::PublicKey
fn public(&self) -> <SigningKey as EnrKey>::PublicKey
Returns the public key associated with the private key.
§fn enr_to_public(
content: &BTreeMap<Vec<u8>, Bytes>,
) -> Result<<SigningKey as EnrKey>::PublicKey, Error>
fn enr_to_public( content: &BTreeMap<Vec<u8>, Bytes>, ) -> Result<<SigningKey as EnrKey>::PublicKey, Error>
Decodes the raw bytes of an ENR’s content into a public key if possible.