Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve time zone offsets in credentials #233

Merged
merged 1 commit into from Jul 21, 2021
Merged

Preserve time zone offsets in credentials #233

merged 1 commit into from Jul 21, 2021

Conversation

clehner
Copy link
Contributor

@clehner clehner commented Jul 20, 2021

Verifiable Credentials use a RFC 3339 date-time in the issuanceDate and expirationDate properties. In most examples, these are UTC, using "Z" as the time-offset part which is allowed as an alternative to the numeric hour-date offset. However, some example VCs in the VC HTTP API test suite use "+00:00" instead of "Z". These were failing verification in ssi/didkit, because the types in ssi's Credential struct were not keeping the information about using "Z" or "+00:00", so when ssi computed the RDF-based linked data verification hash, the datetimes were serialized differently than when they had been issued.

This PR changes the Credential struct to preserve the "use Z" bit in the issuanceDate and expirationDate properties. Additionally, the time zone offset is allowed to be non-UTC - although we don't have examples depending on that, the VC Data Model doesn't seem to require UTC, so we might want to allow it.

- Allow "+00:00" alternative to "Z" for UTC
- Allow non-UTC time zones
@clehner clehner linked an issue Jul 20, 2021 that may be closed by this pull request
Copy link
Member

@sbihel sbihel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sucks to have these corner cases :(

And I agree that we shouldn't care about potential non-UTC use cases for now.

@clehner clehner merged commit e049454 into main Jul 21, 2021
@clehner clehner deleted the fix/date-time-z branch July 21, 2021 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date time zones incorrectly canonicalized
2 participants