pub struct PublicKey { /* private fields */ }
Expand description
Public key in a binary format with base58 string serialization with human-readable curve.
The key types currently supported are secp256k1
and ed25519
.
Ed25519 public keys accepted are 32 bytes and secp256k1 keys are the uncompressed 64 format.
Example
use near_sdk::PublicKey;
// Compressed ed25519 key
let ed: PublicKey = "ed25519:6E8sCci9badyRkXb3JoRpBj5p8C6Tw41ELDZoiihKEtp".parse()
.unwrap();
// Uncompressed secp256k1 key
let secp256k1: PublicKey = "secp256k1:qMoRgcoXai4mBPsdbHi1wfyxF9TdbPCF4qSDQTRP3TfescSRoUdSx6nmeQoN3aiwGzwMyGXAb1gUjBTv5AY8DXj"
.parse()
.unwrap();
Implementations
Returns a byte slice of this PublicKey
’s contents.
Converts a PublicKey
into a byte vector.
Get info about the CurveType for this public key
Trait Implementations
Deserialize this value from the given Serde deserializer. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.