Skip to content

Commit d1fb363

Browse files
committed
fix(invocation): also update docs and examples
1 parent fbf55e9 commit d1fb363

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

token/invocation/examples_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func ExampleNew() {
3434
invocation.WithMeta("env", "development"),
3535
invocation.WithMeta("tags", meta["tags"]),
3636
invocation.WithExpirationIn(time.Minute),
37-
invocation.WithoutInvokedAt())
37+
invocation.WithoutIssuedAt())
3838
if err != nil {
3939
fmt.Println("failed to create invocation:", err.Error())
4040

token/invocation/invocation.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ type Token struct {
6666
// WithNonce or WithEmptyNonce options to specify provide your own nonce
6767
// or to leave the nonce empty respectively.
6868
//
69-
// If no invokedAt is provided, the current time is used. Use the
70-
// WithInvokedAt or WithInvokedAtIn Options to specify a different time
71-
// or the WithoutInvokedAt Option to clear the Token's invokedAt field.
69+
// If no IssuedAt is provided, the current time is used. Use the
70+
// IssuedAt or WithIssuedAtIn Options to specify a different time
71+
// or the WithoutIssuedAt Option to clear the Token's invokedAt field.
7272
//
7373
// With the exception of the WithMeta option, all others will overwrite
7474
// the previous contents of their target field.

token/invocation/ipld_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestSealUnsealRoundtrip(t *testing.T) {
2323
invocation.WithMeta("env", "development"),
2424
invocation.WithMeta("tags", meta["tags"]),
2525
invocation.WithExpirationIn(time.Minute),
26-
invocation.WithoutInvokedAt(),
26+
invocation.WithoutIssuedAt(),
2727
)
2828
require.NoError(t, err)
2929

token/invocation/options.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ func WithExpirationIn(after time.Duration) Option {
123123
return WithExpiration(time.Now().Add(after))
124124
}
125125

126-
// WithInvokedAt sets the Token's invokedAt field to the provided
126+
// WithIssuedAt sets the Token's invokedAt field to the provided
127127
// time.Time.
128128
//
129129
// If this Option is not provided, the invocation Token's iat field will
130130
// be set to the value of time.Now(). If you want to create an invocation
131-
// Token without this field being set, use the WithoutInvokedAt Option.
131+
// Token without this field being set, use the WithoutIssuedAt Option.
132132
func WithIssuedAt(iat time.Time) Option {
133133
return func(t *Token) error {
134134
t.issuedAt = &iat
@@ -137,13 +137,13 @@ func WithIssuedAt(iat time.Time) Option {
137137
}
138138
}
139139

140-
// WithInvokedAtIn sets the Token's invokedAt field to Now() plus the
140+
// WithIssuedAtIn sets the Token's invokedAt field to Now() plus the
141141
// given duration.
142-
func WithInvokedAtIn(after time.Duration) Option {
143-
return WithInvokedAt(time.Now().Add(after))
142+
func WithIssuedAtIn(after time.Duration) Option {
143+
return WithIssuedAt(time.Now().Add(after))
144144
}
145145

146-
// WithoutInvokedAt clears the Token's invokedAt field.
146+
// WithoutIssuedAt clears the Token's invokedAt field.
147147
func WithoutIssuedAt() Option {
148148
return func(t *Token) error {
149149
t.issuedAt = nil

0 commit comments

Comments
 (0)