#[non_exhaustive]pub struct JwsHeader {
pub alg: JwsAlgorithm,
pub typ: Option<String>,
pub cty: Option<String>,
pub kid: Option<String>,
pub jwk: Option<Jwk>,
pub crit: Option<Vec<String>>,
pub additional: IndexMap<String, Value>,
}Expand description
The JOSE header of a JWS (RFC 7515 §4).
The registered parameters this crate acts on are fields; everything else, x5c and b64
included, lives in additional in insertion order. jwk is the public key the signer claims
to have used; trusting it is the verifier’s decision, never the crate’s.
§Examples
use identity_kit::jose::{JwsAlgorithm, JwsHeader};
let mut header = JwsHeader::new(JwsAlgorithm::ES256).with_kid("did:example:123#key-1");
header.typ = Some("JWT".to_owned());
assert_eq!(
serde_json::to_string(&header)?,
r#"{"alg":"ES256","typ":"JWT","kid":"did:example:123#key-1"}"#
);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.alg: JwsAlgorithmThe signature algorithm (alg).
typ: Option<String>The media type of the whole JWS (typ), such as JWT or vc+jwt.
cty: Option<String>The media type of the payload (cty).
kid: Option<String>The key id (kid); for a DID controller, usually a DID URL with a fragment.
jwk: Option<Jwk>The public key the signature was made with (jwk).
crit: Option<Vec<String>>Extensions a recipient must understand (crit).
additional: IndexMap<String, Value>Every other header parameter, in insertion order.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for JwsHeader
impl<'de> Deserialize<'de> for JwsHeader
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 JwsHeader
impl StructuralPartialEq for JwsHeader
Auto Trait Implementations§
impl Freeze for JwsHeader
impl RefUnwindSafe for JwsHeader
impl Send for JwsHeader
impl Sync for JwsHeader
impl Unpin for JwsHeader
impl UnsafeUnpin for JwsHeader
impl UnwindSafe for JwsHeader
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.