pub enum PublicKey {
ED25519(ED25519PublicKey),
SECP256K1(Secp256K1PublicKey),
RSA(Rsa2048PublicKey),
}Expand description
Public key container supporting different curves.
Variants§
ED25519(ED25519PublicKey)
256 bit elliptic curve based public-key.
SECP256K1(Secp256K1PublicKey)
512 bit elliptic curve based public-key used in Bitcoin’s public-key cryptography.
RSA(Rsa2048PublicKey)
2048 bit rsa
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn from_near_implicit_account(
account_id: &AccountId,
) -> Result<Self, ImplicitPublicKeyError>
pub fn from_near_implicit_account( account_id: &AccountId, ) -> Result<Self, ImplicitPublicKeyError>
Create the implicit public key from an NEAR-implicit account ID.
Returns ImplicitPublicKeyError::AccountIsNotNearImplicit if the given
account id is not a valid NEAR-implicit account ID.
See near_account_id::AccountId for the definition.
Source§impl PublicKey
impl PublicKey
pub fn len(&self) -> usize
pub fn empty(key_type: KeyType) -> Self
pub fn key_type(&self) -> KeyType
pub fn key_data(&self) -> &[u8] ⓘ
pub fn unwrap_as_ed25519(&self) -> &ED25519PublicKey
pub fn unwrap_as_secp256k1(&self) -> &Secp256K1PublicKey
pub fn unwrap_as_rsa2048(&self) -> &Rsa2048PublicKey
Trait Implementations§
Source§impl BorshDeserialize for PublicKey
impl BorshDeserialize for PublicKey
fn deserialize_reader<R: Read>(rd: &mut R) -> Result<Self>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for PublicKey
impl BorshSerialize for PublicKey
Source§impl<'de> Deserialize<'de> for PublicKey
impl<'de> Deserialize<'de> for PublicKey
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<ED25519PublicKey> for PublicKey
impl From<ED25519PublicKey> for PublicKey
Source§fn from(ed25519: ED25519PublicKey) -> Self
fn from(ed25519: ED25519PublicKey) -> Self
Converts to this type from the input type.
Source§impl From<Rsa2048PublicKey> for PublicKey
impl From<Rsa2048PublicKey> for PublicKey
Source§fn from(rsa2048: Rsa2048PublicKey) -> Self
fn from(rsa2048: Rsa2048PublicKey) -> Self
Converts to this type from the input type.
Source§impl From<Secp256K1PublicKey> for PublicKey
impl From<Secp256K1PublicKey> for PublicKey
Source§fn from(secp256k1: Secp256K1PublicKey) -> Self
fn from(secp256k1: Secp256K1PublicKey) -> Self
Converts to this type from the input type.
Source§impl Ord for PublicKey
impl Ord for PublicKey
Source§impl PartialOrd for PublicKey
impl PartialOrd for PublicKey
Source§impl Serialize for PublicKey
impl Serialize for PublicKey
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
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