#[non_exhaustive]pub enum KeyAlgorithm {
Ed25519,
}Expand description
The signature algorithm a key pair uses.
There is exactly one variant, and is_allowed_alg still admits only it.
The type exists so that the algorithm travels with the key rather than
being assumed by every reader of it: a verifier can then bind the JWS alg
header to what the key record says, instead of letting an attacker-supplied
header select the verification path.
#[non_exhaustive] so that adding a second algorithm later is not a
breaking change for downstream matches.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ed25519
Ed25519 signatures, JOSE EdDSA (RFC 8037 §3.1).
Implementations§
Source§impl KeyAlgorithm
impl KeyAlgorithm
Sourcepub fn from_jose_alg(alg: &str) -> Option<Self>
pub fn from_jose_alg(alg: &str) -> Option<Self>
Parse a JOSE alg header value. None for anything not allowed here,
which includes none.
Sourcepub fn public_key_jwk(self, public_key: &[u8]) -> Value
pub fn public_key_jwk(self, public_key: &[u8]) -> Value
The JWK members describing public_key, for a DID document’s
publicKeyJwk.
Lives here rather than in the DID-document builder so the per-algorithm
match stays exhaustive in the crate that defines the algorithm. A second
algorithm needs a kty/parameter set that only this crate should have
to know — P-256, for instance, is kty: "EC" with both x and y,
where Ed25519 is kty: "OKP" with x alone.
Trait Implementations§
Source§impl Clone for KeyAlgorithm
impl Clone for KeyAlgorithm
Source§fn clone(&self) -> KeyAlgorithm
fn clone(&self) -> KeyAlgorithm
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more