TsgcWSAPIKeyManager › Methods › RenewKey
Extends the key's expiration by the given number of seconds from now.
function RenewKey(const aKey: string; aNewExpiresInSec: Integer): Boolean;
| Name | Type | Description |
|---|---|---|
aKey | const string | Raw plaintext key whose expiry will be pushed forward. |
aNewExpiresInSec | Integer | New lifetime in seconds, measured from now. The stored ExpiresAt is set to Now + aNewExpiresInSec. Pass 0 to clear the expiry (key never expires). |
True when a matching key was found and its ExpiresAt was updated. False when the key is unknown, revoked or already expired. (Boolean)
Overwrites the key's ExpiresAt with an absolute timestamp aNewExpiresInSec seconds from now — it does not add seconds on top of the existing expiry. Use it when a customer renews their contract: rather than issuing a new key, just push the deadline out another 90 days. The audit log records the renewal and Stats.LastIssuedAt is not touched (renewal is not a reissue). Combine with OnKeyExpired (fired NotifyBeforeExpirySec early) to drive automated renewal reminders.
// Contract renewed — give the customer another 90 days
sgcWSAPIKeyManager1.RenewKey(vKey, 90 * 86400);