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, DecoderError>;
}
Expand description
The trait required for a key to sign and modify an ENR record.
Required Associated Types§
type PublicKey: EnrPublicKey + Clone
Required Methods§
Sourcefn 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.
Sourcefn enr_to_public(
content: &BTreeMap<Vec<u8>, Bytes>,
) -> Result<Self::PublicKey, DecoderError>
fn enr_to_public( content: &BTreeMap<Vec<u8>, Bytes>, ) -> 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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl EnrKey for SigningKey
impl EnrKey for SigningKey
Source§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.
Source§fn enr_to_public(
content: &BTreeMap<Vec<u8>, Bytes>,
) -> Result<Self::PublicKey, DecoderError>
fn enr_to_public( content: &BTreeMap<Vec<u8>, Bytes>, ) -> Result<Self::PublicKey, DecoderError>
Decodes the raw bytes of an ENR’s content into a public key if possible.