Changed Encryption to use LibSodium instead of OpenSSL, refactored many things and overall improved the code quality and performance with magic.
This commit is contained in:
parent
46ad03a54d
commit
367399f0fd
44 changed files with 2971 additions and 2016 deletions
|
@ -5,13 +5,9 @@
|
|||
class InstanceConfiguration
|
||||
{
|
||||
private bool $enabled;
|
||||
private string $name;
|
||||
private ?string $domain;
|
||||
private ?string $rpcEndpoint;
|
||||
private int $encryptionKeysCount;
|
||||
private int $encryptionRecordsCount;
|
||||
private ?string $privateKey;
|
||||
private ?string $publicKey;
|
||||
private ?array $encryptionKeys;
|
||||
|
||||
/**
|
||||
* Constructor that initializes object properties with the provided data.
|
||||
|
@ -22,13 +18,9 @@
|
|||
public function __construct(array $data)
|
||||
{
|
||||
$this->enabled = (bool)$data['enabled'];
|
||||
$this->name = $data['name'];
|
||||
$this->domain = $data['domain'];
|
||||
$this->rpcEndpoint = $data['rpc_endpoint'];
|
||||
$this->encryptionKeysCount = $data['encryption_keys_count'];
|
||||
$this->encryptionRecordsCount = $data['encryption_records_count'];
|
||||
$this->privateKey = $data['private_key'];
|
||||
$this->publicKey = $data['public_key'];
|
||||
$this->encryptionKeys = $data['encryption_keys'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,6 +33,11 @@
|
|||
return $this->enabled;
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the domain.
|
||||
*
|
||||
|
@ -58,62 +55,4 @@
|
|||
{
|
||||
return $this->rpcEndpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the number of encryption keys.
|
||||
*
|
||||
* @return int The number of encryption keys.
|
||||
*/
|
||||
public function getEncryptionKeysCount(): int
|
||||
{
|
||||
return $this->encryptionKeysCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the number of encryption records.
|
||||
*
|
||||
* @return int The number of encryption records.
|
||||
*/
|
||||
public function getEncryptionRecordsCount(): int
|
||||
{
|
||||
return $this->encryptionRecordsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the private key.
|
||||
*
|
||||
* @return string|null The private key.
|
||||
*/
|
||||
public function getPrivateKey(): ?string
|
||||
{
|
||||
return $this->privateKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the public key.
|
||||
*
|
||||
* @return string|null The public key.
|
||||
*/
|
||||
public function getPublicKey(): ?string
|
||||
{
|
||||
return $this->publicKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the encryption keys.
|
||||
*
|
||||
* @return array|null The encryption keys.
|
||||
*/
|
||||
public function getEncryptionKeys(): ?array
|
||||
{
|
||||
return $this->encryptionKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRandomEncryptionKey(): string
|
||||
{
|
||||
return $this->encryptionKeys[array_rand($this->encryptionKeys)];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue