mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-04 13:06:53 +00:00
Adapt GetAndGenerateSecret() to get() and set()
Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
parent
21b14a4a5d
commit
a9b648e18f
1 changed files with 6 additions and 6 deletions
|
|
@ -71,17 +71,17 @@ class ConfigurationManager
|
|||
return '';
|
||||
}
|
||||
|
||||
$config = $this->GetConfig();
|
||||
if(!isset($config['secrets'][$secretId])) {
|
||||
$config['secrets'][$secretId] = bin2hex(random_bytes(24));
|
||||
$this->WriteConfig($config);
|
||||
$secrets = $this->get('secrets', []);
|
||||
if (!isset($secrets[$secretId])) {
|
||||
$secrets[$secretId] = bin2hex(random_bytes(24));
|
||||
$this->set('secrets', $secrets);
|
||||
}
|
||||
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue