diff --git a/src/RSAParameters.php b/src/RSAParameters.php index 489144e..3c6e436 100644 --- a/src/RSAParameters.php +++ b/src/RSAParameters.php @@ -18,7 +18,12 @@ public function __construct() { } - public function generateKeys(?string $passphrase = null, ?array $configArgs = null) : void + /** + * @param string|null $passphrase + * @param array|null $configArgs + * @return $this + */ + public function generateKeys(?string $passphrase = null, ?array $configArgs = null) : RSAParameters { $keys = openssl_pkey_new($this->config); @@ -31,6 +36,8 @@ public function generateKeys(?string $passphrase = null, ?array $configArgs = nu $pub = openssl_pkey_get_details($keys); $this->publicKey = $pub['key']; + + return $this; } /** @@ -79,10 +86,13 @@ public function getPassphrase(): string /** * @param string $passphrase + * @return $this */ - public function setPassphrase(string $passphrase): void + public function setPassphrase(string $passphrase): RSAParameters { $this->passphrase = $passphrase; + + return $this; } /** diff --git a/tests/RSAParametersTest.php b/tests/RSAParametersTest.php index 4bc014c..8fa6e2e 100644 --- a/tests/RSAParametersTest.php +++ b/tests/RSAParametersTest.php @@ -11,8 +11,8 @@ class RSAParametersTest extends TestCase /** @test */ public function canGenerateKeys() :void { $parameters = new RSAParameters(); - $parameters->generateKeys(); + $keys = $parameters->generateKeys(); - $this->assertInstanceOf(RSAParameters::class, $parameters); + $this->assertInstanceOf(RSAParameters::class, $keys); } } \ No newline at end of file