crypt = $crypt; $this->keyManager = $keyManager; } /** * @param string $uid user id * @param string $password user password * @return bool */ 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; } /** * make sure that all system keys exists */ public function setupSystem() { $this->keyManager->validateShareKey(); $this->keyManager->validateMasterKey(); } }