public boolean delete(final int id) {
        return securityContext.secureResult(AppPermission.MANAGE_API_KEYS, () -> {
            final Optional<HashedApiKey> optApiKey = fetch(id);
            if (optApiKey.isPresent()) {
                final HashedApiKey apiKey = optApiKey.get();
                checkAdditionalPerms(apiKey.getOwner());
                final boolean didDelete = apiKeyDao.delete(id);
                invalidateApiKeyCacheEntry(apiKey);
                return didDelete;
            } else {
                LOGGER.debug("Nothing to delete");
                return false;
            }
        });
    }
Fetch the verified {@link UserIdentity} for the passed API key.
If the hash of the API key matches one in the database and that key is enabled
and not expired then the {@link UserIdentity} will be returned, else an empty {@link Optional}
is returned.
stroom-security/stroom-security-impl/src/main/java/stroom/security/impl/apikey/ApiKeyService.java