mirror of
https://github.com/nextcloud/server.git
synced 2026-04-08 18:46:28 -04:00
fix: cache validation of system keys
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
daf53ccd7a
commit
00d9a2eccb
1 changed files with 10 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue