pub struct Jwk {
pub crv: String,
pub kty: String,
pub x: String,
pub y: Option<String>,
}Expand description
An attested public key as a JWK with exactly the RFC 7638 members:
{crv, kty, x} for Ed25519, {crv, kty, x, y} for P-256.
Fields§
§crv: StringEd25519 or P-256.
kty: StringOKP or EC.
x: Stringbase64url (no padding) of the key, or of the P-256 x coordinate.
y: Option<String>base64url (no padding) of the P-256 y coordinate.
Implementations§
Source§impl Jwk
impl Jwk
Sourcepub fn from_ed25519(public_key: &[u8; 32]) -> Self
pub fn from_ed25519(public_key: &[u8; 32]) -> Self
The JWK of a raw Ed25519 public key.
Sourcepub fn from_p256_sec1(sec1: &[u8]) -> Result<Self, AcdpError>
pub fn from_p256_sec1(sec1: &[u8]) -> Result<Self, AcdpError>
The JWK of a SEC1 P-256 public key (compressed or uncompressed).
Sourcepub fn algorithm(&self) -> Result<&'static str, AcdpError>
pub fn algorithm(&self) -> Result<&'static str, AcdpError>
The signature algorithm the key type implies (§5.2 step 5).
Sourcepub fn fingerprint(&self) -> Result<String, AcdpError>
pub fn fingerprint(&self) -> Result<String, AcdpError>
The RFC-ACDP-0010 §6 fingerprint: over the raw 32-byte Ed25519 key, or the 33-byte SEC1-compressed P-256 point (§5.3).
Sourcepub fn thumbprint(&self) -> Result<String, AcdpError>
pub fn thumbprint(&self) -> Result<String, AcdpError>
The RFC 7638 thumbprint: base64url SHA-256 of the JCS bytes of
the required members (§5.2 step 3, cnf.jkt).
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.