TsgcWSAPIKeyManager › Events › OnKeyExpired
Fired by the background sweep when a key has expired (or NotifyBeforeExpirySec earlier).
property OnKeyExpired: TsgcAPIKeyOnKeyExpired;
// TsgcAPIKeyOnKeyExpired = procedure(Sender: TObject; const aKey: string) of object
—
Fires from the background expiry sweep at the cadence defined by Expiration.CheckIntervalSec. You can receive the event twice per key: once Rotation.NotifyBeforeExpirySec seconds before the actual expiry (so you can warn the customer while the key still works) and once at the moment the key transitions to status kksExpired. Use it to drive renewal reminders, to proactively call RotateKey on critical integrations, or to raise a SIEM alert when a production key is about to die. The handler runs on a background thread — marshal to the UI thread if you need to update a form.
procedure TForm1.sgcWSAPIKeyManager1KeyExpired(Sender: TObject;
const aKey: string);
begin
// Send renewal reminder 7 days ahead, then revoke after the grace window
TThread.Queue(nil,
procedure begin SendRenewalReminder(LookupOwner(aKey)); end);
end;