|
@@ -7,7 +7,7 @@ discard block |
|
|
block discarded – undo |
|
7
|
7
|
* @license MIT |
|
8
|
8
|
*/ |
|
9
|
9
|
|
|
10
|
|
-require_once __DIR__.'/../vendor/autoload.php'; |
|
|
10
|
+require_once __DIR__ . '/../vendor/autoload.php'; |
|
11
|
11
|
|
|
12
|
12
|
use chillerlan\Threema\Crypto\CryptoSodium; |
|
13
|
13
|
use chillerlan\Threema\Gateway; |
|
@@ -15,17 +15,17 @@ discard block |
|
|
block discarded – undo |
|
15
|
15
|
|
|
16
|
16
|
$gatewayOptions = new GatewayOptions; |
|
17
|
17
|
$gatewayOptions->configFilename = '.threema'; // @todo TRAVIS REMINDER! |
|
18
|
|
-$gatewayOptions->configPath = __DIR__.'/../config'; |
|
19
|
|
-$gatewayOptions->storagePath = __DIR__.'/../storage'; |
|
20
|
|
-$gatewayOptions->cacert = __DIR__.'/../storage/cacert.pem'; |
|
|
18
|
+$gatewayOptions->configPath = __DIR__ . '/../config'; |
|
|
19
|
+$gatewayOptions->storagePath = __DIR__ . '/../storage'; |
|
|
20
|
+$gatewayOptions->cacert = __DIR__ . '/../storage/cacert.pem'; |
|
21
|
21
|
|
|
22
|
22
|
$gateway = new Gateway(new CryptoSodium, $gatewayOptions); |
|
23
|
23
|
|
|
24
|
24
|
$response = []; |
|
25
|
25
|
|
|
26
|
26
|
if(isset($_POST['form']) && $_POST['form'] === 'encrypt'){ |
|
27
|
|
- $x = $gateway->encrypt($_POST['message'], $_POST['private'], $_POST['public']); |
|
28
|
|
- $response['result'] = $x->box.PHP_EOL.$x->nonce; |
|
|
27
|
+ $x = $gateway->encrypt($_POST['message'], $_POST['private'], $_POST['public']); |
|
|
28
|
+ $response['result'] = $x->box . PHP_EOL . $x->nonce; |
|
29
|
29
|
} |
|
30
|
30
|
|
|
31
|
31
|
|
|
@@ -33,7 +33,7 @@ discard block |
|
|
block discarded – undo |
|
33
|
33
|
|
|
34
|
34
|
|
|
35
|
35
|
header('Content-type: application/json;charset=utf-8;'); |
|
36
|
|
-header('Last-Modified: '.date('r')); |
|
|
36
|
+header('Last-Modified: ' . date('r')); |
|
37
|
37
|
header('Expires: Tue, 23 May 1989 13:37:23 GMT'); |
|
38
|
38
|
header('Cache-Control: max-age=0, private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); |
|
39
|
39
|
header('Pragma: no-cache'); |