pub enum PublicKey {
    Ed25519(PublicKey),
    Secp256k1(PublicKey),
    Secp256r1(PublicKey),
    Secp384r1(PublicKey),
    Sr25519(PublicKey),
}
Expand description

A public key used for signing.

Variants§

§

Ed25519(PublicKey)

§

Secp256k1(PublicKey)

§

Secp256r1(PublicKey)

§

Secp384r1(PublicKey)

§

Sr25519(PublicKey)

Implementations§

source§

impl PublicKey

source

pub fn as_bytes(&self) -> &[u8]

Return a byte representation of this public key.

source

pub fn from_bytes(sig_type: SignatureType, bytes: &[u8]) -> Result<Self, Error>

Construct a public key from a slice of bytes.

source

pub fn verify( &self, context: &[u8], message: &[u8], signature: &Signature ) -> Result<(), Error>

Verify a signature.

source

pub fn verify_raw( &self, message: &[u8], signature: &Signature ) -> Result<(), Error>

Verify signature raw using the underlying method, without the domain separation schema.

source

pub fn verify_by_type( &self, signature_type: SignatureType, context_or_hash: &[u8], message: &[u8], signature: &Signature ) -> Result<(), Error>

Verify the signature of a message.

source

pub fn verify_batch_multisig( context: &[u8], message: &[u8], public_keys: &[PublicKey], signatures: &[Signature] ) -> Result<(), Error>

Verify a batch of signatures of the same message.

Trait Implementations§

source§

impl AsRef<[u8]> for PublicKey

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for PublicKey

source§

fn clone(&self) -> PublicKey

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PublicKey

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Decode for PublicKey

source§

fn try_from_cbor_value(value: Value) -> Result<Self, DecodeError>

Try to decode from a given CBOR value.
§

fn try_default() -> Result<Self, DecodeError>
where Self: Sized,

Try to decode from a missing/null/undefined value.
§

fn try_from_cbor_value_default(value: Value) -> Result<Self, DecodeError>
where Self: Sized,

Try to decode from a given CBOR value, calling try_default in case the value is null or undefined.
source§

impl Encode for PublicKey

source§

fn into_cbor_value(self) -> Value

Encode the type into a CBOR Value.
§

fn is_empty(&self) -> bool

Whether the value is equal to the empty value for the type.
source§

impl EncodeAsMap for PublicKey

§

fn into_cbor_value_map(self) -> Value
where Self: Sized,

Encode the type into a CBOR Map.
§

fn into_cbor_map(self) -> Vec<(Value, Value)>
where Self: Sized,

Encode the type into a CBOR Map, returning the map items.
source§

impl PartialEq for PublicKey

source§

fn eq(&self, other: &PublicKey) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for PublicKey

source§

impl StructuralPartialEq for PublicKey

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

§

impl<T> Base32Len for T
where T: AsRef<[u8]>,

§

fn base32_len(&self) -> usize

Calculate the base32 serialized length
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CheckBase32<Vec<u5>> for T
where T: AsRef<[u8]>,

§

type Err = Error

Error type if conversion fails
§

fn check_base32(self) -> Result<Vec<u5>, <T as CheckBase32<Vec<u5>>>::Err>

Check if all values are in range and return array-like struct of u5 values
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T> ToBase32 for T
where T: AsRef<[u8]>,

§

fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>
where W: WriteBase32,

Encode as base32 and write it to the supplied writer Implementations shouldn’t allocate.
§

fn to_base32(&self) -> Vec<u5>

Convert Self to base32 vector
source§

impl<T> ToHex for T
where T: AsRef<[u8]>,

source§

fn encode_hex<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca)
source§

fn encode_hex_upper<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

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

§

fn vzip(self) -> V

§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,