Enum CombinedKey
pub enum CombinedKey {
Secp256k1(SigningKey<Secp256k1>),
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§
§impl CombinedKey
impl CombinedKey
pub fn generate_secp256k1() -> CombinedKey
pub fn generate_secp256k1() -> CombinedKey
Generates a new secp256k1 key.
pub fn generate_ed25519() -> CombinedKey
pub fn generate_ed25519() -> CombinedKey
Generates a new ed25510 key.
pub fn secp256k1_from_bytes(bytes: &mut [u8]) -> Result<CombinedKey, Error>
pub fn secp256k1_from_bytes(bytes: &mut [u8]) -> Result<CombinedKey, Error>
Imports a secp256k1 from raw bytes in any format.
pub fn ed25519_from_bytes(bytes: &mut [u8]) -> Result<CombinedKey, Error>
pub fn ed25519_from_bytes(bytes: &mut [u8]) -> Result<CombinedKey, Error>
Imports an ed25519 key from raw 32 bytes.
Trait Implementations§
§impl EnrKey for CombinedKey
impl EnrKey for CombinedKey
§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.
§fn public(&self) -> <CombinedKey as EnrKey>::PublicKey
fn public(&self) -> <CombinedKey as EnrKey>::PublicKey
Returns the public key associated with the private key.
§fn enr_to_public(
content: &BTreeMap<Vec<u8>, Bytes>,
) -> Result<<CombinedKey as EnrKey>::PublicKey, Error>
fn enr_to_public( content: &BTreeMap<Vec<u8>, Bytes>, ) -> Result<<CombinedKey as EnrKey>::PublicKey, Error>
Decodes the raw bytes of an ENR’s content into a public key if possible.
type PublicKey = CombinedPublicKey
§impl From<SigningKey<Secp256k1>> for CombinedKey
impl From<SigningKey<Secp256k1>> for CombinedKey
§fn from(secret_key: SigningKey<Secp256k1>) -> CombinedKey
fn from(secret_key: SigningKey<Secp256k1>) -> CombinedKey
§impl From<SigningKey> for CombinedKey
impl From<SigningKey> for CombinedKey
§fn from(keypair: SigningKey) -> CombinedKey
fn from(keypair: SigningKey) -> CombinedKey
Auto Trait Implementations§
impl Freeze for CombinedKey
impl RefUnwindSafe for CombinedKey
impl Send for CombinedKey
impl Sync for CombinedKey
impl Unpin for CombinedKey
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 232 bytes
Size for each variant:
Secp256k1: 136 bytesEd25519: 224 bytes