TsgcWSAPIKeyManager › Events › OnKeyRotated
Fired when a key has been rotated; carries both the old and the new key.
property OnKeyRotated: TsgcAPIKeyOnKeyRotated;
// TsgcAPIKeyOnKeyRotated = procedure(Sender: TObject; const aOldKey, aNewKey: string) of object
—
Fires synchronously from RotateKey (whether triggered manually or by the AutoRotateDays sweep) after the old key has been marked kksRotated and the new one issued. Both aOldKey and aNewKey are plaintext — this is the only point the new key is observable, so the handler is where you deliver it to the customer (via email, vault push, etc.). The old key continues to validate for Rotation.GracePeriodSec seconds so the customer can cut over without downtime. OnKeyIssued also fires for the new key; use whichever is more convenient for your workflow.
procedure TForm1.sgcWSAPIKeyManager1KeyRotated(Sender: TObject;
const aOldKey, aNewKey: string);
begin
SendMail(LookupOwner(aOldKey),
'Your key has been rotated. The old one keeps working for 24h. ' +
'New key: ' + aNewKey);
end;