@@ -99,10 +99,9 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * @param string $target |
|
| 103 | 102 | * @param array $payload |
| 104 | 103 | * |
| 105 | - * @return Rpc |
|
| 104 | + * @return RpcError |
|
| 106 | 105 | */ |
| 107 | 106 | public static function rpcError($uniqid, array $payload = []) |
| 108 | 107 | { |
@@ -112,7 +111,7 @@ discard block |
||
| 112 | 111 | /** |
| 113 | 112 | * @param array $line |
| 114 | 113 | * |
| 115 | - * @return Rpc |
|
| 114 | + * @return RpcError |
|
| 116 | 115 | */ |
| 117 | 116 | protected static function rpcErrorFromLine(array $line) |
| 118 | 117 | { |
@@ -143,7 +142,7 @@ discard block |
||
| 143 | 142 | * @param string $uniqid |
| 144 | 143 | * @param array $payload |
| 145 | 144 | * |
| 146 | - * @return RpcSuccess |
|
| 145 | + * @return RpcNotify |
|
| 147 | 146 | */ |
| 148 | 147 | public static function rpcNotify($uniqid, array $payload = []) |
| 149 | 148 | { |
@@ -152,7 +151,7 @@ discard block |
||
| 152 | 151 | |
| 153 | 152 | /** |
| 154 | 153 | * @param array $line |
| 155 | - * @return RpcSuccess |
|
| 154 | + * @return RpcNotify |
|
| 156 | 155 | */ |
| 157 | 156 | protected static function rpcNotifyFromLine(array $line) |
| 158 | 157 | { |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * @param $uniqid |
|
| 46 | + * @param string $uniqid |
|
| 47 | 47 | * @return static |
| 48 | 48 | */ |
| 49 | 49 | public function setUniqid($uniqid) |
@@ -2,9 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace WyriHaximus\React\ChildProcess\Messenger\Messages; |
| 4 | 4 | |
| 5 | -use React\Promise\Deferred; |
|
| 6 | -use React\Promise\RejectedPromise; |
|
| 7 | - |
|
| 8 | 5 | class Rpc implements \JsonSerializable, ActionableMessageInterface |
| 9 | 6 | { |
| 10 | 7 | /** |
@@ -42,11 +42,17 @@ |
||
| 42 | 42 | return hash_hmac('sha256', $line, $key, true); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | + /** |
|
| 46 | + * @param string $signature |
|
| 47 | + */ |
|
| 45 | 48 | protected static function validate($signature, $line, $key) |
| 46 | 49 | { |
| 47 | 50 | return hash_equals($signature, static::sign($line, $key)); |
| 48 | 51 | } |
| 49 | 52 | |
| 53 | + /** |
|
| 54 | + * @param string $line |
|
| 55 | + */ |
|
| 50 | 56 | public static function fromLine($line, array $lineOptions) |
| 51 | 57 | { |
| 52 | 58 | if (static::validate(base64_decode($line['signature']), $line['line'], $lineOptions['key'])) { |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * @return mixed |
|
| 45 | + * @return string |
|
| 46 | 46 | */ |
| 47 | 47 | public function getUniqid() |
| 48 | 48 | { |