export interface SecurityHealth { isSufficientlySecure : boolean ; hasPermanentEncryptionKey : boolean ; } export const getSecurityHealth = async ( isEsSecurityEnabled , isAbleToEncrypt , areApiKeysEnabled ) => { const esSecurityIsEnabled = await isEsSecurityEnabled ( ) ; const apiKeysAreEnabled = await areApiKeysEnabled ( ) ; const ableToEncrypt = await isAbleToEncrypt ( ) ; let isSufficientlySecure ; if ( esSecurityIsEnabled === null ) { isSufficientlySecure = false ; } else { isSufficientlySecure = ! esSecurityIsEnabled || ( esSecurityIsEnabled && apiKeysAreEnabled ) ; } const securityHealth = { isSufficientlySecure , hasPermanentEncryptionKey : ableToEncrypt , } ; return securityHealth ; } ;