Completed
Push — master ( dbf695...99cb7b )
by Ashley
01:12
created

Trello::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
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Clarkeash\Shield\Services;
4
5
use Illuminate\Http\Request;
6
7
class Trello extends BaseService
8
{
9
    public function verify(Request $request): bool
10
    {
11
        $secret = config('shield.services.trello.app_secret');
12
13
        $content = trim($request->getContent()) . $request->fullUrl();
14
15
        $signature = hash_hmac('sha1', $content, $secret, true);
16
17
        return base64_encode($signature) === $request->header('X-Trello-Webhook');
18
    }
19
20
    public function headers(): array
21
    {
22
        return ['X-Trello-Webhook'];
23
    }
24
}