renamed ApiToken to apikey
This commit is contained in:
parent
bc1b9c1204
commit
9dca565296
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user