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

fix: use cacao timestamp strings and parse #504

Merged
merged 1 commit into from
Aug 23, 2024
Merged

Conversation

dav1do
Copy link
Contributor

@dav1do dav1do commented Aug 23, 2024

In order to ensure that CACAOs round trip without changing the CID, we use a string when deserializing rather than a chrono::DateTime which can change the second precision that was originally included. It's a bit clunky, open to better ideas.

@dav1do dav1do requested review from a team and nathanielc as code owners August 23, 2024 03:07
@dav1do dav1do requested review from christianlavoie and removed request for a team August 23, 2024 03:07
Copy link

linear bot commented Aug 23, 2024

Copy link
Collaborator

@smrz2001 smrz2001 left a comment

Choose a reason for hiding this comment

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

Ty for the quick fix!! LGTM 🥳

@dav1do dav1do added this pull request to the merge queue Aug 23, 2024
Merged via the queue into main with commit 011c49c Aug 23, 2024
5 checks passed
@dav1do dav1do deleted the fix/aes-333-cacao-timestamp branch August 23, 2024 14:04
#[serde(rename = "exp", skip_serializing_if = "Option::is_none")]
pub expiration: Option<CapabilityTime>,
pub expiration: Option<String>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of using a raw String and getting no type safety, would it make sense to introduce a new type, that uses string as the underlying storage but provides a method to convert to a DateTime?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it might be nice to use a tuple struct with serde transparent. Or at least make these fields private. I can add something like that in the cacao branch I have open.. wanted to fix it before it got released Monday to avoid any weird issues with event serialization.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the change here: 1d602df

@smrz2001 smrz2001 mentioned this pull request Aug 26, 2024
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.

3 participants