TsgcWSAPIKeyManagerEvents › OnKeyRevoked

OnKeyRevoked Event

Fired when a key has been revoked; carries the key and revocation reason.

Syntax

property OnKeyRevoked: TsgcAPIKeyOnKeyRevoked;
// TsgcAPIKeyOnKeyRevoked = procedure(Sender: TObject; const aKey, aReason: string) of object

Default Value

Remarks

Fires synchronously from RevokeKey after the status has transitioned to kksRevoked and the audit entry has been appended. aKey is the raw plaintext that was passed to RevokeKey (not its hash) so the handler can build a customer-facing notification; aReason is the string supplied by the caller. Use it to push an immediate out-of-band notification ("your key has been revoked because…"), to invalidate cached authorization decisions in other processes, or to emit a Webhook to a billing system. The revocation has already taken effect when the handler runs — the event is strictly informational.

Example

procedure TForm1.sgcWSAPIKeyManager1KeyRevoked(Sender: TObject;
  const aKey, aReason: string);
begin
  NotifyWebhook('key.revoked', aKey, aReason);
end;

Back to Events