#[non_exhaustive]pub enum Algorithm {
RsaSha256,
Ed25519,
}Expand description
Algorithm identifier for a signing / verifying key.
The lexical name() strings match the values that appear in the
algorithm= parameter of a Cavage Signature: header.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
RsaSha256
RSA PKCS#1 v1.5 with SHA-256, used by Mastodon’s default actor key.
Ed25519
Ed25519 (EdDSA over Curve25519).
Implementations§
Source§impl Algorithm
impl Algorithm
Sourcepub const fn name(self) -> &'static str
pub const fn name(self) -> &'static str
Returns the Cavage-compatible lexical name for this algorithm.
Sourcepub fn parse(name: &str) -> Result<Option<Self>, Error>
pub fn parse(name: &str) -> Result<Option<Self>, Error>
Parses a Cavage / RFC 9421-compatible name back into an
Algorithm.
Accepts both naming conventions in use across the Fediverse:
- Cavage draft-12
rsa-sha256,ed25519,ed25519-sha512 - RFC 9421 §3.3.2
rsa-v1_5-sha256 - Legacy
hs2019(Mastodon), which requests auto-detection from the key itself — returned asOk(None).
§Errors
Returns Error::UnsupportedAlgorithm for anything else.
Trait Implementations§
impl Copy for Algorithm
impl Eq for Algorithm
impl StructuralPartialEq for Algorithm
Auto Trait Implementations§
impl Freeze for Algorithm
impl RefUnwindSafe for Algorithm
impl Send for Algorithm
impl Sync for Algorithm
impl Unpin for Algorithm
impl UnsafeUnpin for Algorithm
impl UnwindSafe for Algorithm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.