include "../log.php"; $n = "7e470001e6ec9eb772fccc78617b8930ced9dc05f27eb678098ea9fe1584740c9a08761bede311e9191e42e004b66db6ac22c2f7f01520e1b4e865675791e3807ed85b378b8df0bcc7525c5608148625e3563d4ed27ba39ea01aa5b3df9c7a72bde25df717864e123718e021c229e8ffe8ce3652598d12d4d48aa07bb0b8d727cb791b366ab9f84d6fa9e5d65a07309beb63ad501dd312aacac8a98e5b7e8f7b6a140787733e24e4e125af6baffaa2c4bd945721878f6c0fe352d12aba8d88bd1ee59e04fcdad519b52c3ff0b9cf24a2e78164a8bfd15e021c7331e2a73dc54c6e02ac9ed168bde03649395a4996bc60bfbaf061924392d04ae2c62001d1cd37"; $e = "10001"; $json = '{"object":{"test":"esr"},"signature":{"keyRevision":2,"hashvalue":"3af9b3a1aa867ccc4f99e8b00d4de6943eab4ad7d484087f94f3b66b3704b264f6817d4751bd3b443b69438048ccc10f62ef7f9b73472276773b73398794669bd4fd5c47dda07a6ca8a1ea7cdb69261abb45f1258c8f089197047768786945c32e9ac29a89b5d69c6115e3444565d0ecca9d7b886836bf0ef8662bf4fc97759ca7cc70dc7e4abbce14090ff0d4a2a2fc5062d2f637b8de71200d535d3c4b6bda1abf6cdcc99e3bf55d891e17711c35653d4fa2f86418a8cd6be6144a4fea608f661d8a8927a0e8870bc4e682bcf2112153b87500e551132bab112a27f05daf0e173af62334165523b45b11300784e80f056fd04a51715509885ff781d56d450d"}}'; echo "<h2>debug</h2>"; echo "<h1>Charme Test Suite</h1>"; // Verify Requests $request1 = array(); if (\App\Security\RequestVerificator::Verify($request1)) { echo "OK"; } else { echo "FAIL"; } echo "<h3>Server Key Directory</h3>"; echo "invalid key revision return:" . \App\Security\PublicKeys::tryToAdd("*****@*****.**", 2213123) . "<br>"; echo "valid key revision return:" . \App\Security\PublicKeys::tryToAdd("*****@*****.**", 2); echo "<br>---------------------------------------------------------------------------------------------------------------------------<br>"; //data you want to sign $cert = <<<EOT -----BEGIN CERTIFICATE----- MIIBITANBgkqhkiG9w0BAQEFAAOCAQ4AMIIBCQKCAQB+RwAB5uyet3L8zHhhe4kw ztncBfJ+tngJjqn+FYR0DJoIdhvt4xHpGR5C4AS2bbasIsL38BUg4bToZWdXkeOA fthbN4uN8LzHUlxWCBSGJeNWPU7Se6OeoBqls9+cenK94l33F4ZOEjcY4CHCKej/ 6M42UlmNEtTUiqB7sLjXJ8t5GzZqufhNb6nl1loHMJvrY61QHdMSqsrIqY5bfo97 ahQHh3M+JOThJa9rr/qixL2UVyGHj2wP41LRKrqNiL0e5Z4E/NrVGbUsP/C5zySi 54FkqL/RXgIcczHipz3FTG4CrJ7RaL3gNkk5WkmWvGC/uvBhkkOS0ErixiAB0c03 AgMBAAE= -----END CERTIFICATE----- EOT; $pub = <<<PK -----BEGIN PUBLIC KEY-----
// $col->streamcomments->remove(array("commentId" => $item["signature"]["object"]["commentId"], "postowner" => $_SESSION["charme_userid"])); // will be done locally via comment_delete receive $col->comments->remove(array("_id" => $commentId, "userId" => $_SESSION["charme_userid"])); // Delete comment locally $col->comments->remove(array("_id" => $commentId, "postowner" => $_SESSION["charme_userid"])); \App\Hydra\Distribute::start(); // Start server distribution break; // Comments can either be deleted by post owner or by comment owner, so check if the sender is either one of them // Comments can either be deleted by post owner or by comment owner, so check if the sender is either one of them case "comment_delete_receive": // TODO: Check if sender signature is commentId and also add sender signature to commentId $col = \App\DB\Get::Collection(); $realCommentId = $item["signature"]["object"]["commentId"]; $pemkey = \App\Security\PublicKeys::tryToGet($item["deleter"], $item["signature"]["signature"]["keyRevision"]); if ($pemkey != false) { $ok = \App\Security\PublicKeys::checkX509($item["signature"], $pemkey); if ($ok) { $col->streamcomments->remove(array("commentId" => $realCommentId)); $col->streamcomments->remove(array("commentData.object.userId" => $realCommentId)); } } break; case "entity_delete": break; case "entity_delete_receive": break; case "lists_delete": $col = \App\DB\Get::Collection(); $col->lists->remove(array("owner" => $_SESSION["charme_userid"], "_id" => new MongoId($item["listId"]))); $returnArray[$action] = array("SUCCESS" => true); break;