1 | <?php |
||
8 | final class Token |
||
9 | { |
||
10 | /** |
||
11 | * The public api key. |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | private $publicKey; |
||
16 | |||
17 | /** |
||
18 | * A unique hash for the request. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | private $signature; |
||
23 | |||
24 | /** |
||
25 | * An arbitrary string used only once. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | private $nonce; |
||
30 | |||
31 | /** |
||
32 | * The request timestamp. |
||
33 | * |
||
34 | * @var integer |
||
35 | */ |
||
36 | private $timestamp; |
||
37 | |||
38 | /** |
||
39 | * Construct a new Token instance |
||
40 | * |
||
41 | * @param string $publicKey The public api key. |
||
42 | * @param string $signature A unique hash for the request. |
||
43 | * @param string $nonce An arbitrary string used only once. |
||
44 | * @param integer $timestamp The request timestamp. |
||
45 | * |
||
46 | * @throws \InvalidArgumentException Thrown if any parameters are invalid. |
||
47 | */ |
||
48 | public function __construct(string $publicKey, string $signature, string $nonce, int $timestamp) |
||
55 | |||
56 | /** |
||
57 | * The public api key found in the request. |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | public function getPublicKey() : string |
||
65 | |||
66 | /** |
||
67 | * Returns the signature of the request. |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | public function getSignature() : string |
||
75 | |||
76 | /** |
||
77 | * Returns the nonce value found in the request. |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | public function getNonce() : string |
||
85 | |||
86 | /** |
||
87 | * Returns the timestamp of the request. |
||
88 | * |
||
89 | * @return integer |
||
90 | */ |
||
91 | public function getTimestamp() : int |
||
95 | } |
||
96 |