Enum sn_api::PublicKey [−][src]
Wrapper for different public key types.
Variants
Ed25519(PublicKey)
Ed25519 public key.
BLS public key.
BLS public key share.
Implementations
impl PublicKey
[src]
pub fn ed25519_from_hex(hex: &str) -> Result<PublicKey, Error>
[src]
Construct and ed25519 public key from a hex-encoded string.
It is often useful to parse such raw strings in user-facing apps like CLI
pub fn bls_from_hex(hex: &str) -> Result<PublicKey, Error>
[src]
Construct and ed25519 public key from a hex-encoded string.
It is often useful to parse such raw strings in user-facing apps like CLI
pub fn to_bytes(&self) -> Vec<u8, Global>
[src]
Returns the bytes of the underlying public key
pub fn ed25519(&self) -> Option<PublicKey>
[src]
Returns the ed25519 key, if applicable.
pub fn bls(&self) -> Option<PublicKey>
[src]
Returns the BLS key, if applicable.
pub fn bls_share(&self) -> Option<PublicKeyShare>
[src]
Returns the BLS key share, if applicable.
pub fn verify<T>(&self, signature: &Signature, data: T) -> Result<(), Error> where
T: AsRef<[u8]>,
[src]
T: AsRef<[u8]>,
Returns Ok(())
if signature
matches the message and Err(Error::InvalidSignature)
otherwise.
pub fn encode_to_zbase32(&self) -> Result<String, Error>
[src]
Returns the PublicKey
serialised and encoded in z-base-32.
pub fn decode_from_zbase32<I>(encoded: I) -> Result<PublicKey, Error> where
I: AsRef<str>,
[src]
I: AsRef<str>,
Creates from z-base-32 encoded string.
Trait Implementations
impl Clone for PublicKey
[src]
impl Copy for PublicKey
[src]
impl Debug for PublicKey
[src]
impl<'de> Deserialize<'de> for PublicKey
[src]
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<PublicKey, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<PublicKey, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl Display for PublicKey
[src]
impl Eq for PublicKey
[src]
impl<'_> From<&'_ Keypair> for PublicKey
[src]
impl From<PublicKey> for PublicKey
[src]
impl From<PublicKey> for PublicKey
[src]
impl From<PublicKey> for XorName
[src]
impl From<PublicKeyShare> for PublicKey
[src]
impl Hash for PublicKey
[src]
pub fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl LowerHex for PublicKey
[src]
pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
[src]
Useful for displaying public key in user-facing apps E.g. in cli and in human-readable messaging like for sn_authd
impl Ord for PublicKey
[src]
pub fn cmp(&self, other: &PublicKey) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<PublicKey> for PublicKey
[src]
impl PartialOrd<PublicKey> for PublicKey
[src]
pub fn partial_cmp(&self, other: &PublicKey) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for PublicKey
[src]
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
impl StructuralEq for PublicKey
[src]
impl StructuralPartialEq for PublicKey
[src]
impl TryFrom<QueryResponse> for PublicKey
type Error = TryFromError
The type returned in the event of a conversion error.
pub fn try_from(
response: QueryResponse
) -> Result<PublicKey, <PublicKey as TryFrom<QueryResponse>>::Error>
response: QueryResponse
) -> Result<PublicKey, <PublicKey as TryFrom<QueryResponse>>::Error>
impl UpperHex for PublicKey
[src]
Auto Trait Implementations
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations
impl<A> Actor for A where
A: Ord + Clone + Hash,
A: Ord + Clone + Hash,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Member for T where
T: Clone + Hash + Eq,
T: Clone + Hash + Eq,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,