Skip to main content

KeriPublicKey

Struct KeriPublicKey 

Source
pub struct KeriPublicKey(/* private fields */);
Expand description

A validated KERI Ed25519 public key (32 bytes).

Args:

  • The inner [u8; 32] is the raw Ed25519 public key bytes, decoded from a KERI CESR-encoded string with ‘D’ derivation code prefix.

Usage:

use auths_crypto::KeriPublicKey;

let key = KeriPublicKey::parse("DAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").unwrap();
assert_eq!(key.as_bytes(), &[0u8; 32]);

Implementations§

Source§

impl KeriPublicKey

Source

pub fn parse(encoded: &str) -> Result<Self, KeriDecodeError>

Parses a KERI-encoded Ed25519 public key string into a validated type.

The input must be a ‘D’-prefixed base64url-no-pad encoded 32-byte Ed25519 key, as defined by the KERI CESR specification.

Args:

  • encoded: The KERI-encoded string (e.g., "D<base64url>").

Usage:

use auths_crypto::KeriPublicKey;

let key = KeriPublicKey::parse("DAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").unwrap();
let raw = key.as_bytes();
Source

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

Returns the raw 32-byte Ed25519 public key.

Source

pub fn into_bytes(self) -> [u8; 32]

Consumes self and returns the inner 32-byte array.

Trait Implementations§

Source§

impl Debug for KeriPublicKey

Source§

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

Formats the value using the given formatter. Read more

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
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
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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.