Skip to content

Commit

Permalink
chore: assume hard coded TTL value is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
jjacque committed Jun 22, 2024
1 parent 4dc21f4 commit 25e9e0f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions internal/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ func (v vault) Store(msg string, ttl string) (token string, err error) {
// Default TTL
if ttl == "" {
ttl = "48h"
}

// Verify duration
d, err := time.ParseDuration(ttl)
if err != nil {
return "", fmt.Errorf("cannot parse duration %v", err)
}
} else {
// Verify duration
d, err := time.ParseDuration(ttl)
if err != nil {
return "", fmt.Errorf("cannot parse duration %v", err)
}

// validate duration length
if d > 168*time.Hour || d == 0*time.Hour {
return "", fmt.Errorf("cannot set ttl to infinte or more than 7 days %v", err)
// validate duration length
if d > 168*time.Hour || d == 0*time.Hour {
return "", fmt.Errorf("cannot set ttl to infinte or more than 7 days %v", err)
}
}

t, err := v.createOneTimeToken(ttl)
Expand Down

0 comments on commit 25e9e0f

Please sign in to comment.