docs(invocation): fix truncated WithEmptyNonce description

This commit is contained in:
Steve Moyer
2024-11-05 07:39:51 -05:00
parent 187e7a869c
commit 1b61f2e4db

View File

@@ -73,7 +73,7 @@ func WithNonce(nonce []byte) Option {
// WithEmptyNonce sets the Token's nonce to an empty byte slice as // WithEmptyNonce sets the Token's nonce to an empty byte slice as
// suggested by the UCAN spec for invocation tokens that represent // suggested by the UCAN spec for invocation tokens that represent
// idem // idempotent operations.
func WithEmptyNonce() Option { func WithEmptyNonce() Option {
return func(t *Token) error { return func(t *Token) error {
t.nonce = []byte{} t.nonce = []byte{}
@@ -96,12 +96,7 @@ func WithExpiration(exp time.Time) Option {
// WithExpirationIn set's the Token's optional "expiration" field to // WithExpirationIn set's the Token's optional "expiration" field to
// Now() plus the given duration. // Now() plus the given duration.
func WithExpirationIn(exp time.Duration) Option { func WithExpirationIn(exp time.Duration) Option {
return func(t *Token) error { return WithExpiration(time.Now().Add(exp))
expTime := time.Now().Add(exp).Round(time.Minute)
t.expiration = &expTime
return nil
}
} }
// WithInvokedAt sets the Token's invokedAt field to the provided // 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 // WithInvokedAtIn sets the Token's invokedAt field to Now() plus the
// given duration. // given duration.
func WithInvokedAtIn(after time.Duration) Option { func WithInvokedAtIn(after time.Duration) Option {
return func(t *Token) error { return WithInvokedAt(time.Now().Add(after))
iat := time.Now().Add(after)
t.invokedAt = &iat
return nil
}
} }
// WithoutInvokedAt clears the Token's invokedAt field. // WithoutInvokedAt clears the Token's invokedAt field.