Skip to content

Commit

Permalink
Merge pull request #36 from Spomky-Labs/3.1.x-merge-up-into-3.2.x_0VT…
Browse files Browse the repository at this point in the history
…RcdeK

Merge release 3.1.1 into 3.2.x
  • Loading branch information
Spomky authored Apr 11, 2024
2 parents 23ace99 + 0ec9f45 commit 5a91152
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 27 deletions.
26 changes: 13 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"psr/cache": "^1.0|^2.0|^3.0",
"psr/clock": "^1.0",
"psr/log": "^1.1|^2.0|^3.0",
"symfony/config": "^6.3|^7.0",
"symfony/dependency-injection": "^6.3|^7.0",
"symfony/framework-bundle": "^6.3|^7.0",
"symfony/http-kernel": "^6.3|^7.0"
"symfony/config": "^6.2|^7.0",
"symfony/dependency-injection": "^6.2|^7.0",
"symfony/framework-bundle": "^6.2|^7.0",
"symfony/http-kernel": "^6.2|^7.0"
},
"require-dev": {
"doctrine/dbal": "^3.0",
Expand All @@ -39,18 +39,18 @@
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-strict-rules": "^1.4",
"phpunit/phpunit": "^10.1",
"phpunit/phpunit": "^10.1|^11.0",
"qossmic/deptrac-shim": "^1.0",
"rector/rector": "^0.18",
"rector/rector": "^1.0",
"roave/security-advisories": "dev-latest",
"symfony/cache": "^6.3|^7.0",
"symfony/clock": "^6.3|^7.0",
"symfony/http-client": "^6.3|^7.0",
"symfony/cache": "^6.2|^7.0",
"symfony/clock": "^6.2|^7.0",
"symfony/http-client": "^6.2|^7.0",
"symfony/monolog-bundle": "^3.5",
"symfony/var-dumper": "^6.3|^7.0",
"symfony/yaml": "^6.3|^7.0",
"symfony/var-dumper": "^6.2|^7.0",
"symfony/yaml": "^6.2|^7.0",
"symplify/easy-coding-standard": "^12.0",
"web-token/jwt-signature-algorithm-ecdsa": "^3.0"
"web-token/jwt-library": "^3.0"
},
"autoload": {
"psr-4" : {
Expand Down Expand Up @@ -78,7 +78,7 @@
"suggest": {
"ext-mbstring": "Mandatory when using Payload or VAPID extensions",
"ext-openssl": "Mandatory when using Payload or VAPID extensions",
"web-token/jwt-signature-algorithm-ecdsa": "Mandatory if you want to use VAPID using web-token/jwt-framework",
"web-token/jwt-library": "Mandatory if you want to use VAPID using web-token/jwt-framework",
"lcobucci/jwt": "Mandatory if you want to use VAPID using lcobucci/jwt",
"psr/log-implementation": "Recommended to receive logs from the library"
}
Expand Down
3 changes: 2 additions & 1 deletion ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
]);

$config->skip([
PhpUnitTestClassRequiresCoversFixer::class
PhpUnitTestClassRequiresCoversFixer::class,
\PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer::class,
]);

$config->parallel();
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
Expand All @@ -12,6 +11,7 @@
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\SymfonyLevelSetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\ValueObject\PhpVersion;

return static function (RectorConfig $config): void {
$config->import(SetList::DEAD_CODE);
Expand Down
6 changes: 3 additions & 3 deletions src/bundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
],
"require": {
"spomky-labs/web-push-lib": "^3.0",
"symfony/config": "^6.2",
"symfony/dependency-injection": "^6.2",
"symfony/framework-bundle": "^6.2"
"symfony/config": "^6.2|^7.0",
"symfony/dependency-injection": "^6.2|^7.0",
"symfony/framework-bundle": "^6.2|^7.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/library/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function getTag(): ?string
return $this->tag;
}

public function getTitle(): ?string
public function getTitle(): string
{
return $this->title;
}
Expand Down
2 changes: 1 addition & 1 deletion src/library/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"suggest": {
"ext-mbstring": "Mandatory when using Payload or VAPID extensions",
"ext-openssl": "Mandatory when using Payload or VAPID extensions",
"web-token/jwt-signature-algorithm-ecdsa": "Mandatory if you want to use VAPID using web-token/jwt-framework",
"web-token/jwt-library": "Mandatory if you want to use VAPID using web-token/jwt-framework",
"lcobucci/jwt": "Mandatory if you want to use VAPID using lcobucci/jwt",
"psr/log-implementation": "Recommended to receive logs from the library"
}
Expand Down
10 changes: 5 additions & 5 deletions tests/Library/Functional/Payload/AES128GCMTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,26 +239,26 @@ private function decryptRequest(
$ciphertext = $requestData->getBody();

// Salt
$salt = mb_substr($ciphertext, 0, 16, '8bit');
$salt = mb_substr((string) $ciphertext, 0, 16, '8bit');
static::assertSame(mb_strlen($salt, '8bit'), 16);

// Record size
$rs = mb_substr($ciphertext, 16, 4, '8bit');
$rs = mb_substr((string) $ciphertext, 16, 4, '8bit');
$rs = unpack('N', $rs)[1];
static::assertSame(4096, $rs);

// idlen
$idlen = ord(mb_substr($ciphertext, 20, 1, '8bit'));
$idlen = ord(mb_substr((string) $ciphertext, 20, 1, '8bit'));

//keyid
$keyid = mb_substr($ciphertext, 21, $idlen, '8bit');
$keyid = mb_substr((string) $ciphertext, 21, $idlen, '8bit');

// IKM
$keyInfo = 'WebPush: info' . chr(0) . ($inverted ? $receiverPublicKey . $keyid : $keyid . $receiverPublicKey);
$ikm = Utils::computeIKM($keyInfo, $authSecret, $keyid, $receiverPrivateKey, $receiverPublicKey);

// We remove the header
$ciphertext = mb_substr($ciphertext, 16 + 4 + 1 + $idlen, null, '8bit');
$ciphertext = mb_substr((string) $ciphertext, 16 + 4 + 1 + $idlen, null, '8bit');

// We compute the PRK
$prk = hash_hmac('sha256', $ikm, $salt, true);
Expand Down
4 changes: 2 additions & 2 deletions tests/Library/Functional/Payload/AESGCMTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ private function decryptRequest(
$nonceInfo = 'Content-Encoding: nonce' . chr(0) . $context;
$nonce = mb_substr(hash_hmac('sha256', $nonceInfo . chr(1), $prk, true), 0, 12, '8bit');

$C = mb_substr($ciphertext, 0, -16, '8bit');
$T = mb_substr($ciphertext, -16, null, '8bit');
$C = mb_substr((string) $ciphertext, 0, -16, '8bit');
$T = mb_substr((string) $ciphertext, -16, null, '8bit');

$rawData = openssl_decrypt($C, 'aes-128-gcm', $cek, OPENSSL_RAW_DATA, $nonce, $T);
$padding = mb_substr($rawData, 0, 2, '8bit');
Expand Down

0 comments on commit 5a91152

Please sign in to comment.