diff --git a/src/Kore.php b/src/Kore.php index 6a8766d..7610ad5 100644 --- a/src/Kore.php +++ b/src/Kore.php @@ -2,21 +2,17 @@ namespace Kontrl\PhpKore; -use phpseclib3\Common\Functions\Strings; -use phpseclib3\Crypt\EC; -use phpseclib3\Crypt\EC\PublicKey; use phpseclib3\Crypt\PublicKeyLoader; -use phpseclib3\Crypt\RSA; class Kore { private $url = 'https://httpbin.org'; - public function __construct() {} + public function __construct(public $privateKey) {} - public function signBody(string|array $body, string|array $key, string|bool $password = false) + public function signBody(string|array $body, string|bool $password = false) { - $privateKey = PublicKeyLoader::loadPrivateKey(base64_decode($key), $password); + $privateKey = PublicKeyLoader::loadPrivateKey(base64_decode($this->privateKey), $password); $sig = $privateKey->sign(json_encode($body)); return base64_encode($sig); } diff --git a/src/Pix.php b/src/Pix.php new file mode 100644 index 0000000..e9c49f0 --- /dev/null +++ b/src/Pix.php @@ -0,0 +1,24 @@ + $amount, + 'pix_key' => $pix_key + ]; + return curlRequest( + 'https://httpbin.org/post', + 'POST', + [], + [ + 'x-kore-drone-uid: drone:f8f19d43660d7bbdd2c63d428de6d7b1ff33554311adbe35c784b0584aa007fd', + 'x-kore-drone-sign: ' . $this->signBody($payload) + ], + $payload + ); + } +}