@@ -145,6 +145,11 @@ discard block |
||
| 145 | 145 | return $this->makeBox($message, $nonce, $senderPrivateKey, $recipientPublicKey); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | + /** |
|
| 149 | + * @param string $senderPrivateKey |
|
| 150 | + * @param string $recipientPublicKey |
|
| 151 | + * @param string $nonce |
|
| 152 | + */ |
|
| 148 | 153 | final public function encryptFileMessage(UploadFileResult $uploadFileResult, |
| 149 | 154 | EncryptResult $encryptResult, |
| 150 | 155 | UploadFileResult $thumbnailUploadFileResult = null, |
@@ -193,9 +198,9 @@ discard block |
||
| 193 | 198 | * make a secret box |
| 194 | 199 | * |
| 195 | 200 | * @param $data |
| 196 | - * @param $nonce |
|
| 201 | + * @param string $nonce |
|
| 197 | 202 | * @param $key |
| 198 | - * @return mixed |
|
| 203 | + * @return string |
|
| 199 | 204 | */ |
| 200 | 205 | abstract protected function makeSecretBox($data, $nonce, $key); |
| 201 | 206 | |
@@ -337,6 +342,9 @@ discard block |
||
| 337 | 342 | return hash_hmac('sha256', $phoneNoClean, self::PHONENO_HMAC_KEY); |
| 338 | 343 | } |
| 339 | 344 | |
| 345 | + /** |
|
| 346 | + * @return string |
|
| 347 | + */ |
|
| 340 | 348 | abstract protected function createRandom($size); |
| 341 | 349 | |
| 342 | 350 | /** |
@@ -379,7 +387,7 @@ discard block |
||
| 379 | 387 | abstract public function validate(); |
| 380 | 388 | |
| 381 | 389 | /** |
| 382 | - * @param $data |
|
| 390 | + * @param string $data |
|
| 383 | 391 | * @return EncryptResult |
| 384 | 392 | */ |
| 385 | 393 | public final function encryptFile($data) { |
@@ -391,7 +399,7 @@ discard block |
||
| 391 | 399 | /** |
| 392 | 400 | * @param string $data as binary |
| 393 | 401 | * @param string $key as binary |
| 394 | - * @return null|string |
|
| 402 | + * @return string |
|
| 395 | 403 | */ |
| 396 | 404 | public final function decryptFile($data, $key) { |
| 397 | 405 | $result = $this->openSecretBox($data, self::FILE_NONCE, $key); |
@@ -408,6 +416,10 @@ discard block |
||
| 408 | 416 | return new EncryptResult($box, $key, self::FILE_THUMBNAIL_NONCE, strlen($box)); |
| 409 | 417 | } |
| 410 | 418 | |
| 419 | + /** |
|
| 420 | + * @param string $data |
|
| 421 | + * @param string $key |
|
| 422 | + */ |
|
| 411 | 423 | public final function decryptFileThumbnail($data, $key) { |
| 412 | 424 | $result = $this->openSecretBox($data, self::FILE_THUMBNAIL_NONCE, $key); |
| 413 | 425 | return false === $result ? null : $result; |