Enum enr::CombinedKey
source · pub enum CombinedKey {
Secp256k1(SigningKey),
Ed25519(SigningKey),
}
Expand description
A standard implementation of the EnrKey
trait used to sign and modify ENR records. The variants here represent the currently
supported in-built signing schemes.
Variants§
Implementations§
source§impl CombinedKey
impl CombinedKey
sourcepub fn generate_secp256k1() -> Self
pub fn generate_secp256k1() -> Self
Generates a new secp256k1 key.
sourcepub fn generate_ed25519() -> Self
pub fn generate_ed25519() -> Self
Generates a new ed25510 key.
sourcepub fn secp256k1_from_bytes(bytes: &mut [u8]) -> Result<Self, DecoderError>
pub fn secp256k1_from_bytes(bytes: &mut [u8]) -> Result<Self, DecoderError>
Imports a secp256k1 from raw bytes in any format.
sourcepub fn ed25519_from_bytes(bytes: &mut [u8]) -> Result<Self, DecoderError>
pub fn ed25519_from_bytes(bytes: &mut [u8]) -> Result<Self, DecoderError>
Imports an ed25519 key from raw 32 bytes.
Trait Implementations§
source§impl EnrKey for CombinedKey
impl EnrKey for CombinedKey
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.
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.
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.
type PublicKey = CombinedPublicKey
source§impl From<SigningKey<Secp256k1>> for CombinedKey
impl From<SigningKey<Secp256k1>> for CombinedKey
source§fn from(secret_key: SigningKey) -> Self
fn from(secret_key: SigningKey) -> Self
Converts to this type from the input type.
source§impl From<SigningKey> for CombinedKey
impl From<SigningKey> for CombinedKey
source§fn from(keypair: SigningKey) -> Self
fn from(keypair: SigningKey) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for CombinedKey
impl RefUnwindSafe for CombinedKey
impl Send for CombinedKey
impl Sync for CombinedKey
impl Unpin for CombinedKey
impl UnwindSafe for CombinedKey
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more