From 0830c36692d17ce93fdf2b43d65cb09573ed51a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Dec 2025 15:19:14 +0000 Subject: [PATCH 1/4] build(deps): bump the maintenance group with 5 updates --- updated-dependencies: - dependency-name: firebase/php-jwt dependency-version: 7.0.2 dependency-type: direct:production update-type: version-update:semver-major dependency-group: maintenance - dependency-name: lion/test dependency-version: 4.0.0 dependency-type: direct:development update-type: version-update:semver-major dependency-group: maintenance - dependency-name: phpstan/phpstan dependency-version: 2.1.33 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: maintenance - dependency-name: phpunit/phpunit dependency-version: 12.5.4 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: maintenance - dependency-name: infection/infection dependency-version: 0.32.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: maintenance ... Signed-off-by: dependabot[bot] --- composer.json | 6 +- composer.lock | 393 +++++++++++++++++++++++++++++--------------------- 2 files changed, 234 insertions(+), 165 deletions(-) diff --git a/composer.json b/composer.json index 421e965..d4fc73a 100644 --- a/composer.json +++ b/composer.json @@ -26,17 +26,17 @@ "require": { "php": ">=8.5", "ext-openssl": "*", - "firebase/php-jwt": "^6.1", + "firebase/php-jwt": "^6.1 || ^7.0", "vlucas/valitron": "^1.4" }, "require-dev": { "guzzlehttp/guzzle": "^7.8", - "lion/test": "^3.2", + "lion/test": "^3.2 || ^4.0", "phpstan/phpstan": "^2.1", "squizlabs/php_codesniffer": "^3.11 || ^4.0", "phpunit/phpunit": "^12.0", "overtrue/phplint": "^9.5", - "infection/infection": "^0.29.14 || ^0.31.0" + "infection/infection": "^0.29.14 || ^0.31.0 || ^0.32.0" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index 94fb230..7aceb6d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ad58a6b5b1adf530a7dbe352e6f58886", + "content-hash": "84b0f3d1e9719615cd372656ecaed31f", "packages": [ { "name": "firebase/php-jwt", - "version": "v6.11.1", + "version": "v7.0.2", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "d1e91ecf8c598d073d0995afa8cd5c75c6e19e66" + "reference": "5645b43af647b6947daac1d0f659dd1fbe8d3b65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/d1e91ecf8c598d073d0995afa8cd5c75c6e19e66", - "reference": "d1e91ecf8c598d073d0995afa8cd5c75c6e19e66", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/5645b43af647b6947daac1d0f659dd1fbe8d3b65", + "reference": "5645b43af647b6947daac1d0f659dd1fbe8d3b65", "shasum": "" }, "require": { @@ -65,9 +65,9 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.11.1" + "source": "https://github.com/firebase/php-jwt/tree/v7.0.2" }, - "time": "2025-04-09T20:32:01+00:00" + "time": "2025-12-16T22:17:28+00:00" }, { "name": "vlucas/valitron", @@ -928,16 +928,16 @@ }, { "name": "infection/infection", - "version": "0.31.9", + "version": "0.32.0", "source": { "type": "git", - "url": "https://github.com/infection/infection.git", - "reference": "f9628fcd7f76eadf24726e57a81937c42458232b" + "url": "https://github.com/infection/infection", + "reference": "71d4a12cbe62d79c06dce628b8a5fe234636424c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infection/infection/zipball/f9628fcd7f76eadf24726e57a81937c42458232b", - "reference": "f9628fcd7f76eadf24726e57a81937c42458232b", + "url": "https://api.github.com/repos/infection/infection/zipball/71d4a12cbe62d79c06dce628b8a5fe234636424c", + "reference": "71d4a12cbe62d79c06dce628b8a5fe234636424c", "shasum": "" }, "require": { @@ -954,20 +954,22 @@ "infection/include-interceptor": "^0.2.5", "infection/mutator": "^0.4", "justinrainbow/json-schema": "^6.0", - "nikic/php-parser": "^5.3", + "nikic/php-parser": "^5.6.2", "ondram/ci-detector": "^4.1.0", "php": "^8.2", + "psr/log": "^2.0 || ^3.0", "sanmai/di-container": "^0.1.4", "sanmai/duoclock": "^0.1.0", "sanmai/later": "^0.1.7", "sanmai/pipeline": "^7.0", "sebastian/diff": "^4.0 || ^5.0 || ^6.0 || ^7.0", - "symfony/console": "^6.4 || ^7.0", - "symfony/filesystem": "^6.4 || ^7.0", - "symfony/finder": "^6.4 || ^7.0", - "symfony/process": "^6.4 || ^7.0", + "symfony/console": "^6.4 || ^7.0 || ^8.0", + "symfony/filesystem": "^6.4 || ^7.0 || ^8.0", + "symfony/finder": "^6.4 || ^7.0 || ^8.0", + "symfony/polyfill-php85": "^1.33", + "symfony/process": "^6.4 || ^7.0 || ^8.0", "thecodingmachine/safe": "^v3.0", - "webmozart/assert": "^1.11" + "webmozart/assert": "^1.11 || ^2.0" }, "conflict": { "antecedent/patchwork": "<2.1.25", @@ -976,18 +978,21 @@ "require-dev": { "ext-simplexml": "*", "fidry/makefile": "^1.0", + "fig/log-test": "^1.2", + "phpbench/phpbench": "^1.4", "phpstan/extension-installer": "^1.4", "phpstan/phpstan": "^2.1", "phpstan/phpstan-phpunit": "^2.0", "phpstan/phpstan-strict-rules": "^2.0", "phpstan/phpstan-webmozart-assert": "^2.0", "phpunit/phpunit": "^11.5.27", - "rector/rector": "^2.0", - "shipmonk/dead-code-detector": "^0.12.0", + "rector/rector": "^2.2.4", + "shipmonk/dead-code-detector": "^0.14.0", "shipmonk/name-collision-detector": "^2.1", "sidz/phpstan-rules": "^0.5.1", - "symfony/yaml": "^6.4 || ^7.0", - "thecodingmachine/phpstan-safe-rule": "^1.4" + "symfony/yaml": "^6.4 || ^7.0 || ^8.0", + "thecodingmachine/phpstan-safe-rule": "^1.4", + "webmozarts/strict-phpunit": "^7.15" }, "bin": [ "bin/infection" @@ -1042,20 +1047,9 @@ "unit testing" ], "support": { - "issues": "https://github.com/infection/infection/issues", - "source": "https://github.com/infection/infection/tree/0.31.9" + "issues": "https://github.com/infection/infection/issues" }, - "funding": [ - { - "url": "https://github.com/infection", - "type": "github" - }, - { - "url": "https://opencollective.com/infection", - "type": "open_collective" - } - ], - "time": "2025-10-27T12:00:54+00:00" + "time": "2025-12-24T13:55:03+00:00" }, { "name": "infection/mutator", @@ -1112,21 +1106,21 @@ }, { "name": "justinrainbow/json-schema", - "version": "6.6.0", + "version": "6.6.3", "source": { "type": "git", "url": "https://github.com/jsonrainbow/json-schema.git", - "reference": "68ba7677532803cc0c5900dd5a4d730537f2b2f3" + "reference": "134e98916fa2f663afa623970af345cd788e8967" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/68ba7677532803cc0c5900dd5a4d730537f2b2f3", - "reference": "68ba7677532803cc0c5900dd5a4d730537f2b2f3", + "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/134e98916fa2f663afa623970af345cd788e8967", + "reference": "134e98916fa2f663afa623970af345cd788e8967", "shasum": "" }, "require": { "ext-json": "*", - "marc-mabe/php-enum": "^4.0", + "marc-mabe/php-enum": "^4.4", "php": "^7.2 || ^8.0" }, "require-dev": { @@ -1181,27 +1175,27 @@ ], "support": { "issues": "https://github.com/jsonrainbow/json-schema/issues", - "source": "https://github.com/jsonrainbow/json-schema/tree/6.6.0" + "source": "https://github.com/jsonrainbow/json-schema/tree/6.6.3" }, - "time": "2025-10-10T11:34:09+00:00" + "time": "2025-12-02T10:21:33+00:00" }, { "name": "lion/test", - "version": "v3.13.0", + "version": "v4.0.0", "source": { "type": "git", "url": "https://github.com/lion-packages/test.git", - "reference": "18136f6172194469eeb94f3c6731aba000b35876" + "reference": "87bfdf9dd80b9c4918c025e850e286f0272045fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lion-packages/test/zipball/18136f6172194469eeb94f3c6731aba000b35876", - "reference": "18136f6172194469eeb94f3c6731aba000b35876", + "url": "https://api.github.com/repos/lion-packages/test/zipball/87bfdf9dd80b9c4918c025e850e286f0272045fa", + "reference": "87bfdf9dd80b9c4918c025e850e286f0272045fa", "shasum": "" }, "require": { "ext-gd": "*", - "php": ">=8.4" + "php": ">=8.5" }, "require-dev": { "infection/infection": "^0.29.14 || ^0.31.0", @@ -1221,7 +1215,7 @@ "license": [ "MIT" ], - "description": "Library to implement testing with helpers that allow easy testing with PHPUnit", + "description": "Library to implement testing with helpers that allow easy testing with PHPUnit.", "homepage": "https://dev.lion-packages.com", "keywords": [ "lion", @@ -1232,7 +1226,7 @@ "issues": "https://github.com/lion-packages/test/issues", "source": "https://github.com/lion-packages/test" }, - "time": "2025-11-28T22:41:32+00:00" + "time": "2025-12-21T23:48:23+00:00" }, { "name": "marc-mabe/php-enum", @@ -1369,16 +1363,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.6.2", + "version": "v5.7.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "3a454ca033b9e06b63282ce19562e892747449bb" + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3a454ca033b9e06b63282ce19562e892747449bb", - "reference": "3a454ca033b9e06b63282ce19562e892747449bb", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82", + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82", "shasum": "" }, "require": { @@ -1421,9 +1415,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0" }, - "time": "2025-10-21T19:32:17+00:00" + "time": "2025-12-06T11:56:16+00:00" }, { "name": "ondram/ci-detector", @@ -1709,11 +1703,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.32", + "version": "2.1.33", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e126cad1e30a99b137b8ed75a85a676450ebb227", - "reference": "e126cad1e30a99b137b8ed75a85a676450ebb227", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9e800e6bee7d5bd02784d4c6069b48032d16224f", + "reference": "9e800e6bee7d5bd02784d4c6069b48032d16224f", "shasum": "" }, "require": { @@ -1758,27 +1752,27 @@ "type": "github" } ], - "time": "2025-11-11T15:18:17+00:00" + "time": "2025-12-05T10:24:31+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "12.5.0", + "version": "12.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "bca180c050dd3ae15f87c26d25cabb34fe1a0a5a" + "reference": "4a9739b51cbcb355f6e95659612f92e282a7077b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/bca180c050dd3ae15f87c26d25cabb34fe1a0a5a", - "reference": "bca180c050dd3ae15f87c26d25cabb34fe1a0a5a", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/4a9739b51cbcb355f6e95659612f92e282a7077b", + "reference": "4a9739b51cbcb355f6e95659612f92e282a7077b", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^5.6.2", + "nikic/php-parser": "^5.7.0", "php": ">=8.3", "phpunit/php-file-iterator": "^6.0", "phpunit/php-text-template": "^5.0", @@ -1786,10 +1780,10 @@ "sebastian/environment": "^8.0.3", "sebastian/lines-of-code": "^4.0", "sebastian/version": "^6.0", - "theseer/tokenizer": "^1.3.1" + "theseer/tokenizer": "^2.0.1" }, "require-dev": { - "phpunit/phpunit": "^12.4.4" + "phpunit/phpunit": "^12.5.1" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -1827,7 +1821,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/12.5.0" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/12.5.2" }, "funding": [ { @@ -1847,7 +1841,7 @@ "type": "tidelift" } ], - "time": "2025-11-29T07:15:54+00:00" + "time": "2025-12-24T07:03:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2096,16 +2090,16 @@ }, { "name": "phpunit/phpunit", - "version": "12.4.5", + "version": "12.5.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "5af317802efd27d5b9cbe048e3760d4a2f687f45" + "reference": "4ba0e923f9d3fc655de22f9547c01d15a41fc93a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5af317802efd27d5b9cbe048e3760d4a2f687f45", - "reference": "5af317802efd27d5b9cbe048e3760d4a2f687f45", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4ba0e923f9d3fc655de22f9547c01d15a41fc93a", + "reference": "4ba0e923f9d3fc655de22f9547c01d15a41fc93a", "shasum": "" }, "require": { @@ -2119,7 +2113,7 @@ "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=8.3", - "phpunit/php-code-coverage": "^12.4.0", + "phpunit/php-code-coverage": "^12.5.1", "phpunit/php-file-iterator": "^6.0.0", "phpunit/php-invoker": "^6.0.0", "phpunit/php-text-template": "^5.0.0", @@ -2141,7 +2135,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "12.4-dev" + "dev-main": "12.5-dev" } }, "autoload": { @@ -2173,7 +2167,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/12.4.5" + "source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.4" }, "funding": [ { @@ -2197,7 +2191,7 @@ "type": "tidelift" } ], - "time": "2025-12-01T07:40:15+00:00" + "time": "2025-12-15T06:05:34+00:00" }, { "name": "psr/cache", @@ -2730,16 +2724,16 @@ }, { "name": "sanmai/duoclock", - "version": "0.1.1", + "version": "0.1.3", "source": { "type": "git", "url": "https://github.com/sanmai/DuoClock.git", - "reference": "30aa40092396dc96b68c8e8d49162619574477e2" + "reference": "47461e3ff65b7308635047831a55615652e7be1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sanmai/DuoClock/zipball/30aa40092396dc96b68c8e8d49162619574477e2", - "reference": "30aa40092396dc96b68c8e8d49162619574477e2", + "url": "https://api.github.com/repos/sanmai/DuoClock/zipball/47461e3ff65b7308635047831a55615652e7be1a", + "reference": "47461e3ff65b7308635047831a55615652e7be1a", "shasum": "" }, "require": { @@ -2757,8 +2751,7 @@ "phpstan/extension-installer": "^1.4", "phpstan/phpstan": "^2", "phpunit/phpunit": "^11.5.25", - "sanmai/phpstan-rules": "^0.3.1", - "vimeo/psalm": "^6.12" + "sanmai/phpstan-rules": "^0.3.1" }, "type": "library", "extra": { @@ -2782,7 +2775,7 @@ "description": "PHP time mocking for tests - PSR-20 clock with mockable sleep(), time(), and TimeSpy for PHPUnit testing", "support": { "issues": "https://github.com/sanmai/DuoClock/issues", - "source": "https://github.com/sanmai/DuoClock/tree/0.1.1" + "source": "https://github.com/sanmai/DuoClock/tree/0.1.3" }, "funding": [ { @@ -2790,7 +2783,7 @@ "type": "github" } ], - "time": "2025-07-28T02:17:28+00:00" + "time": "2025-12-26T06:12:34+00:00" }, { "name": "sanmai/later", @@ -2858,16 +2851,16 @@ }, { "name": "sanmai/pipeline", - "version": "7.4", + "version": "7.6", "source": { "type": "git", "url": "https://github.com/sanmai/pipeline.git", - "reference": "6a73545f09b9b475a3735ecdee5e98476a063179" + "reference": "f7aeb6e1c9572f366c6035c79d715a2a73eeb1c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sanmai/pipeline/zipball/6a73545f09b9b475a3735ecdee5e98476a063179", - "reference": "6a73545f09b9b475a3735ecdee5e98476a063179", + "url": "https://api.github.com/repos/sanmai/pipeline/zipball/f7aeb6e1c9572f366c6035c79d715a2a73eeb1c9", + "reference": "f7aeb6e1c9572f366c6035c79d715a2a73eeb1c9", "shasum": "" }, "require": { @@ -2914,7 +2907,7 @@ "description": "General-purpose collections pipeline", "support": { "issues": "https://github.com/sanmai/pipeline/issues", - "source": "https://github.com/sanmai/pipeline/tree/7.4" + "source": "https://github.com/sanmai/pipeline/tree/7.6" }, "funding": [ { @@ -2922,7 +2915,7 @@ "type": "github" } ], - "time": "2025-10-11T07:22:29+00:00" + "time": "2025-12-20T07:22:08+00:00" }, { "name": "sebastian/cli-parser", @@ -4130,47 +4123,39 @@ }, { "name": "symfony/console", - "version": "v7.4.0", + "version": "v8.0.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0bc0f45254b99c58d45a8fbf9fb955d46cbd1bb8" + "reference": "fcb73f69d655b48fcb894a262f074218df08bd58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0bc0f45254b99c58d45a8fbf9fb955d46cbd1bb8", - "reference": "0bc0f45254b99c58d45a8fbf9fb955d46cbd1bb8", + "url": "https://api.github.com/repos/symfony/console/zipball/fcb73f69d655b48fcb894a262f074218df08bd58", + "reference": "fcb73f69d655b48fcb894a262f074218df08bd58", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", + "php": ">=8.4", + "symfony/polyfill-mbstring": "^1.0", "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^7.2|^8.0" - }, - "conflict": { - "symfony/dependency-injection": "<6.4", - "symfony/dotenv": "<6.4", - "symfony/event-dispatcher": "<6.4", - "symfony/lock": "<6.4", - "symfony/process": "<6.4" + "symfony/string": "^7.4|^8.0" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/event-dispatcher": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/lock": "^6.4|^7.0|^8.0", - "symfony/messenger": "^6.4|^7.0|^8.0", - "symfony/process": "^6.4|^7.0|^8.0", - "symfony/stopwatch": "^6.4|^7.0|^8.0", - "symfony/var-dumper": "^6.4|^7.0|^8.0" + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/event-dispatcher": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/lock": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -4204,7 +4189,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.4.0" + "source": "https://github.com/symfony/console/tree/v8.0.1" }, "funding": [ { @@ -4224,7 +4209,7 @@ "type": "tidelift" } ], - "time": "2025-11-27T13:27:24+00:00" + "time": "2025-12-05T15:25:33+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4456,25 +4441,25 @@ }, { "name": "symfony/filesystem", - "version": "v7.3.2", + "version": "v8.0.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "edcbb768a186b5c3f25d0643159a787d3e63b7fd" + "reference": "d937d400b980523dc9ee946bb69972b5e619058d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/edcbb768a186b5c3f25d0643159a787d3e63b7fd", - "reference": "edcbb768a186b5c3f25d0643159a787d3e63b7fd", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/d937d400b980523dc9ee946bb69972b5e619058d", + "reference": "d937d400b980523dc9ee946bb69972b5e619058d", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8" }, "require-dev": { - "symfony/process": "^6.4|^7.0" + "symfony/process": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -4502,7 +4487,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.3.2" + "source": "https://github.com/symfony/filesystem/tree/v8.0.1" }, "funding": [ { @@ -4522,27 +4507,27 @@ "type": "tidelift" } ], - "time": "2025-07-07T08:17:47+00:00" + "time": "2025-12-01T09:13:36+00:00" }, { "name": "symfony/finder", - "version": "v7.4.0", + "version": "v8.0.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "340b9ed7320570f319028a2cbec46d40535e94bd" + "reference": "7598dd5770580fa3517ec83e8da0c9b9e01f4291" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/340b9ed7320570f319028a2cbec46d40535e94bd", - "reference": "340b9ed7320570f319028a2cbec46d40535e94bd", + "url": "https://api.github.com/repos/symfony/finder/zipball/7598dd5770580fa3517ec83e8da0c9b9e01f4291", + "reference": "7598dd5770580fa3517ec83e8da0c9b9e01f4291", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.4" }, "require-dev": { - "symfony/filesystem": "^6.4|^7.0|^8.0" + "symfony/filesystem": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -4570,7 +4555,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.4.0" + "source": "https://github.com/symfony/finder/tree/v8.0.0" }, "funding": [ { @@ -4590,7 +4575,7 @@ "type": "tidelift" } ], - "time": "2025-11-05T05:42:40+00:00" + "time": "2025-11-05T14:36:47+00:00" }, { "name": "symfony/options-resolver", @@ -4998,22 +4983,102 @@ ], "time": "2024-12-23T08:48:59+00:00" }, + { + "name": "symfony/polyfill-php85", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php85.git", + "reference": "d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91", + "reference": "d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php85\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.5+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php85/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-06-23T16:12:55+00:00" + }, { "name": "symfony/process", - "version": "v7.4.0", + "version": "v8.0.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "7ca8dc2d0dcf4882658313aba8be5d9fd01026c8" + "reference": "a0a750500c4ce900d69ba4e9faf16f82c10ee149" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/7ca8dc2d0dcf4882658313aba8be5d9fd01026c8", - "reference": "7ca8dc2d0dcf4882658313aba8be5d9fd01026c8", + "url": "https://api.github.com/repos/symfony/process/zipball/a0a750500c4ce900d69ba4e9faf16f82c10ee149", + "reference": "a0a750500c4ce900d69ba4e9faf16f82c10ee149", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.4" }, "type": "library", "autoload": { @@ -5041,7 +5106,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.4.0" + "source": "https://github.com/symfony/process/tree/v8.0.0" }, "funding": [ { @@ -5061,7 +5126,7 @@ "type": "tidelift" } ], - "time": "2025-10-16T11:21:06+00:00" + "time": "2025-10-16T16:25:44+00:00" }, { "name": "symfony/service-contracts", @@ -5152,16 +5217,16 @@ }, { "name": "symfony/string", - "version": "v8.0.0", + "version": "v8.0.1", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "f929eccf09531078c243df72398560e32fa4cf4f" + "reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/f929eccf09531078c243df72398560e32fa4cf4f", - "reference": "f929eccf09531078c243df72398560e32fa4cf4f", + "url": "https://api.github.com/repos/symfony/string/zipball/ba65a969ac918ce0cc3edfac6cdde847eba231dc", + "reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc", "shasum": "" }, "require": { @@ -5218,7 +5283,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v8.0.0" + "source": "https://github.com/symfony/string/tree/v8.0.1" }, "funding": [ { @@ -5238,7 +5303,7 @@ "type": "tidelift" } ], - "time": "2025-09-11T14:37:55+00:00" + "time": "2025-12-01T09:13:36+00:00" }, { "name": "symfony/var-exporter", @@ -5536,23 +5601,23 @@ }, { "name": "theseer/tokenizer", - "version": "1.3.1", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "b7489ce515e168639d17feec34b8847c326b0b3c" + "reference": "7989e43bf381af0eac72e4f0ca5bcbfa81658be4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c", - "reference": "b7489ce515e168639d17feec34b8847c326b0b3c", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/7989e43bf381af0eac72e4f0ca5bcbfa81658be4", + "reference": "7989e43bf381af0eac72e4f0ca5bcbfa81658be4", "shasum": "" }, "require": { "ext-dom": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" + "php": "^8.1" }, "type": "library", "autoload": { @@ -5574,7 +5639,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.3.1" + "source": "https://github.com/theseer/tokenizer/tree/2.0.1" }, "funding": [ { @@ -5582,27 +5647,27 @@ "type": "github" } ], - "time": "2025-11-17T20:03:58+00:00" + "time": "2025-12-08T11:19:18+00:00" }, { "name": "webmozart/assert", - "version": "1.12.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "9be6926d8b485f55b9229203f962b51ed377ba68" + "reference": "1b34b004e35a164bc5bb6ebd33c844b2d8069a54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/9be6926d8b485f55b9229203f962b51ed377ba68", - "reference": "9be6926d8b485f55b9229203f962b51ed377ba68", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/1b34b004e35a164bc5bb6ebd33c844b2d8069a54", + "reference": "1b34b004e35a164bc5bb6ebd33c844b2d8069a54", "shasum": "" }, "require": { "ext-ctype": "*", "ext-date": "*", "ext-filter": "*", - "php": "^7.2 || ^8.0" + "php": "^8.2" }, "suggest": { "ext-intl": "", @@ -5612,7 +5677,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.10-dev" + "dev-feature/2-0": "2.0-dev" } }, "autoload": { @@ -5628,6 +5693,10 @@ { "name": "Bernhard Schussek", "email": "bschussek@gmail.com" + }, + { + "name": "Woody Gilk", + "email": "woody.gilk@gmail.com" } ], "description": "Assertions to validate method input/output with nice error messages.", @@ -5638,9 +5707,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.12.1" + "source": "https://github.com/webmozarts/assert/tree/2.0.0" }, - "time": "2025-10-29T15:56:20+00:00" + "time": "2025-12-16T21:36:00+00:00" } ], "aliases": [], @@ -5653,5 +5722,5 @@ "ext-openssl": "*" }, "platform-dev": {}, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.6.0" } From 8a7bcaf350eefc1884f61089ab77a51ff18deca9 Mon Sep 17 00:00:00 2001 From: Sleon4 Date: Sat, 27 Dec 2025 17:03:08 -0500 Subject: [PATCH 2/4] refactor: The AES encryption algorithm is being updated --- src/LionSecurity/AES.php | 216 +++++++++--------- src/LionSecurity/Exceptions/AESException.php | 14 +- .../Interfaces/ConfigInterface.php | 20 +- .../Interfaces/EncryptionInterface.php | 26 ++- src/LionSecurity/JWT.php | 67 ++---- src/LionSecurity/RSA.php | 13 +- .../Providers/AESEncryptionMethodProvider.php | 58 ----- 7 files changed, 155 insertions(+), 259 deletions(-) delete mode 100644 tests/Providers/AESEncryptionMethodProvider.php diff --git a/src/LionSecurity/AES.php b/src/LionSecurity/AES.php index 49616ba..e910e77 100644 --- a/src/LionSecurity/AES.php +++ b/src/LionSecurity/AES.php @@ -5,138 +5,152 @@ namespace Lion\Security; use Exception; +use JsonException; use Lion\Security\Exceptions\AESException; use Lion\Security\Interfaces\ConfigInterface; use Lion\Security\Interfaces\EncryptionInterface; use Lion\Security\Interfaces\ObjectInterface; use OpenSSLAsymmetricKey; +use Random\RandomException; use stdClass; /** * It allows you to generate the configuration required for AES encryption and * decryption, it has methods that allow you to encrypt and decrypt data with - * AES - * - * @package Lion\Security + * AES. */ class AES implements ConfigInterface, EncryptionInterface, ObjectInterface { /** - * [It's a robust encryption method with a 256-bit key size and uses Cipher - * Block Chaining (CBC) mode] + * AES-256-GCM is a highly secure symmetric encryption algorithm that combines + * the Advanced Encryption Standard (AES) with a 256-bit key and Galois/Counter + * (GCM) mode of operation, offering confidentiality (encryption) and + * authenticity (integrity) of data in a single step, making it fast and robust + * for protecting sensitive information in applications such as web security + * (HTTPS), VPNs, and secure messaging, ensuring that data is not only + * unreadable but also tamper-proof. * - * @const AES_256_CBC + * @const AES_256_GCM */ - public const string AES_256_CBC = 'aes-256-cbc'; + public const string AES_256_GCM = 'aes-256-gcm'; /** - * [Property that stores the values of any type of execution being - * performed 'create, encode, decode'] + * It represents the key property in the configuration. * - * @var array|stdClass $values + * @const KEY */ - private array|stdClass $values = []; + public const string KEY = 'key'; /** - * [Property that contains the configuration defined for AES processes] + * It represents the encrypted block. * - * @var array $config + * @const DATA */ - private array $config = []; + public const string DATA = 'data'; /** - * {@inheritDoc} + * It represents the iv in the cipher block. + * + * @const IV */ - public function config(array $config): AES - { - $this->config = $config; + public const string IV = 'iv'; - return $this; - } + /** + * It represents the tag in the cipher block. + * + * @const TAG + */ + public const string TAG = 'tag'; /** - * Returns the current array/object with the generated data + * Property that stores the values of any type of execution being performed + * 'create, encode, decode'. * - * @return array|stdClass + * @var array|stdClass $values + */ + private array|stdClass $values = []; + + /** + * Property that contains the configuration defined for AES processes. * - * @infection-ignore-all + * @var array{ + * key: string|OpenSSLAsymmetricKey|null + * } $config */ - public function get(): array|stdClass - { - $values = $this->values; + private array $config; - $this->clean(); + /** + * {@inheritDoc} + */ + public function config(array $config): AES + { + $this->config = $config; - return $values; + return $this; } /** * {@inheritDoc} * - * @throws AESException + * @throws JsonException If encoding to JSON fails. + * @throws RandomException */ - public function encode(string $key, string $value): AES + public function encode(array $data): AES { - /** @var string $method */ - $method = $this->config['method']; - - /** @var string $passphrase */ - $passphrase = $this->config['passphrase']; - - /** @var string $hex2BinPassphrase */ - $hex2BinPassphrase = hex2bin($passphrase); - - /** @var string $iv */ - $iv = $this->config['iv']; + $iv = random_bytes(12); - /** @var string $hex2BinIv */ - $hex2BinIv = hex2bin($iv); + $tag = ''; - $encrypt = openssl_encrypt($value, $method, $hex2BinPassphrase, OPENSSL_RAW_DATA, $hex2BinIv); + $plaintext = json_encode($data, JSON_THROW_ON_ERROR); - if (!$encrypt) { - /** @var string $message */ - $message = openssl_error_string(); + $ciphertext = openssl_encrypt( + $plaintext, + self::AES_256_GCM, + /** @phpstan-ignore-next-line */ + hex2bin($this->config[self::KEY]), + OPENSSL_RAW_DATA, + $iv, + $tag + ); - throw new AESException($message, 500); + if ($ciphertext === false) { + /** @phpstan-ignore-next-line */ + throw new AESException(openssl_error_string(), 500); } - if (is_array($this->values)) { - $this->values[$key] = base64_encode($encrypt); - } + $this->values = [ + self::DATA => base64_encode($ciphertext), + self::IV => base64_encode($iv), + self::TAG => base64_encode($tag), + ]; return $this; } /** * {@inheritDoc} + * + * @throws JsonException If encoding to JSON fails. */ - public function decode(array $rows): AES + public function decode(array $encrypted): AES { - foreach ($rows as $key => $row) { - /** @var string $method */ - $method = $this->config['method']; - - /** @var string $passphrase */ - $passphrase = $this->config['passphrase']; - - /** @var string $hex2BinPassphrase */ - $hex2BinPassphrase = hex2bin($passphrase); - - /** @var string $iv */ - $iv = $this->config['iv']; - - /** @var string $hex2BinIv */ - $hex2BinIv = hex2bin($iv); - - /** @var string $decrypt */ - $decrypt = openssl_decrypt(base64_decode($row), $method, $hex2BinPassphrase, OPENSSL_RAW_DATA, $hex2BinIv); - - if (is_array($this->values)) { - $this->values[$key] = $decrypt; - } + $plaintext = openssl_decrypt( + base64_decode($encrypted['data']), + self::AES_256_GCM, + /** @phpstan-ignore-next-line */ + hex2bin($this->config['key']), + OPENSSL_RAW_DATA, + base64_decode($encrypted['iv']), + base64_decode($encrypted['tag']) + ); + + if ($plaintext === false) { + throw new AESException('Authentication failed', 500); } + /** @phpstan-ignore-next-line */ + $this->values = json_decode($plaintext, true, 512, JSON_THROW_ON_ERROR); + return $this; } @@ -153,7 +167,7 @@ public function toObject(): AES } /** - * Clear variables so they have their original value + * Clear variables so they have their original value. * * @return void */ @@ -161,58 +175,40 @@ private function clean(): void { $this->values = []; + /** @phpstan-ignore-next-line */ $this->config = []; } /** - * Add formatting to the defined algorithm + * Creates key and iv for aes encryption. * - * @param string $key [AES algorithm type] + * @return AES * - * @return string + * @throws Exception If the algorithm is not supported. */ - private function formatCipherKey(string $key): string + public function create(): AES { - return trim(strtolower($key)); - } + $this->values = [ + 'key' => bin2hex(random_bytes(32)), // 256 bits + 'iv' => bin2hex(random_bytes(12)), // GCM estándar + ]; - /** - * Get length of certain encryption method - * - * @param string $key [AES algorithm type] - * - * @return int - * - * @throws Exception [If the algorithm is not supported] - */ - public function cipherKeyLength(string $key): int - { - return match ($this->formatCipherKey($key)) { - self::AES_256_CBC => 32, - default => throw new Exception("The algorithm is not supported", 500), - }; + return $this; } /** - * Creates key and iv for aes encryption - * - * @param string $key [AES algorithm type] + * Returns the current array/object with the generated data. * - * @return AES + * @return array|stdClass * - * @throws Exception [If the algorithm is not supported] + * @infection-ignore-all */ - public function create(string $key): AES + public function get(): array|stdClass { - $length = $this->cipherKeyLength($key); + $values = $this->values; - $this->values = [ - 'passphrase' => hash('sha256', md5(uniqid())), - 'key' => bin2hex(openssl_random_pseudo_bytes($length)), - 'iv' => bin2hex(openssl_random_pseudo_bytes(16)), - 'method' => $this->formatCipherKey($key), - ]; + $this->clean(); - return $this; + return $values; } } diff --git a/src/LionSecurity/Exceptions/AESException.php b/src/LionSecurity/Exceptions/AESException.php index fedaa26..2f16efc 100644 --- a/src/LionSecurity/Exceptions/AESException.php +++ b/src/LionSecurity/Exceptions/AESException.php @@ -7,19 +7,17 @@ use Exception; /** - * This class represents custom exceptions for AES class processes - * - * @package Lion\Security\Exceptions + * This class represents custom exceptions for AES class processes. */ class AESException extends Exception { /** - * Constructor method of the class + * Constructor method of the class. * - * @param string $message [The Exception message to throw] - * @param int $code [The Exception code] - * @param Exception|null $previous [The previus Throwable used for the - * exception chaining] + * @param string $message The Exception message to throw. + * @param int $code The Exception code. + * @param Exception|null $previous The previus Throwable used for the + * exception chaining. */ public function __construct(string $message, int $code = 500, ?Exception $previous = null) { diff --git a/src/LionSecurity/Interfaces/ConfigInterface.php b/src/LionSecurity/Interfaces/ConfigInterface.php index 7c56aa9..cf8c4c2 100644 --- a/src/LionSecurity/Interfaces/ConfigInterface.php +++ b/src/LionSecurity/Interfaces/ConfigInterface.php @@ -7,9 +7,7 @@ use OpenSSLAsymmetricKey; /** - * Represents the implementation for configuring encryption processes - * - * @package Lion\Security\Interfaces + * Represents the implementation for configuring encryption processes. */ interface ConfigInterface { @@ -18,6 +16,7 @@ interface ConfigInterface * * RSA: * + * * key * * urlPath * * rsaConfig * * rsaPrivateKeyBits @@ -25,13 +24,11 @@ interface ConfigInterface * * AES: * - * * passphrase * * key - * * iv - * * method * * JWT: * + * * key * * jwtServerUrl * * jwtServerUrlAud * * jwtExp @@ -40,21 +37,16 @@ interface ConfigInterface * * publicKey * * @param array{ + * key: string|OpenSSLAsymmetricKey|null, * urlPath?: string, * rsaConfig?: string, * rsaPrivateKeyBits?: int, * rsaDefaultMd?: string, - * passphrase?: string, - * key?: string, - * iv?: string, - * method?: string, * jwtServerUrl?: string, * jwtServerUrlAud?: string, * jwtExp?: int, - * jwtDefaultMD?: string, - * privateKey?: OpenSSLAsymmetricKey|string, - * publicKey?: OpenSSLAsymmetricKey|string - * } $config [Configuration data list] + * jwtDefaultMD?: string + * } $config Configuration data list. * * @return ConfigInterface */ diff --git a/src/LionSecurity/Interfaces/EncryptionInterface.php b/src/LionSecurity/Interfaces/EncryptionInterface.php index 6c61017..3e35588 100644 --- a/src/LionSecurity/Interfaces/EncryptionInterface.php +++ b/src/LionSecurity/Interfaces/EncryptionInterface.php @@ -4,29 +4,35 @@ namespace Lion\Security\Interfaces; +use Lion\Security\Exceptions\AESException; + /** - * Represents the implementation of methods for encryption and decryption - * - * @package Lion\Security\Interfaces + * Represents the implementation of methods for encryption and decryption. */ interface EncryptionInterface { /** - * Encrypt data with defined settings + * Encrypt data with defined settings. * - * @param string $key [Key of the word to be encrypted] - * @param string $value [Value of the word to be encrypted] + * @param array $data Data encrypted in a single + * block. * * @return EncryptionInterface + * + * @throws AESException This class represents custom exceptions for AES class + * processes. */ - public function encode(string $key, string $value): EncryptionInterface; + public function encode(array $data): EncryptionInterface; /** - * Decodes the data with the defined settings + * Decodes the data with the defined settings. * - * @param array $rows [list of decrypted items] + * @param array $encrypted Encrypted data block. * * @return EncryptionInterface + * + * @throws AESException This class represents custom exceptions for AES class + * processes. */ - public function decode(array $rows): EncryptionInterface; + public function decode(array $encrypted): EncryptionInterface; } diff --git a/src/LionSecurity/JWT.php b/src/LionSecurity/JWT.php index cef1133..45e77a5 100644 --- a/src/LionSecurity/JWT.php +++ b/src/LionSecurity/JWT.php @@ -159,7 +159,7 @@ private function execute(Closure $executeFunction): void UnexpectedValueException $e ) { $this->values = (object) [ - 'code' => $e->getCode(), + 'code' => 500, 'status' => 'error', 'message' => $e->getMessage(), ]; @@ -180,8 +180,8 @@ private function execute(Closure $executeFunction): void public function encode(array $data, int $time = 0, int $bytes = 16): JWT { $this->execute(function () use ($data, $time, $bytes): string { - if (empty($this->config['privateKey'])) { - throw new InvalidConfigException('The privateKey has not been defined', 500); + if (empty($this->config['key'])) { + throw new InvalidConfigException('The key has not been defined.', 500); } $now = strtotime('now'); @@ -197,16 +197,16 @@ public function encode(array $data, int $time = 0, int $bytes = 16): JWT ]; if ( - !is_string($this->config['privateKey']) && - !$this->config['privateKey'] instanceof OpenSSLAsymmetricKey + !is_string($this->config['key']) && + !$this->config['key'] instanceof OpenSSLAsymmetricKey ) { throw new InvalidConfigException( - 'The privateKey must be a string or an OpenSSLAsymmetricKey instance.', + 'The key must be a string or an OpenSSLAsymmetricKey instance.', 500 ); } - return FBJWT::encode($config, $this->config['privateKey'], $this->jwtDefaultMD); + return FBJWT::encode($config, $this->config['key'], $this->jwtDefaultMD); }); return $this; @@ -224,69 +224,32 @@ public function encode(array $data, int $time = 0, int $bytes = 16): JWT public function decode(?string $jwt): JWT { $this->execute(function () use ($jwt): stdClass { - if (empty($this->config['publicKey'])) { - throw new InvalidConfigException('The publicKey has not been defined', 500); + if (empty($this->config['key'])) { + throw new InvalidConfigException('The key has not been defined.', 500); } if (in_array($jwt, ['null', null, ''], true)) { - throw new InvalidConfigException('The JWT does not exist', 500); + throw new InvalidConfigException('The JWT does not exist.', 500); } if ( - !is_string($this->config['publicKey']) && - !$this->config['publicKey'] instanceof OpenSSLAsymmetricKey + !is_string($this->config['key']) && + !$this->config['key'] instanceof OpenSSLAsymmetricKey ) { throw new InvalidConfigException( - 'The publicKey must be a string or an OpenSSLAsymmetricKey instance.', + 'The key must be a string or an OpenSSLAsymmetricKey instance.', 500 ); } - return FBJWT::decode($jwt, new Key($this->config['publicKey'], $this->jwtDefaultMD)); + return FBJWT::decode($jwt, new Key($this->config['key'], $this->jwtDefaultMD)); }); return $this; } /** - * Defines the type of encryption - * - * @param RSA $rsa [Allows you to generate the required configuration for - * public and private keys, has methods that allow you to encrypt and - * decrypt data with RSA] - * - * @return JWT - * - * @throws InvalidConfigException [If the public/private key has not been - * initialized] - * - * @infection-ignore-all - */ - public function setEncryptionMethod(RSA $rsa): JWT - { - $rsa->init(); - - $publicKey = $rsa->getPublicKey(); - - if (empty($publicKey)) { - throw new InvalidConfigException('The public key has not been defined', 500); - } - - $privateKey = $rsa->getPrivateKey(); - - if (empty($privateKey)) { - throw new InvalidConfigException('The private key has not been defined', 500); - } - - $this->config['publicKey'] = $publicKey; - - $this->config['privateKey'] = $privateKey; - - return $this; - } - - /** - * Gets the HTTP_AUTHORIZATION header token + * Gets the HTTP_AUTHORIZATION header token. * * @return string|bool */ diff --git a/src/LionSecurity/RSA.php b/src/LionSecurity/RSA.php index 86536b1..64d8223 100644 --- a/src/LionSecurity/RSA.php +++ b/src/LionSecurity/RSA.php @@ -6,7 +6,6 @@ use Lion\Security\Exceptions\InvalidConfigException; use Lion\Security\Interfaces\ConfigInterface; -use Lion\Security\Interfaces\EncryptionInterface; use Lion\Security\Interfaces\ObjectInterface; use OpenSSLAsymmetricKey; use RuntimeException; @@ -18,7 +17,7 @@ * * @package Lion\Security */ -class RSA implements ConfigInterface, EncryptionInterface, ObjectInterface +class RSA implements ConfigInterface, ObjectInterface { /** * [Represents the public key object] @@ -97,7 +96,7 @@ public function config(array $config): RSA } /** - * Returns the current array/object with the generated data + * Returns the current array/object with the generated data. * * @return array|stdClass * @@ -113,10 +112,10 @@ public function get(): array|stdClass } /** - * {@inheritDoc} + * Encrypt data with defined settings. * - * @throws InvalidConfigException [If the public key is null] - * @throws RuntimeException [If the encrypted data is incorrect] + * @throws InvalidConfigException If the public key is null. + * @throws RuntimeException If the encrypted data is incorrect. * * @infection-ignore-all */ @@ -125,7 +124,7 @@ public function encode(string $key, string $value): RSA $this->init(); if (null === $this->publicKey) { - throw new InvalidConfigException('Public key cannot be null', 500); + throw new InvalidConfigException('Public key cannot be null.', 500); } if ($this->publicKey instanceof OpenSSLAsymmetricKey) { diff --git a/tests/Providers/AESEncryptionMethodProvider.php b/tests/Providers/AESEncryptionMethodProvider.php deleted file mode 100644 index e0f68e7..0000000 --- a/tests/Providers/AESEncryptionMethodProvider.php +++ /dev/null @@ -1,58 +0,0 @@ -> - */ - public static function AESEncryptionMethodProvider(): array - { - return [ - [ - 'method' => AES::AES_256_CBC, - 'bits' => 32, - 'returnKey' => AES::AES_256_CBC, - ], - [ - 'method' => strtoupper(AES::AES_256_CBC), - 'bits' => 32, - 'returnKey' => AES::AES_256_CBC, - ], - [ - 'method' => (' ' . strtoupper(AES::AES_256_CBC) . ' '), - 'bits' => 32, - 'returnKey' => AES::AES_256_CBC, - ], - ]; - } - - /** - * @return array - */ - public static function formatCipherKeyProvider(): array - { - return [ - [ - 'method' => AES::AES_256_CBC, - 'returnKey' => AES::AES_256_CBC, - ], - [ - 'method' => strtoupper(AES::AES_256_CBC), - 'returnKey' => AES::AES_256_CBC, - ], - [ - 'method' => (' ' . strtoupper(AES::AES_256_CBC) . ' '), - 'returnKey' => AES::AES_256_CBC, - ], - ]; - } -} From c20513b0fdd8a185843b5eb61a7318074d8ee585 Mon Sep 17 00:00:00 2001 From: Sleon4 Date: Sat, 27 Dec 2025 17:34:38 -0500 Subject: [PATCH 3/4] test: Test coverage is added --- tests/AESTest.php | 200 ++++++++++++++++++---------------------------- tests/JWTTest.php | 139 ++++++++++++-------------------- 2 files changed, 129 insertions(+), 210 deletions(-) diff --git a/tests/AESTest.php b/tests/AESTest.php index 5b6892b..9554424 100644 --- a/tests/AESTest.php +++ b/tests/AESTest.php @@ -11,21 +11,14 @@ use Lion\Security\Interfaces\EncryptionInterface; use Lion\Security\Interfaces\ObjectInterface; use Lion\Test\Test; -use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test as Testing; use ReflectionException; use stdClass; -use Tests\Providers\AESEncryptionMethodProvider; class AESTest extends Test { - use AESEncryptionMethodProvider; - private AES $aes; - /** - * @throws ReflectionException - */ protected function setUp(): void { $this->aes = new AES(); @@ -34,21 +27,16 @@ protected function setUp(): void } /** - * @throws ReflectionException - * @throws Exception + * @throws Exception If the algorithm is not supported. + * @throws ReflectionException If the property does not exist in the reflected + * class. */ #[Testing] - #[DataProvider('AESEncryptionMethodProvider')] - public function config(string $method, int $bits, string $returnKey): void + public function config(): void { - /** @var array{ - * passphrase?: string, - * key?: string, - * iv?: string, - * method?: string - * } $config */ + /** @var array{ key: string, iv: string } $config */ $config = $this->aes - ->create($method) + ->create() ->get(); $this->assertInstances($this->aes->config($config), [ @@ -62,52 +50,56 @@ public function config(string $method, int $bits, string $returnKey): void } /** - * @throws AESException - * @throws Exception + * @throws AESException This class represents custom exceptions for AES class + * processes. + * @throws Exception If the algorithm is not supported. */ #[Testing] public function get(): void { - /** @var array{ - * passphrase?: string, - * key?: string, - * iv?: string, - * method?: string - * } $config */ + /** @var array{ key: string, iv: string } $config */ $config = $this->aes - ->create(AES::AES_256_CBC) + ->create() ->get(); $encode = $this->aes - ->config($config) - ->encode('user_name', 'Sleon') + ->config([ + 'key' => $config['key'], + ]) + ->encode([ + 'user_name' => 'Sleon4', + ]) ->get(); $this->assertIsArray($encode); - $this->assertArrayHasKey('user_name', $encode); + $this->assertArrayHasKey('data', $encode); + $this->assertArrayHasKey('iv', $encode); + $this->assertArrayHasKey('tag', $encode); + $this->assertNotEmpty($encode['data']); + $this->assertNotEmpty($encode['iv']); + $this->assertNotEmpty($encode['tag']); } /** - * @throws AESException - * @throws Exception + * @throws AESException This class represents custom exceptions for AES class + * processes. + * @throws Exception If the algorithm is not supported. */ #[Testing] - #[DataProvider('AESEncryptionMethodProvider')] - public function encode(string $method, int $bits, string $returnKey): void + public function encode(): void { - /** @var array{ - * passphrase?: string, - * key?: string, - * iv?: string, - * method?: string - * } $config */ + /** @var array{ key: string, iv: string } $config */ $config = $this->aes - ->create($method) + ->create() ->get(); $encode = $this->aes - ->config($config) - ->encode('user_name', 'Sleon'); + ->config([ + 'key' => $config['key'], + ]) + ->encode([ + 'user_name' => 'Sleon4', + ]); $this->assertInstances($encode, [ AES::class, @@ -119,7 +111,12 @@ public function encode(string $method, int $bits, string $returnKey): void $encode = $this->aes->get(); $this->assertIsArray($encode); - $this->assertArrayHasKey('user_name', $encode); + $this->assertArrayHasKey('data', $encode); + $this->assertArrayHasKey('iv', $encode); + $this->assertArrayHasKey('tag', $encode); + $this->assertNotEmpty($encode['data']); + $this->assertNotEmpty($encode['iv']); + $this->assertNotEmpty($encode['tag']); } /** @@ -129,42 +126,39 @@ public function encode(string $method, int $bits, string $returnKey): void #[Testing] public function decode(): void { - /** @var array{ - * passphrase?: string, - * key?: string, - * iv?: string, - * method?: string - * } $config */ + /** @var array{ key: string, iv: string } $config */ $config = $this->aes - ->create(AES::AES_256_CBC) + ->create() ->get(); - $key1 = 'key1'; - - $value1 = 'encoded_value_1'; - - $key2 = 'key2'; - - $value2 = 'encoded_value_2'; - $encode = $this->aes - ->config($config) - ->encode($key1, $value1) - ->encode($key2, $value2) + ->config([ + 'key' => $config['key'], + ]) + ->encode([ + 'user_name' => 'Sleon4', + ]) ->get(); $this->assertIsArray($encode); + $this->assertArrayHasKey('data', $encode); + $this->assertArrayHasKey('iv', $encode); + $this->assertArrayHasKey('tag', $encode); + $this->assertNotEmpty($encode['data']); + $this->assertNotEmpty($encode['iv']); + $this->assertNotEmpty($encode['tag']); $decode = $this->aes - ->config($config) + ->config([ + 'key' => $config['key'], + ]) ->decode($encode) ->get(); $this->assertIsArray($decode); - $this->assertArrayHasKey($key1, $decode); - $this->assertArrayHasKey($key2, $decode); - $this->assertSame($value1, $decode[$key1]); - $this->assertSame($value2, $decode[$key2]); + $this->assertNotEmpty($decode); + $this->assertArrayHasKey('user_name', $decode); + $this->assertSame('Sleon4', $decode['user_name']); } /** @@ -174,25 +168,29 @@ public function decode(): void #[Testing] public function toObject(): void { - /** @var array{ - * passphrase?: string, - * key?: string, - * iv?: string, - * method?: string - * } $config */ + /** @var array{ key: string, iv: string } $config */ $config = $this->aes - ->create(AES::AES_256_CBC) + ->create() ->get(); $encode = $this->aes - ->config($config) - ->encode('user_name', 'Sleon') + ->config([ + 'key' => $config['key'], + ]) + ->encode([ + 'user_name' => 'Sleon4', + ]) ->toObject() ->get(); $this->assertIsObject($encode); $this->assertInstanceOf(stdClass::class, $encode); - $this->assertObjectHasProperty('user_name', $encode); + $this->assertObjectHasProperty('data', $encode); + $this->assertObjectHasProperty('iv', $encode); + $this->assertObjectHasProperty('tag', $encode); + $this->assertNotEmpty($encode->{'data'}); + $this->assertNotEmpty($encode->{'iv'}); + $this->assertNotEmpty($encode->{'tag'}); } /** @@ -207,61 +205,19 @@ public function clean(): void $this->assertSame([], $this->getPrivateProperty('config')); } - /** - * @throws ReflectionException - */ - #[Testing] - #[DataProvider('formatCipherKeyProvider')] - public function formatCipherKey(string $method, string $returnKey): void - { - $format = $this->getPrivateMethod('formatCipherKey', [ - 'key' => $method, - ]); - - $this->assertSame($returnKey, $format); - } - - /** - * @throws Exception - */ - #[Testing] - #[DataProvider('AESEncryptionMethodProvider')] - public function cipherKeyLength(string $method, int $bits, string $returnKey): void - { - $lenght = $this->aes->cipherKeyLength($method); - - $this->assertSame($bits, $lenght); - } - - /** - * @throws Exception - */ - #[Testing] - public function cipherKeyLengthNotExist(): void - { - $this->expectException(Exception::class); - $this->expectExceptionCode(500); - $this->expectExceptionMessage("The algorithm is not supported"); - - $this->aes->cipherKeyLength(uniqid()); - } - /** * @throws Exception */ #[Testing] - #[DataProvider('AESEncryptionMethodProvider')] - public function testCreate(string $method, int $bits, string $returnKey): void + public function create(): void { $config = $this->aes - ->create($method) + ->create() ->get(); $this->assertIsArray($config); - $this->assertArrayHasKey('passphrase', $config); + $this->assertNotEmpty($config); $this->assertArrayHasKey('key', $config); $this->assertArrayHasKey('iv', $config); - $this->assertArrayHasKey('method', $config); - $this->assertSame($returnKey, $config['method']); } } diff --git a/tests/JWTTest.php b/tests/JWTTest.php index d214f17..7c7cad7 100644 --- a/tests/JWTTest.php +++ b/tests/JWTTest.php @@ -23,6 +23,7 @@ class JWTTest extends Test { use JWTProvider; + private const string KEY = '6f8d1f2d41b5c899ca04d8fc1bdbd1311fe668942e75943bb9701030c6e43f99'; private const string JWT_SERVER_URL = 'http://localhost:8000'; private const string JWT_SERVER_URL_AUD = 'http://localhost:5173'; private const int JWT_EXP = 3600; @@ -48,17 +49,13 @@ class JWTTest extends Test 'urlPath' => self::URL_PATH, 'rsaConfig' => self::RSA_CONFIG, 'rsaPrivateKeyBits' => self::RSA_PRIVATE_KEY_BITS, - 'rsaDefaultMd' => self::RSA_DEFAULT_MD + 'rsaDefaultMd' => self::RSA_DEFAULT_MD, ]; - private const string KEY = '0123456789sleon4'; private JWT $jwt; private RSA $rsa; private AES $aes; - /** - * @throws ReflectionException - */ protected function setUp(): void { $this->rsa = new RSA(); @@ -173,27 +170,27 @@ public function encodeWithRSA(): void ->config(self::CONFIG_RSA) ->create(); - /** @var OpenSSLAsymmetricKey $privateKey */ - $privateKey = $this->rsa->getPrivateKey(); + /** @var OpenSSLAsymmetricKey $key */ + $key = $this->rsa->getPrivateKey(); $encode = $this->jwt ->config([ - 'privateKey' => $privateKey, + 'key' => $key, ]) ->encode([ - 'key' => 'value', + 'index-key' => 'value', ]) ->get(); $this->assertIsString($encode); - /** @var OpenSSLAsymmetricKey $publicKey */ - $publicKey = $this->rsa + /** @var OpenSSLAsymmetricKey $key */ + $key = $this->rsa ->getPublicKey(); $decode = $this->jwt ->config([ - 'publicKey' => $publicKey, + 'key' => $key, ]) ->decode($encode) ->get(); @@ -214,11 +211,11 @@ public function encodeWithAES(): void { $encode = $this->jwt ->config([ - 'privateKey' => self::KEY, + 'key' => self::KEY, ...self::CONFIG_JWT_AES ]) ->encode([ - 'key' => 'value', + 'index-key' => 'value', ]) ->get(); @@ -226,7 +223,7 @@ public function encodeWithAES(): void $decode = $this->jwt ->config([ - 'publicKey' => self::KEY, + 'key' => self::KEY, ...self::CONFIG_JWT_AES ]) ->decode($encode) @@ -244,12 +241,12 @@ public function encodeWithAES(): void } #[Testing] - public function encodeWithMissingPrivateKey(): void + public function encodeWithMissingkey(): void { $encode = $this->jwt ->config([]) ->encode([ - 'key' => 'value', + 'index-key' => 'value', ]) ->get(); @@ -259,7 +256,7 @@ public function encodeWithMissingPrivateKey(): void $this->assertObjectHasProperty('message', $encode); $this->assertSame(500, $encode->code); $this->assertSame('error', $encode->status); - $this->assertSame('The privateKey has not been defined', $encode->message); + $this->assertSame('The key has not been defined.', $encode->message); } /** @@ -272,25 +269,23 @@ public function decodeWithRSAValidJWT(): void ->config(self::CONFIG_RSA) ->create(); - /** @var OpenSSLAsymmetricKey $privateKey */ - $privateKey = $this->rsa->getPrivateKey(); - $jwt = $this->jwt ->config([ - 'privateKey' => $privateKey, - ])->encode([ - 'key' => 'value', + ...self::CONFIG_JWT_RSA, + 'key' => $this->rsa->getPrivateKey(), + ]) + ->encode([ + 'index-key' => 'value', ], 3600) ->get(); $this->assertIsString($jwt); - - /** @var OpenSSLAsymmetricKey $publicKey */ - $publicKey = $this->rsa->getPublicKey(); + $this->assertNotEmpty($jwt); $decode = $this->jwt ->config([ - 'publicKey' => $publicKey, + ...self::CONFIG_JWT_RSA, + 'key' => $this->rsa->getPublicKey(), ]) ->decode($jwt) ->get(); @@ -300,8 +295,8 @@ public function decodeWithRSAValidJWT(): void $this->assertObjectHasProperty('data', $decode); $this->assertIsObject($decode->data); $this->assertInstanceOf(stdClass::class, $decode->data); - $this->assertObjectHasProperty('key', $decode->data); - $this->assertSame('value', $decode->data->key); + $this->assertObjectHasProperty('index-key', $decode->data); + $this->assertSame('value', $decode->data->{'index-key'}); } /** @@ -310,22 +305,18 @@ public function decodeWithRSAValidJWT(): void #[Testing] public function decodeWithAESValidJWT(): void { - /** @var stdClass $config */ + /** @var array{ key: string, iv: string } $config */ $config = $this->aes - ->create(AES::AES_256_CBC) - ->toObject() + ->create() ->get(); - /** @var string $key */ - $key = $config->key; - $jwt = $this->jwt ->config([ 'jwtDefaultMD' => self::JWT_DEFAULT_MD_AES, - 'privateKey' => $key, + 'key' => $config['key'], ]) ->encode([ - 'key' => 'value', + 'index-key' => 'value', ], 3600) ->get(); @@ -334,7 +325,7 @@ public function decodeWithAESValidJWT(): void $decode = $this->jwt ->config([ 'jwtDefaultMD' => self::JWT_DEFAULT_MD_AES, - 'publicKey' => $key, + 'key' => $config['key'], ]) ->decode($jwt) ->get(); @@ -344,15 +335,15 @@ public function decodeWithAESValidJWT(): void $this->assertObjectHasProperty('data', $decode); $this->assertIsObject($decode->data); $this->assertInstanceOf(stdClass::class, $decode->data); - $this->assertObjectHasProperty('key', $decode->data); - $this->assertSame('value', $decode->data->key); + $this->assertObjectHasProperty('index-key', $decode->data); + $this->assertSame('value', $decode->data->{'index-key'}); } #[Testing] - public function decodeWithMissingPublicKey(): void + public function decodeWithMissingKey(): void { $decode = $this->jwt - ->config([]) + ->config(self::CONFIG_JWT_AES) ->decode(null) ->get(); @@ -362,7 +353,7 @@ public function decodeWithMissingPublicKey(): void $this->assertObjectHasProperty('message', $decode); $this->assertSame(500, $decode->code); $this->assertSame('error', $decode->status); - $this->assertSame('The publicKey has not been defined', $decode->message); + $this->assertSame('The key has not been defined.', $decode->message); } /** @@ -370,17 +361,14 @@ public function decodeWithMissingPublicKey(): void */ #[Testing] #[DataProvider('nullJwtDataProvider')] - public function decodeWithNullJwt(?string $value): void + public function decodeWithJwtIsNull(?string $value): void { - /** @var OpenSSLAsymmetricKey $publicKey */ - $publicKey = $this->rsa - ->config(self::CONFIG_RSA) - ->create() - ->getPublicKey(); - $decode = $this->jwt ->config([ - 'publicKey' => $publicKey, + 'key' => $this->rsa + ->config(self::CONFIG_RSA) + ->create() + ->getPrivateKey(), ]) ->decode($value) ->get(); @@ -392,7 +380,7 @@ public function decodeWithNullJwt(?string $value): void $this->assertObjectHasProperty('message', $decode); $this->assertSame(500, $decode->code); $this->assertSame('error', $decode->status); - $this->assertSame('The JWT does not exist', $decode->message); + $this->assertSame('The JWT does not exist.', $decode->message); } /** @@ -450,15 +438,12 @@ public function getJWTWithValidAuthorizationHeader(): void ->config(self::CONFIG_RSA) ->create(); - /** @var OpenSSLAsymmetricKey $privateKey */ - $privateKey = $this->rsa->getPrivateKey(); - $jwt = $this->jwt ->config([ - 'privateKey' => $privateKey, + 'key' => $this->rsa->getPrivateKey(), ]) ->encode([ - 'key' => 'value', + 'index-key' => 'value', ]) ->get(); @@ -477,12 +462,9 @@ public function getJWTWithValidAuthorizationHeader(): void $this->assertSame($jwt, $getJwt); - /** @var OpenSSLAsymmetricKey $publicKey */ - $publicKey = $this->rsa->getPublicKey(); - $decode = $this->jwt ->config([ - 'publicKey' => $publicKey, + 'key' => $this->rsa->getPublicKey(), ]) ->decode($getJwt) ->get(); @@ -492,28 +474,8 @@ public function getJWTWithValidAuthorizationHeader(): void $this->assertObjectHasProperty('data', $decode); $this->assertIsObject($decode->data); $this->assertInstanceOf(stdClass::class, $decode->data); - $this->assertObjectHasProperty('key', $decode->data); - $this->assertSame('value', $decode->data->key); - } - - /** - * @throws InvalidConfigException - */ - #[Testing] - public function setEncryptionMethod(): void - { - $this->rsa - ->config(self::CONFIG_RSA) - ->create(); - - $encode = $this->jwt - ->setEncryptionMethod($this->rsa) - ->encode([ - 'key' => 'value', - ]) - ->get(); - - $this->assertIsString($encode); + $this->assertObjectHasProperty('index-key', $decode->data); + $this->assertSame('value', $decode->data->{'index-key'}); } /** @@ -522,21 +484,22 @@ public function setEncryptionMethod(): void #[Testing] public function get(): void { - /** @var OpenSSLAsymmetricKey $privateKey */ - $privateKey = $this->rsa + /** @var OpenSSLAsymmetricKey $key */ + $key = $this->rsa ->config(self::CONFIG_RSA) ->create() ->getPrivateKey(); $jwt = $this->jwt ->config([ - 'privateKey' => $privateKey, + 'key' => $key, ]) ->encode([ - 'key' => 'value', + 'index-key' => 'value', ]) ->get(); $this->assertIsString($jwt); + $this->assertNotEmpty($jwt); } } From 1b9053efa61fd49b0f4f44e63e0d3e035390ac4e Mon Sep 17 00:00:00 2001 From: Sleon4 Date: Sat, 27 Dec 2025 17:41:08 -0500 Subject: [PATCH 4/4] chore: Standardization is added --- .github/workflows/php.yml | 3 --- src/LionSecurity/AES.php | 2 +- src/LionSecurity/Interfaces/ConfigInterface.php | 2 +- src/LionSecurity/JWT.php | 2 +- src/LionSecurity/RSA.php | 9 +++++++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 157f62e..53d30f1 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -132,9 +132,6 @@ jobs: - name: PHPStan (Src) run: php -d memory_limit=-1 vendor/bin/phpstan analyse --level 10 src - - name: PHPStan (Test) - run: php -d memory_limit=-1 vendor/bin/phpstan analyse --level 10 tests - tests-phpunit: runs-on: ubuntu-latest name: PHPUnit diff --git a/src/LionSecurity/AES.php b/src/LionSecurity/AES.php index e910e77..ce83140 100644 --- a/src/LionSecurity/AES.php +++ b/src/LionSecurity/AES.php @@ -74,7 +74,7 @@ class AES implements ConfigInterface, EncryptionInterface, ObjectInterface * Property that contains the configuration defined for AES processes. * * @var array{ - * key: string|OpenSSLAsymmetricKey|null + * key: int|null|string|OpenSSLAsymmetricKey * } $config */ private array $config; diff --git a/src/LionSecurity/Interfaces/ConfigInterface.php b/src/LionSecurity/Interfaces/ConfigInterface.php index cf8c4c2..946db27 100644 --- a/src/LionSecurity/Interfaces/ConfigInterface.php +++ b/src/LionSecurity/Interfaces/ConfigInterface.php @@ -37,7 +37,7 @@ interface ConfigInterface * * publicKey * * @param array{ - * key: string|OpenSSLAsymmetricKey|null, + * key: int|null|string|OpenSSLAsymmetricKey, * urlPath?: string, * rsaConfig?: string, * rsaPrivateKeyBits?: int, diff --git a/src/LionSecurity/JWT.php b/src/LionSecurity/JWT.php index 45e77a5..2abb340 100644 --- a/src/LionSecurity/JWT.php +++ b/src/LionSecurity/JWT.php @@ -37,7 +37,7 @@ class JWT implements ConfigInterface /** * [Property that contains the configuration defined for JWT processes] * - * @var array $config + * @var array $config */ private array $config = []; diff --git a/src/LionSecurity/RSA.php b/src/LionSecurity/RSA.php index 64d8223..f9568ce 100644 --- a/src/LionSecurity/RSA.php +++ b/src/LionSecurity/RSA.php @@ -114,6 +114,9 @@ public function get(): array|stdClass /** * Encrypt data with defined settings. * + * @param string $key Key name. + * @param string $value Key value. + * * @throws InvalidConfigException If the public key is null. * @throws RuntimeException If the encrypted data is incorrect. * @@ -143,9 +146,11 @@ public function encode(string $key, string $value): RSA } /** - * {@inheritDoc} + * Decodes the data with the defined settings. + * + * @param array $rows Encrypted data block. * - * @throws InvalidConfigException [If the private key is null] + * @throws InvalidConfigException If the private key is null. * * @infection-ignore-all */