From 480cc208d7bdca2ce6db2747dffd5bbd9374b16e Mon Sep 17 00:00:00 2001 From: Eduardo Bacarin Date: Fri, 4 Jul 2025 11:44:27 -0300 Subject: [PATCH] Rework to be compatible with PHP 7.* --- src/Kore.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Kore.php b/src/Kore.php index 2c15dcb..8549a08 100644 --- a/src/Kore.php +++ b/src/Kore.php @@ -7,17 +7,21 @@ use phpseclib3\Crypt\PublicKeyLoader; class Kore { private $url = 'https://httpbin.org'; + public $privateKey; + public $drone; + public function __construct($privateKey, $drone) { + $this->privateKey = $privateKey; + $this->drone = $drone; + } - public function __construct(public $privateKey, public $drone) {} - - public function signBody(string|array $body, string|bool $password = false) + public function signBody($body, $password = false) { $privateKey = PublicKeyLoader::loadPrivateKey(base64_decode($this->privateKey), $password); $sig = $privateKey->sign(json_encode($body)); return base64_encode($sig); } - public function verifySignature(string $signature, string|array $message, $key) + public function verifySignature($signature, $message, $key) { $publicKey = PublicKeyLoader::loadPublicKey($key); return $publicKey->verify(json_encode($message), $signature);