TsgcWSAPIKeyManager › Methods › KeyExists
Returns True if the key is known (active, revoked, expired or rotated).
function KeyExists(const aKey: string): Boolean;
| Name | Type | Description |
|---|---|---|
aKey | const string | Raw plaintext key to probe (re-hashed internally). |
True whenever an entry with the matching hash exists regardless of its status (kksActive, kksRevoked, kksExpired or kksRotated). False only when the key has never been issued by this manager instance. (Boolean)
Presence-only check — does not imply validity. Use it to distinguish "unknown key" from "known key that is currently rejected" in user-facing error messages, and for de-duplication when importing keys from another manager instance. The hash comparison is constant-time.
if not sgcWSAPIKeyManager1.KeyExists(vKey) then
ShowMessage('Unknown key — please check for typos.');