#[non_exhaustive]pub enum PeerKeyAlgorithm {
Ed25519,
Other(String),
}Expand description
Which algorithm a bound PeerKey’s bytes belong to.
cheers is a general auth library, so the field on Claims must not name
one curve. The discriminant rides next to the bytes instead, and a key only
ever matches another key of the same algorithm — so a byte string that is a
valid public key under two schemes can’t be confused across them.
Other is the escape hatch for a scheme cheers hasn’t named:
unknown labels still round-trip and still compare, so a consumer isn’t
version-locked to a cheers release to bind a key type of its own. Labels are
canonicalized on the way in (from_wire returns
Ed25519 for "ed25519", never Other("ed25519")), so
each algorithm has exactly one representation and equality is total.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ed25519
Ed25519 — 32-byte public key. What iroh/QUIC node identities use.
Other(String)
A scheme cheers doesn’t name. Carries the wire label verbatim.
Implementations§
Source§impl PeerKeyAlgorithm
impl PeerKeyAlgorithm
Sourcepub fn from_wire(s: &str) -> Result<Self, PeerKeyError>
pub fn from_wire(s: &str) -> Result<Self, PeerKeyError>
Parse a wire label, canonicalizing known ones onto their named variant.
Sourcepub fn expected_key_len(&self) -> Option<usize>
pub fn expected_key_len(&self) -> Option<usize>
The exact key length this algorithm requires, when it has one.
None for Other — cheers can’t police a scheme it
doesn’t know.
Trait Implementations§
Source§impl Clone for PeerKeyAlgorithm
impl Clone for PeerKeyAlgorithm
Source§fn clone(&self) -> PeerKeyAlgorithm
fn clone(&self) -> PeerKeyAlgorithm
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more