pub struct PublicKey { /* private fields */ }Expand description
A voter’s public identity. Safe to publish.
Internally a Ristretto255 point; externally 32 bytes.
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn to_bytes(&self) -> [u8; 32]
pub fn to_bytes(&self) -> [u8; 32]
Encode the key as 32 canonical bytes (compressed Ristretto).
Sourcepub fn from_bytes(bytes: &[u8; 32]) -> Result<Self>
pub fn from_bytes(bytes: &[u8; 32]) -> Result<Self>
Decode 32 bytes produced by PublicKey::to_bytes.
Returns Error::InvalidPoint if the bytes are not the canonical
encoding of a point in the Ristretto255 group.
Sourcepub fn to_prefixed(&self) -> String
pub fn to_prefixed(&self) -> String
Encode in the human-friendly prefixed format: pk_<hex>_<checksum>.
Same bytes as PublicKey::to_hex, wrapped with a pk_ tag and a
checksum. See crate::encoding.
Sourcepub fn from_prefixed(s: &str) -> Result<Self>
pub fn from_prefixed(s: &str) -> Result<Self>
Decode a pk_<hex>_<checksum> string produced by
PublicKey::to_prefixed, verifying the tag and the checksum.
Trait Implementations§
impl Copy for PublicKey
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 UnsafeUnpin 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