pub type Ed25519PubKey = BinDataSized<32>;
Expand description

Ed25519 signature public key derived from this seed.

Aliased Type§

struct Ed25519PubKey(pub Arc<[u8; 32], Global>);

Fields§

§0: Arc<[u8; 32], Global>

Implementations§

§

impl<const N: usize> BinDataSized<N>

pub fn cloned_inner(&self) -> Arc<[u8; N], Global>

Get a clone of our inner Arc<[u8; N]>

§

impl BinDataSized<32>

pub async fn verify_detached<M>( &self, signature: BinDataSized<64>, message: M ) -> impl Future<Output = Result<bool, OneErr>>where M: Into<BufRead> + 'static + Send,

Treat this bin data as an ed25519 public key, and use it to verify a signature over a given message.

Methods from Deref<Target = [u8; N]>§

source

pub fn as_ascii(&self) -> Option<&[AsciiChar; N]>

🔬This is a nightly-only experimental API. (ascii_char)

Converts this array of bytes into a array of ASCII characters, or returns None if any of the characters is non-ASCII.

Examples
#![feature(ascii_char)]
#![feature(const_option)]

const HEX_DIGITS: [std::ascii::Char; 16] =
    *b"0123456789abcdef".as_ascii().unwrap();

assert_eq!(HEX_DIGITS[1].as_str(), "1");
assert_eq!(HEX_DIGITS[10].as_str(), "a");
source

pub unsafe fn as_ascii_unchecked(&self) -> &[AsciiChar; N]

🔬This is a nightly-only experimental API. (ascii_char)

Converts this array of bytes into a array of ASCII characters, without checking whether they’re valid.

Safety

Every byte in the array must be in 0..=127, or else this is UB.

1.57.0 · source

pub fn as_slice(&self) -> &[T]

Returns a slice containing the entire array. Equivalent to &s[..].

source

pub fn each_ref(&self) -> [&T; N]

🔬This is a nightly-only experimental API. (array_methods)

Borrows each element and returns an array of references with the same size as self.

Example
#![feature(array_methods)]

let floats = [3.1, 2.7, -1.0];
let float_refs: [&f64; 3] = floats.each_ref();
assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);

This method is particularly useful if combined with other methods, like map. This way, you can avoid moving the original array if its elements are not Copy.

#![feature(array_methods)]

let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()];
let is_ascii = strings.each_ref().map(|s| s.is_ascii());
assert_eq!(is_ascii, [true, false, true]);

// We can still access the original array: it has not been moved.
assert_eq!(strings.len(), 3);
source

pub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])

🔬This is a nightly-only experimental API. (split_array)

Divides one array reference into two at an index.

The first will contain all indices from [0, M) (excluding the index M itself) and the second will contain all indices from [M, N) (excluding the index N itself).

Panics

Panics if M > N.

Examples
#![feature(split_array)]

let v = [1, 2, 3, 4, 5, 6];

{
   let (left, right) = v.split_array_ref::<0>();
   assert_eq!(left, &[]);
   assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}

{
    let (left, right) = v.split_array_ref::<2>();
    assert_eq!(left, &[1, 2]);
    assert_eq!(right, &[3, 4, 5, 6]);
}

{
    let (left, right) = v.split_array_ref::<6>();
    assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
    assert_eq!(right, &[]);
}
source

pub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])

🔬This is a nightly-only experimental API. (split_array)

Divides one array reference into two at an index from the end.

The first will contain all indices from [0, N - M) (excluding the index N - M itself) and the second will contain all indices from [N - M, N) (excluding the index N itself).

Panics

Panics if M > N.

Examples
#![feature(split_array)]

let v = [1, 2, 3, 4, 5, 6];

{
   let (left, right) = v.rsplit_array_ref::<0>();
   assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
   assert_eq!(right, &[]);
}

{
    let (left, right) = v.rsplit_array_ref::<2>();
    assert_eq!(left, &[1, 2, 3, 4]);
    assert_eq!(right, &[5, 6]);
}

{
    let (left, right) = v.rsplit_array_ref::<6>();
    assert_eq!(left, &[]);
    assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}

pub fn cloned_inner(&self) -> Arc<[u8; N], Global>

Get a clone of our inner Arc<[u8; N]>

pub async fn verify_detached<M>( &self, signature: BinDataSized<64>, message: M ) -> impl Future<Output = Result<bool, OneErr>>where M: Into<BufRead> + 'static + Send,

Treat this bin data as an ed25519 public key, and use it to verify a signature over a given message.

Trait Implementations§

source§

impl CertDigestExt for BinDataSized<32>

source§

fn from_slice(slice: &[u8]) -> BinDataSized<32>

Construct from a slice. Panicks if slice.len() != 32.
§

impl<const N: usize> Clone for BinDataSized<N>

§

fn clone(&self) -> BinDataSized<N>

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
§

impl<const N: usize> Debug for BinDataSized<N>

§

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

Formats the value using the given formatter. Read more
§

impl<const N: usize> Deref for BinDataSized<N>

§

type Target = [u8; N]

The resulting type after dereferencing.
§

fn deref(&self) -> &<BinDataSized<N> as Deref>::Target

Dereferences the value.
§

impl<'de, const N: usize> Deserialize<'de> for BinDataSized<N>

§

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

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

impl<const N: usize> Display for BinDataSized<N>

§

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

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

impl From<&Tx2Cert> for BinDataSized<32>

source§

fn from(d: &Tx2Cert) -> BinDataSized<32>

Converts to this type from the input type.
§

impl<const N: usize> From<[u8; N]> for BinDataSized<N>

§

fn from(b: [u8; N]) -> BinDataSized<N>

Converts to this type from the input type.
§

impl<const N: usize> From<Arc<[u8; N], Global>> for BinDataSized<N>

§

fn from(b: Arc<[u8; N], Global>) -> BinDataSized<N>

Converts to this type from the input type.
source§

impl From<Tx2Cert> for BinDataSized<32>

source§

fn from(d: Tx2Cert) -> BinDataSized<32>

Converts to this type from the input type.
§

impl<const N: usize> FromStr for BinDataSized<N>

§

type Err = OneErr

The associated error which can be returned from parsing.
§

fn from_str( s: &str ) -> Result<BinDataSized<N>, <BinDataSized<N> as FromStr>::Err>

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

impl<const N: usize> Hash for BinDataSized<N>

§

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

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
§

impl<const N: usize> Ord for BinDataSized<N>

§

fn cmp(&self, other: &BinDataSized<N>) -> Ordering

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

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

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

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

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

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

Restrict a value to a certain interval. Read more
§

impl<const N: usize> PartialEq<BinDataSized<N>> for BinDataSized<N>

§

fn eq(&self, other: &BinDataSized<N>) -> 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.
§

impl<const N: usize> PartialOrd<BinDataSized<N>> for BinDataSized<N>

§

fn partial_cmp(&self, other: &BinDataSized<N>) -> 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
§

impl<const N: usize> Serialize for BinDataSized<N>

§

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

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

impl<const N: usize> Eq for BinDataSized<N>

§

impl<const N: usize> StructuralEq for BinDataSized<N>

§

impl<const N: usize> StructuralPartialEq for BinDataSized<N>