minStartsAt ensures the minimum starts_at time we use for a new key is no less than 3*the default rotation interval.
(key database.CryptoKey, now time.Time, keyDuration time.Duration)
| 296 | // minStartsAt ensures the minimum starts_at time we use for a new |
| 297 | // key is no less than 3*the default rotation interval. |
| 298 | func minStartsAt(key database.CryptoKey, now time.Time, keyDuration time.Duration) time.Time { |
| 299 | expiresAt := key.ExpiresAt(keyDuration) |
| 300 | minStartsAt := now.Add(3 * defaultRotationInterval) |
| 301 | if expiresAt.Before(minStartsAt) { |
| 302 | return minStartsAt |
| 303 | } |
| 304 | return expiresAt |
| 305 | } |