pub struct Jwk {
pub kty: String,
pub crv: String,
pub use_: String,
pub alg: String,
pub kid: String,
pub x: String,
}Expand description
A single JWK entry. Pinned to the OKP/Ed25519/EdDSA shape — other
kty values (EC, RSA, oct) deserialize but ed25519_bytes()
returns None so the engine never accidentally accepts a non-Ed25519
key.
Fields§
§kty: String§crv: String§use_: String§alg: String§kid: String§x: StringImplementations§
Source§impl Jwk
impl Jwk
Sourcepub fn ed25519(kid: &str, public_key: &[u8; 32]) -> Self
pub fn ed25519(kid: &str, public_key: &[u8; 32]) -> Self
Construct an Ed25519 JWK from its raw 32-byte public key. The
fixed-string fields (kty=OKP, crv=Ed25519, use=sig,
alg=EdDSA) match RFC 8037 §2 verbatim — every Ed25519 JWK PAS
publishes carries this shape.
Sourcepub fn ed25519_bytes(&self) -> Option<[u8; 32]>
pub fn ed25519_bytes(&self) -> Option<[u8; 32]>
Decode the 32-byte Ed25519 public key carried in x when this
JWK is shaped as kty=OKP / crv=Ed25519. Returns None for any
other shape so consumers cannot accidentally feed a kty=EC or
kty=RSA key to an Ed25519 verifier.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Jwk
impl<'de> Deserialize<'de> for Jwk
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Jwk
impl StructuralPartialEq for Jwk
Auto Trait Implementations§
impl Freeze for Jwk
impl RefUnwindSafe for Jwk
impl Send for Jwk
impl Sync for Jwk
impl Unpin for Jwk
impl UnsafeUnpin for Jwk
impl UnwindSafe for Jwk
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