Skip to content

Commit d03de34

Browse files
committed
API term "separator" renamed to "delimiter".
1 parent 5ed3553 commit d03de34

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

app/Handlers/Api/Auth/LoginHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function handle(string $username, bool $remember, bool $withoutCheckpoint
5454
{
5555
if (!$this->settings->get('api.login_enabled')->getValue(DataType::BOOL)) {
5656
throw new ForbiddenException(
57-
'API authentication is disabled. To enable, set the "api.login" value to true'
57+
'API authentication is disabled. To enable, set the "api.login" value to true.'
5858
);
5959
}
6060

app/Handlers/Api/Auth/RegisterHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function handle(string $username, string $email, string $password, bool $
5353
}
5454

5555
throw new ForbiddenException(
56-
'API registration is disabled. To enable, set the "api.register.enabled" value to true'
56+
'API registration is disabled. To enable, set the "api.register.enabled" value to true.'
5757
);
5858
}
5959
}

app/Providers/AppServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function register(): void
125125
return new Signer(
126126
$settings->get('api.algorithm')->getValue(),
127127
$settings->get('api.key')->getValue(),
128-
$settings->get('api.separator')->getValue()
128+
$settings->get('api.delimiter')->getValue()
129129
);
130130
});
131131

@@ -135,7 +135,7 @@ public function register(): void
135135
return new Validator(
136136
$settings->get('api.algorithm')->getValue(),
137137
$settings->get('api.key')->getValue(),
138-
$settings->get('api.separator')->getValue()
138+
$settings->get('api.delimiter')->getValue()
139139
);
140140
});
141141

app/Services/Url/Signing/Signer.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ class Signer
1818
/**
1919
* @var string
2020
*/
21-
private $separator;
21+
private $delimiter;
2222

23-
public function __construct(string $algorithm, string $key, ?string $separator = '')
23+
public function __construct(string $algorithm, string $key, ?string $delimiter = '')
2424
{
2525
$this->algorithm = $algorithm;
2626
$this->key = $key;
2727

28-
if (empty($separator)) {
29-
$separator = '';
28+
if (empty($delimiter)) {
29+
$delimiter = '';
3030
}
31-
$this->separator = $separator;
31+
$this->delimiter = $delimiter;
3232
}
3333

3434
/**
@@ -51,9 +51,9 @@ public function create(Signable $dto): string
5151
// Add API key as last parameter. It is necessary to to generate signature.
5252
$parameters['key'] = $this->key;
5353

54-
// Join parameters in string. Between each parameter is the line separator.
55-
// Example for ':' separator: 'param1:param2:param3:secretKey'
56-
$signatureContent = implode($this->separator, $parameters);
54+
// Join parameters in string. Between each parameter is the line delimiter.
55+
// Example for ':' delimiter: 'param1:param2:param3:secretKey'
56+
$signatureContent = implode($this->delimiter, $parameters);
5757
// Create hash from signature string.
5858
$signature = hash($this->algorithm, $signatureContent);
5959
// Remove key from parameters. It is very important.

app/Services/Url/Signing/Validator.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ class Validator
1818
/**
1919
* @var string
2020
*/
21-
private $separator;
21+
private $delimiter;
2222

23-
public function __construct(string $algorithm, string $key, ?string $separator = '')
23+
public function __construct(string $algorithm, string $key, ?string $delimiter = '')
2424
{
2525
$this->algorithm = $algorithm;
2626
$this->key = $key;
2727

28-
if (empty($separator)) {
29-
$separator = '';
28+
if (empty($delimiter)) {
29+
$delimiter = '';
3030
}
31-
$this->separator = $separator;
31+
$this->delimiter = $delimiter;
3232
}
3333

3434
public function validate(Signed $signed): bool
@@ -44,9 +44,9 @@ public function validate(Signed $signed): bool
4444
// Add API key as last parameter. It is necessary to to generate signature.
4545
$parameters['key'] = $this->key;
4646

47-
// Join parameters in string. Between each parameter is the line separator.
48-
// Example for ':' separator: 'param1:param2:param3:secretKey'
49-
$signatureContent = implode($this->separator, $parameters);
47+
// Join parameters in string. Between each parameter is the line delimiter.
48+
// Example for ':' delimiter: 'param1:param2:param3:secretKey'
49+
$signatureContent = implode($this->delimiter, $parameters);
5050
// Create hash from signature string.
5151
$signature = hash($this->algorithm, $signatureContent);
5252

0 commit comments

Comments
 (0)