|
...
|
...
|
@@ -56,23 +56,20 @@ class Verify extends Config |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Request $request
|
|
|
|
* @param string $sign
|
|
|
|
* @param array $body
|
|
|
|
* @param string $signMethod
|
|
|
|
* @param string $appid
|
|
|
|
* @return bool|void
|
|
|
|
*/
|
|
|
|
public function through(Request $request)
|
|
|
|
public function through(string $sign, array $body, string $signMethod, string $appid)
|
|
|
|
{
|
|
|
|
$signMethod = $request->getHeaderLine('sign-method');
|
|
|
|
|
|
|
|
$eventSign = $request->getHeaderLine('event-sign');
|
|
|
|
|
|
|
|
$appId = $request->getHeaderLine('app-id');
|
|
|
|
|
|
|
|
$configs = \config(ServiceProvider::$name);
|
|
|
|
|
|
|
|
$appName = null;
|
|
|
|
|
|
|
|
foreach ($configs as $name => $config) {
|
|
|
|
if (Arr::get($config, 'app_key') === $appId) {
|
|
|
|
if (Arr::get($config, 'app_key') === $appid) {
|
|
|
|
$appName = $name;
|
|
|
|
break;
|
|
|
|
}
|
|
...
|
...
|
@@ -88,9 +85,9 @@ class Verify extends Config |
|
|
|
|
|
|
|
switch ($signMethod) {
|
|
|
|
case 'hmac-sha256':
|
|
|
|
return $this->sha256($eventSign, $request->getBody());
|
|
|
|
return $this->sha256($sign, $body);
|
|
|
|
case 'md5':
|
|
|
|
return $this->md5($eventSign, $request->getBody());
|
|
|
|
return $this->md5($sign, $body);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|