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

Make DataIntegrityProof created field optional #576

Merged
merged 4 commits into from
Jul 10, 2024

Conversation

sbihel
Copy link
Member

@sbihel sbihel commented Jul 10, 2024

According to https://www.w3.org/TR/vc-data-integrity/#proofs it should be optional (and some VC API tests fail because of it). I didn't change any of the functions that require created because it seems like we should enforce having a created field for some cryptosuites (like EdDSA where the language only defines the type of created but doesn't explicitely say that it should be present). But happy to change the API to be more tidy

@@ -13,8 +13,8 @@ pub struct ProofOptions<M, T> {
pub context: Option<ssi_json_ld::syntax::Context>,

/// Date a creation of the proof.
#[serde(default = "xsd_types::DateTime::now")]
pub created: xsd_types::DateTime,
#[serde(default = "created_default", skip_serializing_if = "Option::is_none")]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can remove the serde(default) attribute. I know it was already there, but I don't think it makes much sense to put a default value if its not there.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes definitely!

#[serde(default = "xsd_types::DateTime::now")]
pub created: xsd_types::DateTime,
#[serde(default = "created_default", skip_serializing_if = "Option::is_none")]
pub created: Option<xsd_types::DateTime>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I see the spec also specifies that the type of created should be an XSD dateTimeStamp and not dateTime (which has an optional timezone so it can be ambiguous). But maybe that's for another PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

It didn't break anything so I'm doing it as part of this PR

Copy link
Member Author

@sbihel sbihel Jul 10, 2024

Choose a reason for hiding this comment

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

Nevermind, VCDM 1.1 has issuanceDate as dateTime and we need to convert it to dateTimeStamp in some tests but I don't see a straightforward way to do that (I don't think we can assume UTC when there's no offset).

@sbihel sbihel merged commit 6b709c7 into main Jul 10, 2024
4 checks passed
@sbihel sbihel deleted the optional-dataintegrityproof-created-field branch July 10, 2024 13:22
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.

2 participants