start begins the process of rotating keys. Canceling the context will stop the rotation process.
(ctx context.Context)
| 80 | // start begins the process of rotating keys. |
| 81 | // Canceling the context will stop the rotation process. |
| 82 | func (k *rotator) start(ctx context.Context) { |
| 83 | w := k.clock.TickerFunc(ctx, defaultRotationInterval, func() error { |
| 84 | err := k.rotateKeys(ctx) |
| 85 | if err != nil { |
| 86 | k.logger.Error(ctx, "failed to rotate keys", slog.Error(err)) |
| 87 | } |
| 88 | return nil |
| 89 | }) |
| 90 | err := w.Wait() |
| 91 | k.logger.Debug(ctx, "stopping key rotation", slog.Error(err)) |
| 92 | } |
| 93 | |
| 94 | // rotateKeys checks for any keys needing rotation or deletion and |
| 95 | // may insert a new key if it detects that a valid one does |
no test coverage detected