Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions apps/encryption/lib/Users/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@

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');
}

/**
Expand All @@ -35,7 +40,10 @@ public function setupUser($uid, $password) {
* 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