-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuthMessage.php
More file actions
executable file
·81 lines (70 loc) · 1.27 KB
/
Copy pathAuthMessage.php
File metadata and controls
executable file
·81 lines (70 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* Basic Authentication Message
*
* @author Daniel Sanchez <dasdo1@gmail.com>
* @version 1.0.0
*/
namespace HmacAuthenticate;
class AuthMessage
{
/**
* Id of the Client
* @var int
*/
protected $publicKey;
/**
* Unix timestamp
* @var string
*/
protected $time;
/**
* Data/Content of the Message
* @var string
*/
protected $data;
/**
* Hash of the Message
* @var string
*/
protected $hash;
/**
* Construct
* @param string $publicKey [description]
* @param string $time [description]
* @param string $hash [description]
* @param Array $data [description]
*/
public function __construct($publicKey, $time, $hash, Array $data = [])
{
$this->publicKey = $publicKey;
$this->hash = $hash;
$this->time = $time;
$this->data = $data;
}
/**
* Get the hash of the Message
*
* @return string
*/
public function getHash()
{
return $this->hash;
}
public function getPublicKey()
{
return $this->publicKey;
}
public function getData()
{
return $this->data;
}
public function getTime()
{
return $this->time;
}
public function build()
{
return $this->time . $this->publicKey . implode($this->data);
}
}