Add session flags management and encryption key support
This commit is contained in:
parent
790262db08
commit
1d452bc71b
8 changed files with 209 additions and 76 deletions
|
@ -1,76 +1,87 @@
|
|||
<?php
|
||||
|
||||
namespace Socialbox\Classes\Configuration;
|
||||
|
||||
namespace Socialbox\Classes\Configuration;
|
||||
|
||||
class InstanceConfiguration
|
||||
{
|
||||
private bool $enabled;
|
||||
private ?string $domain;
|
||||
private ?string $rpcEndpoint;
|
||||
private ?string $privateKey;
|
||||
private ?string $publicKey;
|
||||
|
||||
/**
|
||||
* Constructor that initializes object properties with the provided data.
|
||||
*
|
||||
* @param array $data An associative array with keys 'enabled', 'domain', 'private_key', and 'public_key'.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
class InstanceConfiguration
|
||||
{
|
||||
$this->enabled = (bool)$data['enabled'];
|
||||
$this->domain = $data['domain'];
|
||||
$this->rpcEndpoint = $data['rpc_endpoint'];
|
||||
$this->privateKey = $data['private_key'];
|
||||
$this->publicKey = $data['public_key'];
|
||||
}
|
||||
private bool $enabled;
|
||||
private ?string $domain;
|
||||
private ?string $rpcEndpoint;
|
||||
private ?string $privateKey;
|
||||
private ?string $publicKey;
|
||||
private ?string $encryptionKey;
|
||||
|
||||
/**
|
||||
* Checks if the current object is enabled.
|
||||
*
|
||||
* @return bool True if the object is enabled, false otherwise.
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
/**
|
||||
* Constructor that initializes object properties with the provided data.
|
||||
*
|
||||
* @param array $data An associative array with keys 'enabled', 'domain', 'private_key', and 'public_key'.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->enabled = (bool)$data['enabled'];
|
||||
$this->domain = $data['domain'];
|
||||
$this->rpcEndpoint = $data['rpc_endpoint'];
|
||||
$this->privateKey = $data['private_key'];
|
||||
$this->publicKey = $data['public_key'];
|
||||
$this->encryptionKey = $data['encryption_key'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the domain.
|
||||
*
|
||||
* @return string|null The domain.
|
||||
*/
|
||||
public function getDomain(): ?string
|
||||
{
|
||||
return $this->domain;
|
||||
}
|
||||
/**
|
||||
* Checks if the current object is enabled.
|
||||
*
|
||||
* @return bool True if the object is enabled, false otherwise.
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getRpcEndpoint(): ?string
|
||||
{
|
||||
return $this->rpcEndpoint;
|
||||
}
|
||||
/**
|
||||
* Retrieves the domain.
|
||||
*
|
||||
* @return string|null The domain.
|
||||
*/
|
||||
public function getDomain(): ?string
|
||||
{
|
||||
return $this->domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the private key.
|
||||
*
|
||||
* @return string|null The private key.
|
||||
*/
|
||||
public function getPrivateKey(): ?string
|
||||
{
|
||||
return $this->privateKey;
|
||||
}
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getRpcEndpoint(): ?string
|
||||
{
|
||||
return $this->rpcEndpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the public key.
|
||||
*
|
||||
* @return string|null The public key.
|
||||
*/
|
||||
public function getPublicKey(): ?string
|
||||
{
|
||||
return $this->publicKey;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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 key.
|
||||
*
|
||||
* @return string|null The encryption key.
|
||||
*/
|
||||
public function getEncryptionKey(): ?string
|
||||
{
|
||||
return $this->encryptionKey;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue