Skip to main content

VerifierKey

Struct VerifierKey 

Source
pub struct VerifierKey { /* private fields */ }
Expand description

A trusted verifier key: the data needed to recognize and check signatures from one key.

Implementations§

Source§

impl VerifierKey

Source

pub fn new_ed25519(name: &str, public_key: &[u8]) -> Result<Self>

Build an Ed25519 verifier key from a name and 32-byte public key, computing the key id per the spec.

§Errors

Returns Error::MalformedNote if the name is invalid or the public key is not 32 bytes.

Source

pub fn new_hybrid(name: &str, public_key: &[u8]) -> Result<Self>

Build a hybrid composite verifier key from a name and the metamorphic-crypto public key bytes (tag || classical_pk || ml_dsa_pk), computing the key id per the spec over HYBRID_SIG_IDENTIFIER.

§Errors

Returns Error::MalformedNote if the name is invalid or the public key is empty.

Source

pub fn parse(vkey: &str) -> Result<Self>

Parse a verifier key string <name>+<hex key id>+<base64(type||key)>.

§Errors

Returns Error::MalformedNote if the structure, hex id, base64, key length, or recomputed key id is invalid, or Error::MalformedNote for an unsupported signature type.

Source

pub fn encode(&self) -> String

Encode this verifier key as a vkey string.

Source

pub fn name(&self) -> &str

The key name.

Source

pub fn key_id(&self) -> u32

The 4-byte key id as a big-endian u32.

Source

pub fn signature_type(&self) -> SignatureType

The signature algorithm.

Source

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

The raw public key material (type identifier-stripped): the 32-byte Ed25519 key, or the metamorphic-crypto composite public key bytes (tag || classical_pk || ml_dsa_pk) for a hybrid key.

Source

pub fn hybrid_posture_tag(&self) -> Option<u8>

For a SignatureType::MetamorphicHybrid key, the metamorphic-crypto composite posture tag — the leading byte of the composite public key that self-describes its (Suite, SecurityLevel) (e.g. 0x02 = Hybrid Cat-3). Returns None for non-hybrid keys.

This is informational only; the authoritative posture decode lives in metamorphic-crypto. It is surfaced so the Slice-5 NamespacePolicy layer can later reconcile the declared posture against this observed tag without this crate reimplementing any crypto.

Trait Implementations§

Source§

impl Clone for VerifierKey

Source§

fn clone(&self) -> VerifierKey

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for VerifierKey

Source§

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

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

impl Eq for VerifierKey

Source§

impl PartialEq for VerifierKey

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for VerifierKey

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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

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.