From 136a02f49ad2bb967f1d3d3419006b64adb20bac Mon Sep 17 00:00:00 2001 From: Dusan Malusev Date: Tue, 5 Mar 2024 12:25:04 +0100 Subject: [PATCH 1/2] chore: move LaravelKeyParser and EnvKeySaver to Traits namespace Signed-off-by: Dusan Malusev --- src/Keys/AppKey.php | 1 + src/Keys/Generators/AppKeyGenerator.php | 2 +- src/Keys/Generators/Blake2bHashingKeyGenerator.php | 2 +- src/{Keys => Traits}/EnvKeySaver.php | 2 +- src/{Keys => Traits}/LaravelKeyParser.php | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) rename src/{Keys => Traits}/EnvKeySaver.php (96%) rename src/{Keys => Traits}/LaravelKeyParser.php (94%) diff --git a/src/Keys/AppKey.php b/src/Keys/AppKey.php index 3c092ca..5df48e0 100644 --- a/src/Keys/AppKey.php +++ b/src/Keys/AppKey.php @@ -4,6 +4,7 @@ namespace CodeLieutenant\LaravelCrypto\Keys; +use CodeLieutenant\LaravelCrypto\Traits\LaravelKeyParser; use Illuminate\Contracts\Config\Repository; class AppKey implements Loader diff --git a/src/Keys/Generators/AppKeyGenerator.php b/src/Keys/Generators/AppKeyGenerator.php index 90ea682..f97953a 100644 --- a/src/Keys/Generators/AppKeyGenerator.php +++ b/src/Keys/Generators/AppKeyGenerator.php @@ -7,7 +7,7 @@ use CodeLieutenant\LaravelCrypto\Encryption\AesGcm256Encrypter; use CodeLieutenant\LaravelCrypto\Encryption\XChaCha20Poly1305Encrypter; use CodeLieutenant\LaravelCrypto\Enums\Encryption; -use CodeLieutenant\LaravelCrypto\Keys\EnvKeySaver; +use CodeLieutenant\LaravelCrypto\Traits\EnvKeySaver; use Illuminate\Contracts\Config\Repository; use Illuminate\Encryption\Encrypter; diff --git a/src/Keys/Generators/Blake2bHashingKeyGenerator.php b/src/Keys/Generators/Blake2bHashingKeyGenerator.php index 5b178cf..bf50c14 100644 --- a/src/Keys/Generators/Blake2bHashingKeyGenerator.php +++ b/src/Keys/Generators/Blake2bHashingKeyGenerator.php @@ -4,8 +4,8 @@ namespace CodeLieutenant\LaravelCrypto\Keys\Generators; -use CodeLieutenant\LaravelCrypto\Keys\EnvKeySaver; use CodeLieutenant\LaravelCrypto\Support\Random; +use CodeLieutenant\LaravelCrypto\Traits\EnvKeySaver; use Illuminate\Contracts\Config\Repository; class Blake2bHashingKeyGenerator implements Generator diff --git a/src/Keys/EnvKeySaver.php b/src/Traits/EnvKeySaver.php similarity index 96% rename from src/Keys/EnvKeySaver.php rename to src/Traits/EnvKeySaver.php index c1c7258..74aa540 100644 --- a/src/Keys/EnvKeySaver.php +++ b/src/Traits/EnvKeySaver.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace CodeLieutenant\LaravelCrypto\Keys; +namespace CodeLieutenant\LaravelCrypto\Traits; use CodeLieutenant\LaravelCrypto\Support\Base64; use RuntimeException; diff --git a/src/Keys/LaravelKeyParser.php b/src/Traits/LaravelKeyParser.php similarity index 94% rename from src/Keys/LaravelKeyParser.php rename to src/Traits/LaravelKeyParser.php index 6abf2a0..6ed151f 100644 --- a/src/Keys/LaravelKeyParser.php +++ b/src/Traits/LaravelKeyParser.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace CodeLieutenant\LaravelCrypto\Keys; +namespace CodeLieutenant\LaravelCrypto\Traits; use CodeLieutenant\LaravelCrypto\Support\Base64; use Illuminate\Encryption\MissingAppKeyException; From ca38d3a8851978399b3bd125dad7e2965c3d731b Mon Sep 17 00:00:00 2001 From: Dusan Malusev Date: Tue, 5 Mar 2024 12:27:31 +0100 Subject: [PATCH 2/2] feat: trait arch tests Signed-off-by: Dusan Malusev --- tests/Architecture/HashingTest.php | 3 +++ tests/Architecture/SigningTest.php | 4 ++++ tests/Architecture/TraitTest.php | 8 ++++++++ 3 files changed, 15 insertions(+) create mode 100644 tests/Architecture/HashingTest.php create mode 100644 tests/Architecture/SigningTest.php diff --git a/tests/Architecture/HashingTest.php b/tests/Architecture/HashingTest.php new file mode 100644 index 0000000..174d7fd --- /dev/null +++ b/tests/Architecture/HashingTest.php @@ -0,0 +1,3 @@ +expect('CodeLieutenant\LaravelCrypto\Traits') ->toBeTraits(); +arch('hashing traits') + ->expect('CodeLieutenant\LaravelCrypto\Hashing\Traits') + ->toBeTraits(); + +arch('signing traits') + ->expect('CodeLieutenant\LaravelCrypto\Signing\Traits') + ->toBeTraits(); +