1 | <?php |
||
36 | class Gateway{ |
||
37 | |||
38 | /** |
||
39 | * @var \chillerlan\Threema\Crypto\CryptoInterface |
||
40 | */ |
||
41 | private $cryptoInterface; |
||
42 | |||
43 | /** |
||
44 | * @var \chillerlan\Threema\GatewayInterface |
||
45 | */ |
||
46 | private $gatewayInterface; |
||
47 | |||
48 | /** |
||
49 | * @var array[\ReflectionMethod] |
||
50 | */ |
||
51 | private $gatewayInterfaceMap = []; |
||
52 | |||
53 | /** |
||
54 | * Gateway constructor. |
||
55 | * |
||
56 | * @param \chillerlan\Threema\Crypto\CryptoInterface $cryptoInterface |
||
57 | * @param \chillerlan\Threema\GatewayOptions $gatewayOptions |
||
58 | * |
||
59 | * @throws \chillerlan\Threema\GatewayException |
||
60 | */ |
||
61 | public function __construct(CryptoInterface $cryptoInterface, GatewayOptions $gatewayOptions){ |
||
80 | |||
81 | /** |
||
82 | * @param string $method |
||
83 | * @param array $params |
||
84 | * |
||
85 | * @return mixed |
||
86 | * @throws \chillerlan\Threema\GatewayException |
||
87 | */ |
||
88 | public function __call(string $method, array $params){ |
||
98 | |||
99 | ####################### |
||
100 | # convenience methods # |
||
101 | ####################### |
||
102 | |||
103 | public function cryptoVersion():string{ |
||
106 | |||
107 | /** |
||
108 | * @return \stdClass |
||
109 | */ |
||
110 | public function getKeypair():stdClass{ |
||
113 | |||
114 | /** |
||
115 | * @param string $data |
||
116 | * @param string $privateKey hex string |
||
117 | * @param string $publicKey hex string |
||
118 | * |
||
119 | * @return \stdClass |
||
120 | */ |
||
121 | public function encrypt(string $data, string $privateKey, string $publicKey):stdClass{ |
||
124 | |||
125 | /** |
||
126 | * @param string $box hex string |
||
127 | * @param string $nonce hex string |
||
128 | * @param string $privateKey hex string |
||
129 | * @param string $publicKey hex string |
||
130 | * |
||
131 | * @return string |
||
132 | */ |
||
133 | public function decrypt(string $box, string $nonce, string $privateKey, string $publicKey):string{ |
||
136 | |||
137 | } |
||
138 |