1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace OCA\Encryption\Users;
- use OCA\Encryption\Crypto\Crypt;
- use OCA\Encryption\KeyManager;
- class Setup {
- public function __construct(
- private Crypt $crypt,
- private KeyManager $keyManager,
- ) {
- }
-
- public function setupUser($uid, $password) {
- if (!$this->keyManager->userHasKeys($uid)) {
- $keyPair = $this->crypt->createKeyPair();
- return is_array($keyPair) ? $this->keyManager->storeKeyPair($uid, $password, $keyPair) : false;
- }
- return true;
- }
-
- public function setupSystem() {
- $this->keyManager->validateShareKey();
- $this->keyManager->validateMasterKey();
- }
- }
|