diff --git a/apps/encryption/lib/Users/Setup.php b/apps/encryption/lib/Users/Setup.php index f2189d6dab2..7f50fd8b23e 100644 --- a/apps/encryption/lib/Users/Setup.php +++ b/apps/encryption/lib/Users/Setup.php @@ -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); + } } }