Skip to content

Commit

Permalink
Merge pull request #174 from paragonie/sodium-compat-v2
Browse files Browse the repository at this point in the history
Update sodium_compat dependency
  • Loading branch information
paragonie-security authored Apr 20, 2024
2 parents ded3b76 + d51fb9c commit 12de354
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
strategy:
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['8.1']
php-versions: ['8.1', '8.2', '8.3']
phpunit-versions: ['latest']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"paragonie/constant_time_encoding": ">= 2.6",
"paragonie/corner": "^2",
"paragonie/easy-ecc": "^1",
"paragonie/sodium_compat": "^1.17"
"paragonie/sodium_compat": "^1|^2"
},
"require-dev": {
"phpunit/phpunit": "^9|^10",
"phpunit/phpunit": "^9",
"vimeo/psalm": "^4|^5"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/Keys/Version3/SymmetricKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ class SymmetricKey extends BaseSymmetricKey
public function __construct(
string $keyMaterial
) {
return parent::__construct($keyMaterial, new Version3());
parent::__construct($keyMaterial, new Version3());
}
}
2 changes: 1 addition & 1 deletion src/Keys/Version4/SymmetricKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ class SymmetricKey extends BaseSymmetricKey
public function __construct(
string $keyMaterial
) {
return parent::__construct($keyMaterial, new Version4());
parent::__construct($keyMaterial, new Version4());
}
}
1 change: 1 addition & 0 deletions src/Rules/FooterJSON.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function isValid(JsonToken $token): bool

/** @var array|bool|null $decoded */
$decoded = json_decode($json, true, $this->maxDepth);
/** @psalm-suppress RiskyTruthyFalsyComparison */
if (!$decoded) {
$this->rejectReason = json_last_error_msg();
}
Expand Down
2 changes: 2 additions & 0 deletions src/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ public static function calculateJsonDepth(string $json): int

$previous = '';
$depth = 1;
/** @psalm-suppress RiskyTruthyFalsyComparison */
while (!empty($stripped) && $stripped !== $previous) {
$previous = $stripped;
// Remove pairs of tokens
$stripped = str_replace(['[]', '{}'], [], $stripped);
++$depth;
}
/** @psalm-suppress RiskyTruthyFalsyComparison */
if (!empty($stripped)) {
throw new EncodingException(
'Invalid JSON string provided',
Expand Down
2 changes: 1 addition & 1 deletion tests/ExceptionHelpfulTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private function generateException(int $code): void
throw new PasetoException('Test', $code);
}

public function codeProvider(): array
public static function codeProvider(): array
{
return [
[ExceptionCode::BAD_VERSION],
Expand Down

0 comments on commit 12de354

Please sign in to comment.