Skip to content

Commit

Permalink
Update JWT.php
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer authored Nov 24, 2024
1 parent 7ff4c21 commit 90b2f60
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/JWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,8 @@ public static function sign(
return \hash_hmac($algorithm, $msg, $key, true);
case 'openssl':
$signature = '';
if (!\is_resource($key)) {
if (!openssl_pkey_get_private($key)) {
throw new DomainException('OpenSSL unable to validate key');
}
if (\is_resource($key) && !openssl_pkey_get_private($key)) {

Check failure on line 254 in src/JWT.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Parameter #1 $private_key of function openssl_pkey_get_private expects array|OpenSSLAsymmetricKey|OpenSSLCertificate|string, resource given.
throw new DomainException('OpenSSL unable to validate key');
}
$success = \openssl_sign($msg, $signature, $key, $algorithm); // @phpstan-ignore-line
if (!$success) {
Expand Down

0 comments on commit 90b2f60

Please sign in to comment.