From 5a16e768dea93398abcb96d997331820caf04a54 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 6 May 2024 14:09:13 -0600 Subject: [PATCH] Add SameWindow() method for ARI --- acme/ari.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/acme/ari.go b/acme/ari.go index 55956c7..ae802ce 100644 --- a/acme/ari.go +++ b/acme/ari.go @@ -110,6 +110,14 @@ func (ari RenewalInfo) HasWindow() bool { return !ari.SuggestedWindow.Start.IsZero() && !ari.SuggestedWindow.End.IsZero() } +// SameWindow returns true if this ARI has the same window as the ARI passed in. +// Note that suggested windows can move in either direction, expand, or contract, +// so this method compares both start and end values for exact equality. +func (ari RenewalInfo) SameWindow(other RenewalInfo) bool { + return ari.SuggestedWindow.Start.Equal(other.SuggestedWindow.Start) && + ari.SuggestedWindow.End.Equal(other.SuggestedWindow.End) +} + // GetRenewalInfo returns the ACME Renewal Information (ARI) for the certificate. // It fills in the Retry-After value, if present, onto the returned struct so // the caller can poll appropriately. If the ACME server does not support ARI,