Skip to content

Bug: Taking "expirationDate" from wrong place in encode_jwt_vc_claims #688

@vdods

Description

@vdods

The expiration date of a credential isn't making it into a JWT-formatted VC:

In

take_object_property(&mut credential, "credentialSubject", "expirationDate")

pub fn encode_jwt_vc_claims<T: Serialize>(
    credential: &T,
) -> Result<RegisteredClaims, JwtVcEncodeError> {
    let mut credential = json_syntax::to_value(credential)?
        .into_object()
        .ok_or(JwtVcEncodeError::ExpectedJsonObject)?;
    let mut claims = RegisteredClaims::default();

    if let Some(date_value) =
        take_object_property(&mut credential, "credentialSubject", "expirationDate")
    {
        <...>
    }

    <...>

    if let Some(issuance_date_entry) = credential.remove("issuanceDate").next() {
        <...>
    }

    <...>
}

The "expirationDate" field should be taken from the credential, not the credential subject. It should work just like the "issuanceDate" case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions