PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 3.1.0
Defender Security – Malware Scanner, Login Security & Firewall v3.1.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / vendor / opis / closure / src / SecurityProvider.php

SecurityProvider.php in Defender Security – Malware Scanner, Login Security & Firewall 3.1.0, at vendor/opis/closure/src/SecurityProvider.php

42 lines 980 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /* ===========================================================================
3 * Copyright (c) 2018-2021 Zindex Software
4 *
5 * Licensed under the MIT License
6 * =========================================================================== */
7
8 namespace Opis\Closure;
9
10 class SecurityProvider implements ISecurityProvider
11 {
12 /** @var string */
13 protected $secret;
14
15 /**
16 * SecurityProvider constructor.
17 * @param string $secret
18 */
19 public function __construct($secret)
20 {
21 $this->secret = $secret;
22 }
23
24 /**
25 * @inheritdoc
26 */
27 public function sign($closure)
28 {
29 return array(
30 'closure' => $closure,
31 'hash' => base64_encode(hash_hmac('sha256', $closure, $this->secret, true)),
32 );
33 }
34
35 /**
36 * @inheritdoc
37 */
38 public function verify(array $data)
39 {
40 return base64_encode(hash_hmac('sha256', $data['closure'], $this->secret, true)) === $data['hash'];
41 }
42 }