-
Notifications
You must be signed in to change notification settings - Fork 148
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
feat: Add timestamp conversion for CACAOv3 #233
Draft
ukstv
wants to merge
1
commit into
ChainAgnostic:main
Choose a base branch
from
ukstv:su/utc-unix-timestamp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice with some more detail here.
timeRFC
, how do we gettimeUnix
andtimeTzAndMills
?timeUnix
andtimeTzAndMills
, how do we gettimeRFC
?Basically how do we separate the one timestamp into the two fields and vice versa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of trying to split up the timestamp, could we instead just keep the whole timestamp in the fields? e.g.
and require that the unix time of these matches those in
iat
,exp
andnbf
? it makes these fields slightly longer, but obviates the need for multiplefct
fields per time field (i.e. instead ofiat-tz
andiat-mills
we just haveiat-enc
), and also covers every baseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats the benefit of this though? We still need to do the conversion of the unix timestamp for verification.
I also never suggested two
fct
fields. would be more something like:issued-at
(RFC) turns intoiat
andfct.z-iat
(the latter would contain both milliseconds and TZ info)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I misunderstood, so we would represent everything after the seconds part? e.g.
1985-04-12T23:20:50.52Z
=>.52Z
1990-12-31T15:59:60-08:00
=>-08:00
1990-12-31T15:59:60.52-08:00
=>.52-08:00
In that case it seems to do the trick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly. And that's what I was hoping this appendix section would cover!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might miss or forget some discussion about timezones? Why does one need that? Also, milliseconds - are we in a high-frequency trading realm?
Unix timestamp is UTC (±1 second). You could always convert UTC to another timezone. A wallet definitely knows better how to display a timestamp in a user-friendly way, be it ISO8601 format or "20:00 next Monday".
Why do we have that even in CACAO spec instead of relying on a unix timestamp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SIWE supports the message having tz info
No but SIWE messages support it so we also need to in this conversion algo. We need to describe it precisely here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh shoot. Right.