diff --git a/src/Entity/Apikey.php b/src/Entity/Apikey.php index 4f99015..e5873b8 100644 --- a/src/Entity/Apikey.php +++ b/src/Entity/Apikey.php @@ -16,8 +16,8 @@ class Apikey public function __construct( private int $id = 0, private string $name = '', - private string $apiTokenPrefix = '', - private string $apiToken = '', + private string $apikey = '', + private string $apikeyPrefix = '', private readonly string $passphrase = '' ) { @@ -27,31 +27,39 @@ class Apikey $encryptionKey = $configController->getConfig(configKey: 'encryptionKey'); - $this->apiTokenPrefix = strtok(string: $this->passphrase, token: '.'); + $this->apikey = strtok(string: $this->passphrase, token: '.'); try { - $this->apiToken = $encryptionController->safeEncrypt(message: $this->passphrase, key: $encryptionKey); + $this->apikey = $encryptionController->safeEncrypt(message: $this->passphrase, key: $encryptionKey); } catch (Exception|SodiumException $e) { die($e->getMessage() . PHP_EOL); } } } + /** + * @return string + */ + public function getPassphrase(): string + { + return $this->passphrase; + } + /** * @return String */ - public function getApiToken(): string + public function getApikey(): string { - return $this->apiToken; + return $this->apikey; } /** * @return string */ - public function getApiTokenPrefix(): string + public function getApikeyPrefix(): string { - return $this->apiTokenPrefix; + return $this->apikeyPrefix; } @@ -80,19 +88,19 @@ class Apikey } /** - * @param string $apiTokenPrefix + * @param string $apikeyPrefix */ - public function setApiTokenPrefix(string $apiTokenPrefix): void + public function setApikeyPrefix(string $apikeyPrefix): void { - $this->apiTokenPrefix = $apiTokenPrefix; + $this->apikeyPrefix = $apikeyPrefix; } /** * @param String $apiToken */ - public function setApiToken(string $apiToken): void + public function setApikey(string $apikey): void { - $this->apiToken = $apiToken; + $this->apikey = $apikey; }