Enum sn_api::PublicKey [−][src]
pub enum PublicKey { Ed25519(PublicKey), Bls(PublicKey), BlsShare(PublicKeyShare), }
Wrapper for different public key types.
Variants
Ed25519(PublicKey)
Ed25519 public key.
BLS public key.
BLS public key share.
Implementations
impl PublicKey
[src]
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<'de> Deserialize<'de> 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 PartialOrd<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 lt(&self, other: &Rhs) -> bool#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
pub fn le(&self, other: &Rhs) -> bool#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
pub fn ge(&self, other: &Rhs) -> boolimpl Serialize for PublicKey
[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 StructuralEq for PublicKey
[src]impl StructuralPartialEq for PublicKey
[src]
impl StructuralPartialEq for PublicKey
[src]Auto Trait Implementations
impl RefUnwindSafe for PublicKey
impl RefUnwindSafe for PublicKey
impl UnwindSafe for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> Instrument 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> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,