pub trait PublicKey: Clone + Sized {
const LENGTH: usize;
// Required methods
fn from_bytes(bytes: &[u8]) -> AptosResult<Self>;
fn to_bytes(&self) -> Vec<u8> ⓘ;
// Provided method
fn to_hex(&self) -> String { ... }
}Expand description
A trait for public key types.
Required Associated Constants§
Required Methods§
Sourcefn from_bytes(bytes: &[u8]) -> AptosResult<Self>
fn from_bytes(bytes: &[u8]) -> AptosResult<Self>
Creates a public key from bytes.
§Errors
Returns an error if the bytes have an invalid length or format.
Provided Methods§
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.
Implementors§
Source§impl PublicKey for Bls12381PublicKey
Available on crate feature bls only.
impl PublicKey for Bls12381PublicKey
Available on crate feature
bls only.Source§impl PublicKey for Ed25519PublicKey
Available on crate feature ed25519 only.
impl PublicKey for Ed25519PublicKey
Available on crate feature
ed25519 only.Source§impl PublicKey for MultiEd25519PublicKey
Available on crate feature ed25519 only.
impl PublicKey for MultiEd25519PublicKey
Available on crate feature
ed25519 only.Source§impl PublicKey for Secp256k1PublicKey
Available on crate feature secp256k1 only.
impl PublicKey for Secp256k1PublicKey
Available on crate feature
secp256k1 only.