Skip to content

Commit 186763c

Browse files
committed
internal/cueconfig: note the difference between token expiry fields
The JSON expiry field is an absolute timestamp used at rest, and the JSON expires_in field is a relative duration in seconds declared by the RFC and used in the wire format. Signed-off-by: Daniel Martí <[email protected]> Change-Id: Ib2246b309c8595d435cdb979a057f244af3788b1 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202038 Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
1 parent a3fb8e8 commit 186763c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/cueconfig/config.go

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ type RegistryLogin struct {
3131
// These fields mirror [oauth2.Token].
3232
// We don't directly reference the type so we can be in control of our file format.
3333
// Note that Expiry is a pointer, so omitempty can work as intended.
34+
// TODO(mvdan): drop the pointer once we can use json's omitzero: https://go.dev/issue/45669
35+
// Note that we store Expiry at rest as an absolute timestamp in UTC,
36+
// rather than the ExpiresIn field following the RFC's wire format,
37+
// a duration in seconds relative to the current time which is not useful at rest.
3438

3539
AccessToken string `json:"access_token"`
3640

0 commit comments

Comments
 (0)