import { Logger , SavedObjectsClientContract } from 'src/core/server' ; export const markApiKeyForInvalidation = async ( { apiKey } , logger , savedObjectsClient ) : Promise < void > => { if ( ! apiKey ) { return ; } try { const apiKeyId = Buffer . from ( apiKey , 'base64' ) . toString ( ) . split ( ':' ) [ 0 ] ; await savedObjectsClient . create ( 'api_key_pending_invalidation' , { apiKeyId , createdAt : new Date ( ) . toISOString ( ) , } ) ; } catch ( e ) { logger . error ( `Failed to mark for API key [id="${ apiKey }"] for invalidation: ${ e . message }` ) ; } } ;