fix: cache validation of system keys

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2026-03-25 20:00:51 +01:00 committed by backportbot[bot]
parent daf53ccd7a
commit 00d9a2eccb

View file

@ -9,13 +9,18 @@ namespace OCA\Encryption\Users;
use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\KeyManager;
use OCP\ICache;
use OCP\ICacheFactory;
class Setup {
private readonly ICache $cache;
public function __construct(
private Crypt $crypt,
private KeyManager $keyManager,
ICacheFactory $cacheFactory,
) {
$this->cache = $cacheFactory->createLocal('encryption-setup');
}
/**
@ -35,7 +40,10 @@ class Setup {
* make sure that all system keys exists
*/
public function setupSystem() {
$this->keyManager->validateShareKey();
$this->keyManager->validateMasterKey();
if (!$this->cache->get('keys-validated')) {
$this->keyManager->validateShareKey();
$this->keyManager->validateMasterKey();
$this->cache->set('keys-validated', true);
}
}
}