Skip to content

Commit

Permalink
Add aud to JwtClaims, add Default to JwtClaims
Browse files Browse the repository at this point in the history
  • Loading branch information
KendallWeihe committed Sep 20, 2024
1 parent 852e43a commit 4897174
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/web5/src/credentials/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub fn sign_with_did(
additional_properties.insert("vc".to_string(), vc_claim.to_json_value()?);

let claims = JwtClaims {
aud: None,
iss: Some(vc.issuer.to_string()),
jti: Some(vc.id.clone()),
sub: Some(vc.credential_subject.id.clone()),
Expand Down
1 change: 1 addition & 0 deletions crates/web5/src/credentials/verifiable_presentation_1_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ pub fn sign_presentation_with_did(
additional_properties.insert("vp".to_string(), vp_claims.to_json_value()?);

let claims = JwtClaims {
aud: None,
iss: Some(vp.holder.clone()),
jti: Some(vp.id.clone()),
sub: None,
Expand Down
4 changes: 3 additions & 1 deletion crates/web5/src/jose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ impl Jws {
}
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
pub struct JwtClaims {
#[serde(skip_serializing_if = "Option::is_none")]
pub aud: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub iss: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down

0 comments on commit 4897174

Please sign in to comment.