1 | <?php |
||
23 | class Signer |
||
24 | { |
||
25 | /** |
||
26 | * @var array Valid parameters in the response message |
||
27 | */ |
||
28 | private static $validResponseParams = [ |
||
29 | 'nonce', |
||
30 | 'otp', |
||
31 | 'sessioncounter', |
||
32 | 'sessionuse', |
||
33 | 'sl', |
||
34 | 'status', |
||
35 | 't', |
||
36 | 'timeout', |
||
37 | 'timestamp' |
||
38 | ]; |
||
39 | |||
40 | /** |
||
41 | * @var string The base64-decoded client secret |
||
42 | */ |
||
43 | private $clientSecret; |
||
44 | |||
45 | /** |
||
46 | * @param string $clientSecret The base64-encoded client secret |
||
47 | */ |
||
48 | public function __construct($clientSecret) |
||
60 | |||
61 | /** |
||
62 | * Signs an array by calculating a signature and setting it on the 'h' key. |
||
63 | * |
||
64 | * @param array $data |
||
65 | * @return array |
||
66 | */ |
||
67 | public function sign(array $data) |
||
76 | |||
77 | /** |
||
78 | * Verifies that the signature in the 'h' key matches the expected signature. |
||
79 | * |
||
80 | * @param array $data |
||
81 | * @return bool |
||
82 | */ |
||
83 | public function verifySignature(array $data) |
||
93 | |||
94 | /** |
||
95 | * @param array $query |
||
96 | * @return string |
||
97 | */ |
||
98 | private function buildQueryString(array $query) |
||
108 | } |
||
109 |