aboutsummaryrefslogtreecommitdiffstats
path: root/apps/encryption/lib/KeyManager.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/encryption/lib/KeyManager.php
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz
nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/encryption/lib/KeyManager.php')
-rw-r--r--apps/encryption/lib/KeyManager.php13
1 files changed, 4 insertions, 9 deletions
diff --git a/apps/encryption/lib/KeyManager.php b/apps/encryption/lib/KeyManager.php
index 8b286e00942..a62a4ca27f8 100644
--- a/apps/encryption/lib/KeyManager.php
+++ b/apps/encryption/lib/KeyManager.php
@@ -120,7 +120,6 @@ class KeyManager {
ILogger $log,
Util $util
) {
-
$this->util = $util;
$this->session = $session;
$this->keyStorage = $keyStorage;
@@ -179,7 +178,6 @@ class KeyManager {
* check if a key pair for the master key exists, if not we create one
*/
public function validateMasterKey() {
-
if ($this->util->isMasterKeyEnabled() === false) {
return;
}
@@ -358,11 +356,10 @@ class KeyManager {
* @return boolean
*/
public function init($uid, $passPhrase) {
-
$this->session->setStatus(Session::INIT_EXECUTED);
try {
- if($this->util->isMasterKeyEnabled()) {
+ if ($this->util->isMasterKeyEnabled()) {
$uid = $this->getMasterKeyId();
$passPhrase = $this->getMasterKeyPassword();
$privateKey = $this->getSystemPrivateKey($uid);
@@ -462,7 +459,7 @@ class KeyManager {
*/
public function getVersion($path, View $view) {
$fileInfo = $view->getFileInfo($path);
- if($fileInfo === false) {
+ if ($fileInfo === false) {
return 0;
}
return $fileInfo->getEncryptedVersion();
@@ -478,7 +475,7 @@ class KeyManager {
public function setVersion($path, $version, View $view) {
$fileInfo= $view->getFileInfo($path);
- if($fileInfo !== false) {
+ if ($fileInfo !== false) {
$cache = $fileInfo->getStorage()->getCache();
$cache->update($fileInfo->getId(), ['encrypted' => $version, 'encryptedVersion' => $version]);
}
@@ -642,7 +639,6 @@ class KeyManager {
}
return $keys;
-
}
/**
@@ -685,7 +681,6 @@ class KeyManager {
if ($this->recoveryKeyExists() &&
$this->util->isRecoveryEnabledForUser($uid)) {
-
$publicKeys[$this->getRecoveryKeyId()] = $this->getRecoveryKey();
}
@@ -700,7 +695,7 @@ class KeyManager {
*/
public function getMasterKeyPassword() {
$password = $this->config->getSystemValue('secret');
- if (empty($password)){
+ if (empty($password)) {
throw new \Exception('Can not get secret from Nextcloud instance');
}