/**
* Returns the encryption key from the persistent cache or Data/Persistent directory. If none exists, a new
* encryption key will be generated and stored in the cache.
*
* @return string The configured encryption key stored in Data/Persistent/EncryptionKey
*/
protected function getEncryptionKey()
{
if ($this->encryptionKey === null) {
$this->encryptionKey = $this->cache->get('encryptionKey');
}
if ($this->encryptionKey === false && file_exists(FLOW_PATH_DATA . 'Persistent/EncryptionKey')) {
$this->encryptionKey = file_get_contents(FLOW_PATH_DATA . 'Persistent/EncryptionKey');
}
if ($this->encryptionKey === false) {
$this->encryptionKey = bin2hex(Utility\Algorithms::generateRandomBytes(48));
$this->cache->set('encryptionKey', $this->encryptionKey);
}
return $this->encryptionKey;
}