Skip to content

Commit 101376a

Browse files
committed
rename: drop usage of UTC wrt Unix time
1 parent 2010bc5 commit 101376a

16 files changed

Lines changed: 73 additions & 74 deletions

ucan/delegation/datamodel/cbor_gen.maps.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ucan/delegation/datamodel/dag_json_gen.maps.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ucan/delegation/datamodel/delegation.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ type TokenPayloadModel1_0_0_rc1 struct {
2525
Nonce []byte `cborgen:"nonce" dagjsongen:"nonce"`
2626
// Arbitrary metadata.
2727
Meta *datamodel.Raw `cborgen:"meta,omitempty" dagjsongen:"meta,omitempty"`
28-
// "Not before" UTC Unix Timestamp in seconds (valid from).
29-
Nbf *ucan.UTCUnixTimestamp `cborgen:"nbf,omitempty" dagjsongen:"nbf,omitempty"`
30-
// Expiration UTC Unix Timestamp in seconds (valid until).
31-
Exp *ucan.UTCUnixTimestamp `cborgen:"exp" dagjsongen:"exp"`
28+
// "Not before" Unix Timestamp in seconds (valid from).
29+
Nbf *ucan.UnixTimestamp `cborgen:"nbf,omitempty" dagjsongen:"nbf,omitempty"`
30+
// Expiration Unix Timestamp in seconds (valid until).
31+
Exp *ucan.UnixTimestamp `cborgen:"exp" dagjsongen:"exp"`
3232
}
3333

3434
type SigPayloadModel struct {

ucan/delegation/delegation.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (d *Delegation) Command() ucan.Command {
5252
// Expiration is the time at which the delegation becomes invalid.
5353
//
5454
// https://github.com/ucan-wg/spec/blob/main/README.md#time-bounds
55-
func (d *Delegation) Expiration() *ucan.UTCUnixTimestamp {
55+
func (d *Delegation) Expiration() *ucan.UnixTimestamp {
5656
return d.sigPayload.TokenPayload1_0_0_rc1.Exp
5757
}
5858

@@ -106,7 +106,7 @@ func (d *Delegation) Nonce() []byte {
106106
// NotBefore delays the ability to invoke a UCAN.
107107
//
108108
// https://github.com/ucan-wg/spec/blob/main/README.md#time-bounds
109-
func (d *Delegation) NotBefore() *ucan.UTCUnixTimestamp {
109+
func (d *Delegation) NotBefore() *ucan.UnixTimestamp {
110110
return d.sigPayload.TokenPayload1_0_0_rc1.Nbf
111111
}
112112

@@ -278,7 +278,7 @@ func Delegate(
278278
}
279279
}
280280

281-
var exp *ucan.UTCUnixTimestamp
281+
var exp *ucan.UnixTimestamp
282282
if !cfg.noexp {
283283
if cfg.exp == nil {
284284
in30s := ucan.Now() + 30

ucan/delegation/delegation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func TestFixtures(t *testing.T) {
119119
audience := principals[vector.Envelope.Payload.Aud]
120120
subject := testutil.Must(did.Parse(vector.Envelope.Payload.Sub))(t)
121121
command := testutil.Must(command.Parse(vector.Envelope.Payload.Cmd))(t)
122-
expiration := ucan.UTCUnixTimestamp(vector.Envelope.Payload.Exp)
122+
expiration := ucan.UnixTimestamp(vector.Envelope.Payload.Exp)
123123
nonce := testutil.Must(base64.StdEncoding.DecodeString(vector.Envelope.Payload.Nonce))(t)
124124
signature := testutil.Must(base64.StdEncoding.DecodeString(vector.Envelope.Signature))(t)
125125

ucan/delegation/options.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ import (
1010
type Option func(cfg *delegationConfig) error
1111

1212
type delegationConfig struct {
13-
exp *ucan.UTCUnixTimestamp
14-
nbf *ucan.UTCUnixTimestamp
13+
exp *ucan.UnixTimestamp
14+
nbf *ucan.UnixTimestamp
1515
noexp bool
1616
nnc []byte
1717
nonnc bool
1818
meta ipld.Map
1919
pol policy.Policy
2020
}
2121

22-
// WithExpiration configures the expiration time in UTC seconds since Unix
22+
// WithExpiration configures the expiration time in seconds since Unix
2323
// epoch.
24-
func WithExpiration(exp ucan.UTCUnixTimestamp) Option {
24+
func WithExpiration(exp ucan.UnixTimestamp) Option {
2525
return func(cfg *delegationConfig) error {
2626
cfg.exp = &exp
2727
cfg.noexp = false
@@ -56,9 +56,9 @@ func WithNoNonce() Option {
5656
}
5757
}
5858

59-
// WithNotBefore configures the time in UTC seconds since Unix epoch that the
59+
// WithNotBefore configures the time in seconds since Unix epoch that the
6060
// delegation becomes valid.
61-
func WithNotBefore(nbf ucan.UTCUnixTimestamp) Option {
61+
func WithNotBefore(nbf ucan.UnixTimestamp) Option {
6262
return func(cfg *delegationConfig) error {
6363
cfg.nbf = &nbf
6464
return nil

ucan/invocation/datamodel/cbor_gen.maps.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ucan/invocation/datamodel/dag_json_gen.maps.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ucan/invocation/datamodel/invocation.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type TaskModel struct {
1313
Sub did.DID `cborgen:"sub" dagjsongen:"sub"`
1414
Cmd ucan.Command `cborgen:"cmd" dagjsongen:"cmd"`
1515
Args datamodel.Raw `cborgen:"args" dagjsongen:"args"`
16-
Nonce []byte `cborgen:"nonce" dagjsongen:"nonce"`
16+
Nonce []byte `cborgen:"nonce" dagjsongen:"nonce"`
1717
}
1818

1919
type TokenPayloadModel1_0_0_rc1 struct {
@@ -34,9 +34,9 @@ type TokenPayloadModel1_0_0_rc1 struct {
3434
// A unique, random nonce.
3535
Nonce []byte `cborgen:"nonce" dagjsongen:"nonce"`
3636
// The timestamp at which the invocation becomes invalid.
37-
Exp *ucan.UTCUnixTimestamp `cborgen:"exp" dagjsongen:"exp"`
37+
Exp *ucan.UnixTimestamp `cborgen:"exp" dagjsongen:"exp"`
3838
// The timestamp at which the invocation was created.
39-
Iat *ucan.UTCUnixTimestamp `cborgen:"iat,omitempty" dagjsongen:"iat,omitempty"`
39+
Iat *ucan.UnixTimestamp `cborgen:"iat,omitempty" dagjsongen:"iat,omitempty"`
4040
// CID of the receipt that enqueued the Task.
4141
Cause *cid.Cid `cborgen:"cause,omitempty" dagjsongen:"cause,omitempty"`
4242
}

ucan/invocation/invocation.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ func (inv *Invocation) Command() ucan.Command {
8484
// The timestamp at which the invocation becomes invalid.
8585
//
8686
// https://github.com/ucan-wg/invocation/blob/main/README.md#expiration
87-
func (inv *Invocation) Expiration() *ucan.UTCUnixTimestamp {
87+
func (inv *Invocation) Expiration() *ucan.UnixTimestamp {
8888
return inv.sigPayload.TokenPayload1_0_0_rc1.Exp
8989
}
9090

9191
// An issuance timestamp.
9292
//
9393
// https://github.com/ucan-wg/invocation/blob/main/README.md#issued-at
94-
func (inv *Invocation) IssuedAt() *ucan.UTCUnixTimestamp {
94+
func (inv *Invocation) IssuedAt() *ucan.UnixTimestamp {
9595
return inv.sigPayload.TokenPayload1_0_0_rc1.Iat
9696
}
9797

@@ -358,10 +358,10 @@ func Invoke(
358358
}
359359
}
360360

361-
var exp *ucan.UTCUnixTimestamp
361+
var exp *ucan.UnixTimestamp
362362
if !cfg.noexp {
363363
if cfg.exp == nil {
364-
in30s := ucan.Now() + ucan.UTCUnixTimestamp(Validity.Seconds())
364+
in30s := ucan.Now() + ucan.UnixTimestamp(Validity.Seconds())
365365
exp = &in30s
366366
} else {
367367
exp = cfg.exp

0 commit comments

Comments
 (0)