[][src]Struct private_box::PublicKey

#[repr(C)]pub struct PublicKey(pub [u8; 32]);

The public half of a Keypair.

Implementations

impl PublicKey[src]

pub const SIZE: usize[src]

Size of a public key, in bytes (== 32).

pub fn from_slice(s: &[u8]) -> Option<PublicKey>[src]

Deserialize a public key from a byte slice. The slice length must be 32.

pub fn from_base64(s: &str) -> Option<PublicKey>[src]

Deserialize from the base-64 representation. Ignores optional leading '@' sigil and '.ed25519' suffix.

Example

use ssb_crypto::PublicKey;
let author = "@H2qXeS5sOKUqaGNFgRJ6qR48+lAeP0C9lq9IVlQMotc=.ed25519";
let pk = PublicKey::from_base64(author).unwrap();

pub fn as_base64(&self) -> String[src]

Does not include ".ed25519" suffix or a prefix sigil.

Example

let s = "H2qXeS5sOKUqaGNFgRJ6qR48+lAeP0C9lq9IVlQMotc=";
let pk = ssb_crypto::PublicKey::from_base64(s).unwrap();
assert_eq!(pk.as_base64(), s);

pub fn verify(&self, sig: &Signature, b: &[u8]) -> bool[src]

Verify that a signature was generated by this key's secret half for the given bytes.

Trait Implementations

impl AsBytes for PublicKey[src]

impl Clone for PublicKey[src]

impl Copy for PublicKey[src]

impl Debug for PublicKey[src]

impl Eq for PublicKey[src]

impl FromBytes for PublicKey[src]

impl Hash for PublicKey[src]

impl Ord for PublicKey[src]

impl PartialEq<PublicKey> for PublicKey[src]

impl PartialOrd<PublicKey> for PublicKey[src]

impl StructuralEq for PublicKey[src]

impl StructuralPartialEq for PublicKey[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,