pub trait PublicKey:
Clone
+ Display
+ Debug
+ PartialEq
+ Eq
+ Hash
+ ToBase58 {
type Signature: Signature;
// Required methods
fn from_base58(base58_string: &str) -> Result<Self, BaseConversionError>;
fn to_bytes_vector(&self) -> Vec<u8> ⓘ;
fn verify(
&self,
message: &[u8],
signature: &Self::Signature,
) -> Result<(), SigError>;
}
Expand description
Define the operations that can be performed on a cryptographic public key.
A PublicKey
can be converted from/to Base64 format.
When converted back and forth the value should be the same.
A PublicKey
is used to verify the signature of a message
with the associated PrivateKey
.
Required Associated Types§
Required Methods§
Sourcefn from_base58(base58_string: &str) -> Result<Self, BaseConversionError>
fn from_base58(base58_string: &str) -> Result<Self, BaseConversionError>
Create a PublicKey from a Base58 string.
The Base58 string should contains only valid Base58 characters
and have a correct length. If it’s not the case,
a BaseConvertionError
is returned with the corresponding variant.
Sourcefn to_bytes_vector(&self) -> Vec<u8> ⓘ
fn to_bytes_vector(&self) -> Vec<u8> ⓘ
Convert into bytes vector
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.