Enum casper_types::crypto::PublicKey
source · #[non_exhaustive]pub enum PublicKey {
System,
Ed25519(VerifyingKey),
Secp256k1(VerifyingKey),
}
Expand description
A public asymmetric key.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
System
System public key.
Ed25519(VerifyingKey)
Ed25519 public key.
Secp256k1(VerifyingKey)
secp256k1 public key.
Implementations§
source§impl PublicKey
impl PublicKey
sourcepub const SYSTEM_LENGTH: usize = 0usize
pub const SYSTEM_LENGTH: usize = 0usize
The length in bytes of a system public key.
sourcepub const ED25519_LENGTH: usize = 32usize
pub const ED25519_LENGTH: usize = 32usize
The length in bytes of an Ed25519 public key.
sourcepub const SECP256K1_LENGTH: usize = 33usize
pub const SECP256K1_LENGTH: usize = 33usize
The length in bytes of a secp256k1 public key.
sourcepub fn to_account_hash(&self) -> AccountHash
pub fn to_account_hash(&self) -> AccountHash
Creates an AccountHash
from a given PublicKey
instance.
Trait Implementations§
source§impl AsymmetricType<'_> for PublicKey
impl AsymmetricType<'_> for PublicKey
source§fn ed25519_from_bytes<T: AsRef<[u8]>>(bytes: T) -> Result<Self, Error>
fn ed25519_from_bytes<T: AsRef<[u8]>>(bytes: T) -> Result<Self, Error>
Constructs a new ed25519 variant from a byte slice.
source§fn secp256k1_from_bytes<T: AsRef<[u8]>>(bytes: T) -> Result<Self, Error>
fn secp256k1_from_bytes<T: AsRef<[u8]>>(bytes: T) -> Result<Self, Error>
Constructs a new secp256k1 variant from a byte slice.
source§impl<'de> Deserialize<'de> for PublicKey
impl<'de> Deserialize<'de> for PublicKey
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl From<&PublicKey> for AccountHash
impl From<&PublicKey> for AccountHash
source§impl Ord for PublicKey
impl Ord for PublicKey
source§impl PartialOrd for PublicKey
impl PartialOrd for PublicKey
source§impl ToBytes for PublicKey
impl ToBytes for PublicKey
source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the length of the
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.impl Eq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)