Skip to content

Commit ca65c91

Browse files
author
Dusan Malusev
committed
Refactoring the codebase and upgrading to laravel 8 and php 7.4
Signed-off-by: Dusan Malusev <[email protected]>
1 parent b96f042 commit ca65c91

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+4804
-3997
lines changed

.phpunit.result.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C:37:"PHPUnit\Runner\DefaultTestResultCache":14012:{a:2:{s:7:"defects";a:71:{s:59:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_hash";i:4;s:63:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_hash_raw";i:4;s:61:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_verify";i:4;s:81:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_verify_with_incorrect_data";i:4;s:81:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_verify_with_incorrect_hash";i:4;s:65:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_verify_raw";i:4;s:85:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_verify_raw_with_incorrect_data";i:4;s:58:"BrosSquad\LaravelCrypto\Tests\Common\Sha256Test::test_hash";i:4;s:62:"BrosSquad\LaravelCrypto\Tests\Common\Sha256Test::test_hash_raw";i:4;s:60:"BrosSquad\LaravelCrypto\Tests\Common\Sha256Test::test_verify";i:4;s:64:"BrosSquad\LaravelCrypto\Tests\Common\Sha256Test::test_verify_raw";i:4;s:58:"BrosSquad\LaravelCrypto\Tests\Common\Sha512Test::test_hash";i:4;s:62:"BrosSquad\LaravelCrypto\Tests\Common\Sha512Test::test_hash_raw";i:4;s:60:"BrosSquad\LaravelCrypto\Tests\Common\Sha512Test::test_verify";i:4;s:64:"BrosSquad\LaravelCrypto\Tests\Common\Sha512Test::test_verify_raw";i:4;s:95:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_default_hashing_blase2";i:4;s:94:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_blade2_hashing_blase2";i:4;s:87:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_sha256_hashing";i:4;s:87:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_sha512_hashing";i:4;s:92:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_default_hmac_sha256";i:4;s:84:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_hmac_sha512";i:4;s:84:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_hmac_sha256";i:4;s:109:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_default_public_key_signing_algorithm";i:4;s:100:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_default_xchacha20_algorithm";i:4;s:100:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_default_aes256gcm_algorithm";i:4;s:100:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_default_aes256cbc_algorithm";i:4;s:70:"BrosSquad\LaravelCrypto\Tests\Encryption\AesGcm256Test::testEncryption";i:4;s:71:"BrosSquad\LaravelCrypto\Tests\Encryption\AesGcm256Test::test_key_length";i:4;s:101:"BrosSquad\LaravelCrypto\Tests\Encryption\AesGcm256Test::test_aes256gcm_with_laravel_encryption_facade";i:4;s:86:"BrosSquad\LaravelCrypto\Tests\Encryption\EncryptionTest::test_not_supported_algorithms";i:4;s:82:"BrosSquad\LaravelCrypto\Tests\Encryption\EncryptionTest::test_supported_algorithms";i:4;s:100:"BrosSquad\LaravelCrypto\Tests\Encryption\EncryptionTest::test_supported_algorithms_with_crypt_facade";i:4;s:81:"BrosSquad\LaravelCrypto\Tests\Encryption\EncryptionTest::test_get_key_with_sodium";i:4;s:78:"BrosSquad\LaravelCrypto\Tests\Encryption\XChaCha20Poly1305Test::testEncryption";i:4;s:79:"BrosSquad\LaravelCrypto\Tests\Encryption\XChaCha20Poly1305Test::test_key_length";i:4;s:109:"BrosSquad\LaravelCrypto\Tests\Encryption\XChaCha20Poly1305Test::test_xchacha20_with_laravel_encryption_facade";i:4;s:71:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_raw_signing";i:4;s:77:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_invalid_signature";i:4;s:81:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_invalid_raw_signature";i:4;s:106:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_verify_with_wrong_number_of_bytes_in_signature";i:4;s:93:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_verify_with_wrong_signature_input";i:4;s:84:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_signing_and_verification";i:4;s:98:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_signing_and_verification_with_raw_data";i:4;s:65:"BrosSquad\LaravelCrypto\Tests\Signing\Hmac\Hmac256Test::test_sign";i:4;s:69:"BrosSquad\LaravelCrypto\Tests\Signing\Hmac\Hmac256Test::test_sign_raw";i:4;s:65:"BrosSquad\LaravelCrypto\Tests\Signing\Hmac\Hmac512Test::test_sign";i:4;s:69:"BrosSquad\LaravelCrypto\Tests\Signing\Hmac\Hmac512Test::test_sign_raw";i:4;s:86:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_good_base64_encoded_string";i:4;s:86:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_good_base64_decoded_buffer";i:4;s:90:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_good_base64_url_encoded_string";i:4;s:90:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_good_base64_url_decoded_buffer";i:4;s:87:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_constant_time_base64_encode";i:4;s:91:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_constant_time_base64_url_encode";i:4;s:87:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_constant_time_base64_decode";i:4;s:91:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_constant_time_base64_url_decode";i:4;s:78:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::base64_decoded_string_length";i:4;s:75:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::max_base64_decoded_string";i:4;s:91:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::base64_encoded_string_length_with_padding";i:4;s:94:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::base64_encoded_string_length_without_padding";i:4;s:90:"BrosSquad\LaravelCrypto\Tests\Support\RandomTest::should_give_base64_encoded_random_string";i:4;s:105:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_default_xchacha20_algorithm";i:4;s:105:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_default_aes256gcm_algorithm";i:4;s:105:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_default_aes256cbc_algorithm";i:4;s:101:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_default_hashing_blake2b";i:4;s:100:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_blade2_hashing_blake2b";i:4;s:92:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_sha256_hashing";i:4;s:92:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_sha512_hashing";i:4;s:97:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_default_hmac_sha256";i:4;s:89:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_hmac_sha512";i:4;s:89:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_hmac_sha256";i:4;s:114:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_default_public_key_signing_algorithm";i:4;}s:5:"times";a:71:{s:59:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_hash";d:0.037;s:63:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_hash_raw";d:0.005;s:61:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_verify";d:0.005;s:81:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_verify_with_incorrect_data";d:0.005;s:81:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_verify_with_incorrect_hash";d:0.005;s:65:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_verify_raw";d:0.005;s:85:"BrosSquad\LaravelCrypto\Tests\Common\Blake2bTest::test_verify_raw_with_incorrect_data";d:0.005;s:58:"BrosSquad\LaravelCrypto\Tests\Common\Sha256Test::test_hash";d:0.005;s:62:"BrosSquad\LaravelCrypto\Tests\Common\Sha256Test::test_hash_raw";d:0.005;s:60:"BrosSquad\LaravelCrypto\Tests\Common\Sha256Test::test_verify";d:0.005;s:64:"BrosSquad\LaravelCrypto\Tests\Common\Sha256Test::test_verify_raw";d:0.005;s:58:"BrosSquad\LaravelCrypto\Tests\Common\Sha512Test::test_hash";d:0.005;s:62:"BrosSquad\LaravelCrypto\Tests\Common\Sha512Test::test_hash_raw";d:0.005;s:60:"BrosSquad\LaravelCrypto\Tests\Common\Sha512Test::test_verify";d:0.005;s:64:"BrosSquad\LaravelCrypto\Tests\Common\Sha512Test::test_verify_raw";d:0.005;s:95:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_default_hashing_blase2";d:0.005;s:94:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_blade2_hashing_blase2";d:0.005;s:87:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_sha256_hashing";d:0.005;s:87:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_sha512_hashing";d:0.005;s:92:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_default_hmac_sha256";d:0.005;s:84:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_hmac_sha512";d:0.005;s:84:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_hmac_sha256";d:0.005;s:109:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_default_public_key_signing_algorithm";d:0.006;s:100:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_default_xchacha20_algorithm";d:0.006;s:100:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_default_aes256gcm_algorithm";d:0.005;s:100:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::should_get_default_aes256cbc_algorithm";d:0.005;s:70:"BrosSquad\LaravelCrypto\Tests\Encryption\AesGcm256Test::testEncryption";d:0.005;s:71:"BrosSquad\LaravelCrypto\Tests\Encryption\AesGcm256Test::test_key_length";d:0.005;s:101:"BrosSquad\LaravelCrypto\Tests\Encryption\AesGcm256Test::test_aes256gcm_with_laravel_encryption_facade";d:0.005;s:86:"BrosSquad\LaravelCrypto\Tests\Encryption\EncryptionTest::test_not_supported_algorithms";d:0.005;s:82:"BrosSquad\LaravelCrypto\Tests\Encryption\EncryptionTest::test_supported_algorithms";d:0.005;s:100:"BrosSquad\LaravelCrypto\Tests\Encryption\EncryptionTest::test_supported_algorithms_with_crypt_facade";d:0.005;s:81:"BrosSquad\LaravelCrypto\Tests\Encryption\EncryptionTest::test_get_key_with_sodium";d:0.005;s:78:"BrosSquad\LaravelCrypto\Tests\Encryption\XChaCha20Poly1305Test::testEncryption";d:0.005;s:79:"BrosSquad\LaravelCrypto\Tests\Encryption\XChaCha20Poly1305Test::test_key_length";d:0.005;s:109:"BrosSquad\LaravelCrypto\Tests\Encryption\XChaCha20Poly1305Test::test_xchacha20_with_laravel_encryption_facade";d:0.005;s:71:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_raw_signing";d:0.005;s:77:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_invalid_signature";d:0.005;s:81:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_invalid_raw_signature";d:0.005;s:106:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_verify_with_wrong_number_of_bytes_in_signature";d:0.005;s:93:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_verify_with_wrong_signature_input";d:0.005;s:84:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_signing_and_verification";d:0.005;s:98:"BrosSquad\LaravelCrypto\Tests\Signing\EdDSA\EdDSATest::test_signing_and_verification_with_raw_data";d:0.005;s:65:"BrosSquad\LaravelCrypto\Tests\Signing\Hmac\Hmac256Test::test_sign";d:0.006;s:69:"BrosSquad\LaravelCrypto\Tests\Signing\Hmac\Hmac256Test::test_sign_raw";d:0.005;s:65:"BrosSquad\LaravelCrypto\Tests\Signing\Hmac\Hmac512Test::test_sign";d:0.005;s:69:"BrosSquad\LaravelCrypto\Tests\Signing\Hmac\Hmac512Test::test_sign_raw";d:0.006;s:86:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_good_base64_encoded_string";d:0.005;s:86:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_good_base64_decoded_buffer";d:0.005;s:90:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_good_base64_url_encoded_string";d:0.005;s:90:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_good_base64_url_decoded_buffer";d:0.005;s:87:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_constant_time_base64_encode";d:0.005;s:91:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_constant_time_base64_url_encode";d:0.005;s:87:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_constant_time_base64_decode";d:0.005;s:91:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::should_be_constant_time_base64_url_decode";d:0.005;s:78:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::base64_decoded_string_length";d:0.006;s:75:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::max_base64_decoded_string";d:0.005;s:91:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::base64_encoded_string_length_with_padding";d:0.005;s:94:"BrosSquad\LaravelCrypto\Tests\Support\Base64Test::base64_encoded_string_length_without_padding";d:0.005;s:90:"BrosSquad\LaravelCrypto\Tests\Support\RandomTest::should_give_base64_encoded_random_string";d:0.005;s:101:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_default_hashing_blake2b";d:0.005;s:100:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_blade2_hashing_blake2b";d:0.005;s:92:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_sha256_hashing";d:0.006;s:92:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_sha512_hashing";d:0.006;s:97:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_default_hmac_sha256";d:0.008;s:89:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_hmac_sha512";d:0.005;s:89:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_hmac_sha256";d:0.005;s:114:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_default_public_key_signing_algorithm";d:0.006;s:105:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_default_xchacha20_algorithm";d:0.005;s:105:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_default_aes256gcm_algorithm";d:0.005;s:105:"BrosSquad\LaravelCrypto\Tests\DefaultValuesFromContainerTest::test_should_get_default_aes256cbc_algorithm";d:0.005;}}}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,17 @@ Read more on [HMAC](https://en.wikipedia.org/wiki/HMAC)
263263

264264
namespace App\Service;
265265

266-
use BrosSquad\LaravelCrypto\Facades\Hmac;
266+
use BrosSquad\LaravelCrypto\Facades\Signing;
267267

268268
class Service
269269
{
270270
public function createSignature()
271271
{
272272
$data = 'Hello World';
273273

274-
$signature = Hmac::sign($data); // Base64 Encoded encoded signature
274+
$signature = Signing::sign($data); // Base64 Encoded encoded signature
275275

276-
$signature = Hmac::signRaw($data); // Raw bytes for signature
276+
$signature = Signing::signRaw($data); // Raw bytes for signature
277277

278278
// Rest of the code
279279
}
@@ -282,7 +282,7 @@ class Service
282282
{
283283
$data = 'Hello World';
284284

285-
if(Hmac::verify($data, $signature)) {
285+
if(Signing::verify($data, $signature)) {
286286
// Signature is valid
287287
} else {
288288
// Signature is invalid

azure-pipelines.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
trigger:
2-
- master
3-
- dev
2+
- master
3+
- dev
44

55
pool:
66
vmImage: 'ubuntu-latest'
77

88
variables:
9-
phpVersion: 7.3
9+
phpVersion: 7.4
1010
COMPOSER_CACHE_DIR: $(Pipeline.Workspace)/.composer
1111

1212
steps:
13-
- task: Cache@2
14-
inputs:
15-
key: 'composer | "$(Agent.OS)" | composer.lock'
16-
restoreKeys: |
17-
composer | "$(Agent.OS)"
18-
composer
19-
path: $(COMPOSER_CACHE_DIR)
20-
displayName: Cache composer
13+
- task: Cache@2
14+
inputs:
15+
key: 'composer | "$(Agent.OS)" | composer.lock'
16+
restoreKeys: |
17+
composer | "$(Agent.OS)"
18+
composer
19+
path: $(COMPOSER_CACHE_DIR)
20+
displayName: Cache composer
2121

2222

23-
- script: |
24-
sudo update-alternatives --set php /usr/bin/php$(phpVersion)
25-
sudo update-alternatives --set phar /usr/bin/phar$(phpVersion)
26-
sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion)
27-
sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion)
28-
sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion)
29-
php -version
30-
displayName: 'Use PHP version $(phpVersion)'
23+
- script: |
24+
sudo update-alternatives --set php /usr/bin/php$(phpVersion)
25+
sudo update-alternatives --set phar /usr/bin/phar$(phpVersion)
26+
sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion)
27+
sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion)
28+
sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion)
29+
php -version
30+
displayName: 'Use PHP version $(phpVersion)'
3131
32-
- script: composer install --no-interaction --prefer-dist
33-
displayName: 'Composer install'
34-
- script: ./vendor/bin/phpunit
35-
displayName: 'Testing'
32+
- script: composer install --no-interaction --prefer-dist
33+
displayName: 'Composer install'
34+
- script: ./vendor/bin/phpunit
35+
displayName: 'Testing'

benchmarks/DecryptionBench.php

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,21 @@
11
<?php
22

3+
declare(strict_types=1);
34

45
namespace BrosSquad\LaravelCrypto\Benchmarks\Encryption;
56

6-
77
use BrosSquad\LaravelCrypto\Encryption\AesGcm256Encryptor;
88
use BrosSquad\LaravelCrypto\Encryption\XChaCha20Poly5Encryptor;
99
use Illuminate\Encryption\Encrypter;
1010

1111
class DecryptionBench
1212
{
13-
14-
/**
15-
* @var Encrypter
16-
*/
17-
private $laravelEncrypter;
18-
19-
/**
20-
* @var XChaCha20Poly5Encryptor
21-
*/
22-
private $xchacha;
23-
24-
/**
25-
* @var AesGcm256Encryptor
26-
*/
27-
private $aes256gcm;
28-
29-
/**
30-
* @var string
31-
*/
32-
private $xChaChaData;
33-
34-
/**
35-
* @var string
36-
*/
37-
private $aes256GcmData;
38-
39-
/**
40-
* @var string
41-
*/
42-
private $laravelData;
13+
private Encrypter $laravelEncrypter;
14+
private XChaCha20Poly5Encryptor $xchacha;
15+
private AesGcm256Encryptor $aes256gcm;
16+
private string $xChaChaData;
17+
private string $aes256GcmData;
18+
private string $laravelData;
4319

4420
public function __construct()
4521
{

benchmarks/EncryptionBench.php

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace BrosSquad\LaravelCrypto\Benchmarks\Encryption;
34

45
use BrosSquad\LaravelCrypto\Encryption\AesGcm256Encryptor;
@@ -7,25 +8,10 @@
78

89
class EncryptionBench
910
{
10-
/**
11-
* @var Encrypter
12-
*/
13-
private $laravelEncrypter;
14-
15-
/**
16-
* @var XChaCha20Poly5Encryptor
17-
*/
18-
private $xchacha;
19-
20-
/**
21-
* @var AesGcm256Encryptor
22-
*/
23-
private $aes256gcm;
24-
25-
/**
26-
* @var string
27-
*/
28-
private $data;
11+
private Encrypter $laravelEncrypter;
12+
private XChaCha20Poly5Encryptor $xchacha;
13+
private AesGcm256Encryptor $aes256gcm;
14+
private string $data;
2915

3016
public function __construct()
3117
{

composer.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,22 @@
1010
}
1111
],
1212
"minimum-stability": "stable",
13+
"scripts": {
14+
"test": "./vendor/bin/phpunit"
15+
},
1316
"require": {
1417
"php": ">=7.4",
1518
"ext-sodium": "*",
16-
"ext-json": "*"
19+
"ext-json": "*",
20+
"illuminate/support": "^8",
21+
"illuminate/contracts": "^8",
22+
"illuminate/config": "^8",
23+
"illuminate/hashing": "^8",
24+
"illuminate/encryption": "^8",
25+
"illuminate/collections": "^8"
1726
},
1827
"require-dev": {
19-
"orchestra/testbench": "^5.3",
28+
"orchestra/testbench": "^6",
2029
"phpbench/phpbench": "@dev"
2130
},
2231
"autoload": {
@@ -32,13 +41,11 @@
3241
"extra": {
3342
"laravel": {
3443
"providers": [
35-
"BrosSquad\\LaravelCrypto\\HashingServiceProvider"
44+
"ServiceProvider"
3645
],
3746
"aliases": {
3847
"Hashing": "BrosSquad\\LaravelCrypto\\Facades\\Hashing",
39-
"Base64": "BrosSquad\\LaravelCrypto\\Facades\\Base64",
40-
"Hmac": "BrosSquad\\LaravelCrypto\\Facades\\Hmac",
41-
"Random": "BrosSquad\\LaravelCrypto\\Facades\\Random"
48+
"Signing": "BrosSquad\\LaravelCrypto\\Facades\\Signing"
4249
}
4350
}
4451
}

0 commit comments

Comments
 (0)