From 1b61f2e4dbe5e4e790ca2808e006687ca2967109 Mon Sep 17 00:00:00 2001 From: Steve Moyer Date: Tue, 5 Nov 2024 07:39:51 -0500 Subject: [PATCH] docs(invocation): fix truncated WithEmptyNonce description --- token/invocation/options.go | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/token/invocation/options.go b/token/invocation/options.go index 13a28d0..ca79577 100644 --- a/token/invocation/options.go +++ b/token/invocation/options.go @@ -73,7 +73,7 @@ func WithNonce(nonce []byte) Option { // WithEmptyNonce sets the Token's nonce to an empty byte slice as // suggested by the UCAN spec for invocation tokens that represent -// idem +// idempotent operations. func WithEmptyNonce() Option { return func(t *Token) error { t.nonce = []byte{} @@ -96,12 +96,7 @@ func WithExpiration(exp time.Time) Option { // WithExpirationIn set's the Token's optional "expiration" field to // Now() plus the given duration. func WithExpirationIn(exp time.Duration) Option { - return func(t *Token) error { - expTime := time.Now().Add(exp).Round(time.Minute) - t.expiration = &expTime - - return nil - } + return WithExpiration(time.Now().Add(exp)) } // WithInvokedAt sets the Token's invokedAt field to the provided @@ -117,12 +112,7 @@ func WithInvokedAt(iat time.Time) Option { // WithInvokedAtIn sets the Token's invokedAt field to Now() plus the // given duration. func WithInvokedAtIn(after time.Duration) Option { - return func(t *Token) error { - iat := time.Now().Add(after) - t.invokedAt = &iat - - return nil - } + return WithInvokedAt(time.Now().Add(after)) } // WithoutInvokedAt clears the Token's invokedAt field.