@@ -142,6 +142,11 @@ discard block |
||
| 142 | 142 | return $this->makeBox($message, $nonce, $senderPrivateKey, $recipientPublicKey); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | + /** |
|
| 146 | + * @param string $senderPrivateKey |
|
| 147 | + * @param string $recipientPublicKey |
|
| 148 | + * @param string $nonce |
|
| 149 | + */ |
|
| 145 | 150 | final public function encryptFileMessage(UploadFileResult $uploadFileResult, |
| 146 | 151 | EncryptResult $encryptResult, |
| 147 | 152 | UploadFileResult $thumbnailUploadFileResult = null, |
@@ -190,9 +195,9 @@ discard block |
||
| 190 | 195 | * make a secret box |
| 191 | 196 | * |
| 192 | 197 | * @param $data |
| 193 | - * @param $nonce |
|
| 198 | + * @param string $nonce |
|
| 194 | 199 | * @param $key |
| 195 | - * @return mixed |
|
| 200 | + * @return string |
|
| 196 | 201 | */ |
| 197 | 202 | abstract protected function makeSecretBox($data, $nonce, $key); |
| 198 | 203 | |
@@ -334,6 +339,9 @@ discard block |
||
| 334 | 339 | return hash_hmac('sha256', $phoneNoClean, self::PHONENO_HMAC_KEY); |
| 335 | 340 | } |
| 336 | 341 | |
| 342 | + /** |
|
| 343 | + * @return string |
|
| 344 | + */ |
|
| 337 | 345 | abstract protected function createRandom($size); |
| 338 | 346 | |
| 339 | 347 | /** |
@@ -376,7 +384,7 @@ discard block |
||
| 376 | 384 | abstract public function validate(); |
| 377 | 385 | |
| 378 | 386 | /** |
| 379 | - * @param $data |
|
| 387 | + * @param string $data |
|
| 380 | 388 | * @return EncryptResult |
| 381 | 389 | */ |
| 382 | 390 | public final function encryptFile($data) { |
@@ -405,6 +413,10 @@ discard block |
||
| 405 | 413 | return new EncryptResult($box, $key, self::FILE_THUMBNAIL_NONCE, strlen($box)); |
| 406 | 414 | } |
| 407 | 415 | |
| 416 | + /** |
|
| 417 | + * @param string $data |
|
| 418 | + * @param string $key |
|
| 419 | + */ |
|
| 408 | 420 | public final function decryptFileThumbnail($data, $key) { |
| 409 | 421 | $result = $this->openSecretBox($data, self::FILE_THUMBNAIL_NONCE, $key); |
| 410 | 422 | return false === $result ? null : $result; |