Type Alias sp_core::sr25519::Public

source ·
pub type Public = CryptoBytes<PUBLIC_KEY_SERIALIZED_SIZE, Sr25519PublicTag>;
Expand description

An Schnorrkel/Ristretto x25519 (“sr25519”) public key.

Aliased Type§

struct Public(pub [u8; 32], _);

Fields§

§0: [u8; 32]

Implementations§

source§

impl Public

source

pub fn make_bytes<const N: usize>( &self, context: &[u8], input: &VrfInput, pre_output: &VrfPreOutput, ) -> Result<[u8; N], Error>
where [u8; N]: Default,

Generate output bytes from the given VRF configuration.

source§

impl<T> CryptoBytes<32, T>

source

pub fn from_h256(x: H256) -> Self

A new instance from an H256.

source§

impl<T> CryptoBytes<64, T>

source

pub fn from_h512(x: H512) -> Self

A new instance from an H512.

source§

impl<const N: usize, T> CryptoBytes<N, T>

source

pub fn from_raw(inner: [u8; N]) -> Self

Construct from raw array.

source

pub fn to_raw(self) -> [u8; N]

Construct from raw array.

source

pub fn as_array_ref(&self) -> &[u8; N]

Return a slice filled with raw data.

Trait Implementations§

source§

impl CryptoType for Public

§

type Pair = Pair

The pair key type of this crypto.
source§

impl Debug for Public

source§

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

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

impl Derive for Public

source§

fn derive<Iter: Iterator<Item = DeriveJunction>>( &self, path: Iter, ) -> Option<Public>

Derive a child key from a series of given junctions.

None if there are any hard junctions in there.

source§

impl<'de> Deserialize<'de> for Public

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Public

source§

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

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

impl FromStr for Public

§

type Err = PublicError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Serialize for Public

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl VrfCrypto for Public

§

type VrfInput = VrfTranscript

VRF input.
§

type VrfPreOutput = VrfPreOutput

VRF pre-output.
§

type VrfSignData = VrfSignData

VRF signing data.
§

type VrfSignature = VrfSignature

VRF signature.
source§

impl VrfPublic for Public

source§

fn vrf_verify( &self, data: &Self::VrfSignData, signature: &Self::VrfSignature, ) -> bool

Verify input data signature.
source§

impl Public for Public

source§

impl<const N: usize, T> AsMut<[u8]> for CryptoBytes<N, T>

source§

fn as_mut(&mut self) -> &mut [u8]

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

impl<const N: usize, T> AsMut<[u8; N]> for CryptoBytes<N, T>

source§

fn as_mut(&mut self) -> &mut [u8; N]

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

impl<const N: usize, T> AsRef<[u8]> for CryptoBytes<N, T>

source§

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

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

impl<const N: usize, T> AsRef<[u8; N]> for CryptoBytes<N, T>

source§

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

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

impl<const N: usize, T> ByteArray for CryptoBytes<N, T>

source§

const LEN: usize = N

The “length” of the values of this type, which is always the same.
source§

fn from_slice(data: &[u8]) -> Result<Self, ()>

A new instance from the given slice that should be Self::LEN bytes long.
source§

fn to_raw_vec(&self) -> Vec<u8>

Return a Vec<u8> filled with raw data.
source§

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

Return a slice filled with raw data.
source§

impl<const N: usize, T> Clone for CryptoBytes<N, T>

source§

fn clone(&self) -> Self

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<const N: usize, T> Decode for CryptoBytes<N, T>
where PhantomData<fn() -> T>: Decode,

source§

fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>

Attempt to deserialise the value from input.
source§

fn decode_into<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, dst_: &mut MaybeUninit<Self>, ) -> Result<DecodeFinished, Error>

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
source§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
source§

impl<const N: usize, T> Default for CryptoBytes<N, T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<const N: usize, T> Deref for CryptoBytes<N, T>

§

type Target = [u8]

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<const N: usize, T> Encode for CryptoBytes<N, T>
where PhantomData<fn() -> T>: Encode,

source§

fn size_hint(&self) -> usize

If possible give a hint of expected size of the encoding. Read more
source§

fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )

Convert self to a slice and append it to the destination.
source§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
source§

fn using_encoded<R, F>(&self, f: F) -> R
where F: FnOnce(&[u8]) -> R,

Convert self to a slice and then invoke the given closure with it.
source§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
source§

impl<const N: usize, T> From<[u8; N]> for CryptoBytes<N, T>

source§

fn from(value: [u8; N]) -> Self

Converts to this type from the input type.
source§

impl<const N: usize, T> FromEntropy for CryptoBytes<N, T>

source§

fn from_entropy(input: &mut impl Input) -> Result<Self, Error>

Create a random value of Self given a stream of random bytes on input. May only fail if input has an error.
source§

impl<const N: usize, T> Hash for CryptoBytes<N, T>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<const N: usize, T> MaxEncodedLen for CryptoBytes<N, T>
where PhantomData<fn() -> T>: MaxEncodedLen,

source§

fn max_encoded_len() -> usize

Upper bound, in bytes, of the maximum encoded size of this item.
source§

impl<const N: usize, T> Ord for CryptoBytes<N, T>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<const N: usize, T> PartialEq for CryptoBytes<N, T>

source§

fn eq(&self, other: &Self) -> 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<const N: usize, T> PartialOrd for CryptoBytes<N, T>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<const N: usize, T> PassBy for CryptoBytes<N, T>

§

type PassBy = Inner<CryptoBytes<N, T>, [u8; N]>

The strategy that should be used to pass the type.
source§

impl<const N: usize, T> PassByInner for CryptoBytes<N, T>

§

type Inner = [u8; N]

The inner type that is wrapped by Self.
source§

fn into_inner(self) -> Self::Inner

Consumes self and returns the inner type.
source§

fn inner(&self) -> &Self::Inner

Returns the reference to the inner type.
source§

fn from_inner(inner: Self::Inner) -> Self

Construct Self from the given inner.
source§

impl<const N: usize, T> TryFrom<&[u8]> for CryptoBytes<N, T>

§

type Error = ()

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

fn try_from(data: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<const N: usize, T> TypeInfo for CryptoBytes<N, T>

§

type Identity = [u8; N]

The type identifying for which type info is provided. Read more
source§

fn type_info() -> Type

Returns the static type identifier for Self.
source§

impl<const N: usize, T> UncheckedFrom<[u8; N]> for CryptoBytes<N, T>

source§

fn unchecked_from(data: [u8; N]) -> Self

Convert from an instance of T to Self. This is not guaranteed to be whatever counts as a valid instance of T and it’s up to the caller to ensure that it makes sense.
source§

impl<T> UncheckedFrom<H256> for CryptoBytes<32, T>

source§

fn unchecked_from(x: H256) -> Self

Convert from an instance of T to Self. This is not guaranteed to be whatever counts as a valid instance of T and it’s up to the caller to ensure that it makes sense.
source§

impl<const N: usize, T> Copy for CryptoBytes<N, T>

source§

impl<const N: usize, T> EncodeLike for CryptoBytes<N, T>
where PhantomData<fn() -> T>: Encode,

source§

impl<const N: usize, T> Eq for CryptoBytes<N, T>