@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @throws \chillerlan\Traits\Crypto\CryptoException |
| 55 | 55 | */ |
| 56 | - public function __construct(array $properties = null){ |
|
| 56 | + public function __construct(array $properties = null) { |
|
| 57 | 57 | |
| 58 | - if(!extension_loaded('sodium') || !function_exists('sodium_memzero')){ |
|
| 58 | + if (!extension_loaded('sodium') || !function_exists('sodium_memzero')) { |
|
| 59 | 59 | throw new CryptoException('sodium extension (PHP 7.2+) required!'); // @codeCoverageIgnore |
| 60 | 60 | } |
| 61 | 61 | |
@@ -69,16 +69,16 @@ discard block |
||
| 69 | 69 | * @return void |
| 70 | 70 | * @throws \chillerlan\Traits\Crypto\CryptoException |
| 71 | 71 | */ |
| 72 | - protected function checkKeypair(int $secretLength = null, int $PublicLength = null){ |
|
| 72 | + protected function checkKeypair(int $secretLength = null, int $PublicLength = null) { |
|
| 73 | 73 | |
| 74 | - if($secretLength !== null){ |
|
| 75 | - if(!$this->keypair->secret || strlen($this->keypair->secret) !== $secretLength){ |
|
| 74 | + if ($secretLength !== null) { |
|
| 75 | + if (!$this->keypair->secret || strlen($this->keypair->secret) !== $secretLength) { |
|
| 76 | 76 | throw new CryptoException('invalid secret key'); |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if($PublicLength !== null){ |
|
| 81 | - if(!$this->keypair->public || strlen($this->keypair->public) !== $PublicLength){ |
|
| 80 | + if ($PublicLength !== null) { |
|
| 81 | + if (!$this->keypair->public || strlen($this->keypair->public) !== $PublicLength) { |
|
| 82 | 82 | throw new CryptoException('invalid public key'); |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | protected function checkMessage(string $message):string { |
| 89 | 89 | $message = trim($message); |
| 90 | 90 | |
| 91 | - if(strlen($message) < 1){ |
|
| 91 | + if (strlen($message) < 1) { |
|
| 92 | 92 | throw new CryptoException('invalid message'); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | * @property string $secret |
| 18 | 18 | * @property string $public |
| 19 | 19 | */ |
| 20 | -interface CryptoKeyInterface{ |
|
| 20 | +interface CryptoKeyInterface { |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @param string|null $seed_bin |