Completed
Push — master ( 381557...d947b3 )
by Ashley
01:11
created

GitHub::headers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Clarkeash\Shield\Services;
4
5
use Clarkeash\Shield\Contracts\Service;
6
use Illuminate\Http\Request;
7
8
class GitHub implements Service
9
{
10
    public function verify(Request $request): bool
11
    {
12
        $generated = 'sha1=' . hash_hmac('sha1', $request->getContent(), config('shield.services.github.token'));
13
14
        return hash_equals($generated, $request->header('X-Hub-Signature', ''));
15
    }
16
17
    public function headers(): array
18
    {
19
        return ['X-Hub-Signature'];
20
    }
21
}
22