Skip to content

Commit

Permalink
PHP: use SensitiveParameter annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
glaubinix committed Dec 9, 2024
1 parent 36fc43a commit bdc90e9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ public function __construct(HttpPluginClientBuilder $httpClientBuilder = null, $
* @param string $key
* @param string $secret
*/
public function authenticate($key, $secret)
{
public function authenticate(
#[\SensitiveParameter]
$key,
#[\SensitiveParameter]
$secret
) {
$this->httpClientBuilder->removePlugin(RequestSignature::class);
$this->httpClientBuilder->addPlugin(new RequestSignature($key, $secret));
}
Expand Down
8 changes: 6 additions & 2 deletions src/HttpClient/Plugin/RequestSignature.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ class RequestSignature implements Plugin
* @param string $key
* @param string $secret
*/
public function __construct($key, $secret)
{
public function __construct(
#[\SensitiveParameter]
$key,
#[\SensitiveParameter]
$secret
) {
if (!$key || !$secret) {
throw new \InvalidArgumentException('$key and $secret must be set');
}
Expand Down
6 changes: 4 additions & 2 deletions src/WebhookSignature.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ class WebhookSignature
/** @var string */
private $secret;

public function __construct($secret)
{
public function __construct(
#[\SensitiveParameter]
$secret
) {
$this->secret = $secret;
}

Expand Down

0 comments on commit bdc90e9

Please sign in to comment.