mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-14 17:50:21 +00:00
Adapt GetAndGenerateSecret() to get() and set()
Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
parent
e2ca4af0b9
commit
e95c13b86d
1 changed files with 6 additions and 6 deletions
|
|
@ -71,17 +71,17 @@ class ConfigurationManager
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = $this->GetConfig();
|
$secrets = $this->get('secrets', []);
|
||||||
if(!isset($config['secrets'][$secretId])) {
|
if (!isset($secrets[$secretId])) {
|
||||||
$config['secrets'][$secretId] = bin2hex(random_bytes(24));
|
$secrets[$secretId] = bin2hex(random_bytes(24));
|
||||||
$this->WriteConfig($config);
|
$this->set('secrets', $secrets);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($secretId === 'BORGBACKUP_PASSWORD' && !file_exists(DataConst::GetBackupSecretFile())) {
|
if ($secretId === 'BORGBACKUP_PASSWORD' && !file_exists(DataConst::GetBackupSecretFile())) {
|
||||||
$this->DoubleSafeBackupSecret($config['secrets'][$secretId]);
|
$this->DoubleSafeBackupSecret($secrets[$secretId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $config['secrets'][$secretId];
|
return $secrets[$secretId];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetRegisteredSecret(string $secretId) : string {
|
public function GetRegisteredSecret(string $secretId) : string {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue