From 00d9a2eccb4dc92c1926dfe2288e1a5a58038124 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 25 Mar 2026 20:00:51 +0100 Subject: [PATCH] fix: cache validation of system keys Signed-off-by: Robin Appelman --- apps/encryption/lib/Users/Setup.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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); + } } }