protected function doRun()
 {
     $cryptTool = CryptTool::getInstance();
     $sendersThreemaId = $this->getArgumentThreemaId(self::argThreemaId);
     $id = $this->getArgumentThreemaId(self::argFrom);
     $secret = $this->getArgument(self::argSecret);
     $privateKey = $this->getArgumentPrivateKey(self::argPrivateKey);
     $nonce = $cryptTool->hex2bin($this->getArgument(self::argNonce));
     $messageId = $this->getArgument(self::argMessageId);
     $outputFolder = $this->getArgument(self::argOutputFolder);
     $box = $cryptTool->hex2bin($this->readStdIn());
     Common::required($box, $id, $secret, $privateKey, $nonce);
     $settings = new ConnectionSettings($id, $secret);
     $connector = new Connection($settings, $this->publicKeyStore);
     $helper = new E2EHelper($privateKey, $connector);
     $message = $helper->receiveMessage($sendersThreemaId, $messageId, $box, $nonce, $outputFolder);
     if (null === $message) {
         Common::e('invalid message');
         return;
     }
     if ($message->isSuccess()) {
         Common::l($message->getMessageId() . ' - ' . $message->getThreemaMessage());
         foreach ($message->getFiles() as $fileName => $filePath) {
             Common::l('   received file ' . $fileName . ' in ' . $filePath);
         }
     } else {
         Common::e('Error: ' . implode("\n", $message->getErrors()));
     }
 }
 protected function doRun()
 {
     $threemaId = $this->getArgument(self::argThreemaId);
     $from = $this->getArgument(self::argFrom);
     $secret = $this->getArgument(self::argSecret);
     $privateKey = $this->getArgumentPrivateKey(self::argPrivateKey);
     $path = $this->getArgumentFile(self::argImageFile);
     Common::required($threemaId, $from, $secret, $privateKey, $path);
     $settings = new ConnectionSettings($from, $secret);
     $connector = new Connection($settings, $this->publicKeyStore);
     $helper = new E2EHelper($privateKey, $connector);
     $result = $helper->sendImageMessage($threemaId, $path);
     if ($result->isSuccess()) {
         Common::l('Message ID: ' . $result->getMessageId());
     } else {
         Common::e('Error: ' . $result->getErrorMessage());
     }
 }
 protected function doRun()
 {
     $threemaId = $this->getArgumentThreemaId(self::argThreemaId);
     $from = $this->getArgument(self::argFrom);
     $secret = $this->getArgument(self::argSecret);
     $privateKey = $this->getArgumentPrivateKey(self::argPrivateKey);
     Common::required($threemaId, $from, $secret, $privateKey);
     $message = $this->readStdIn();
     if (strlen($message) === 0) {
         throw new \InvalidArgumentException('please define a message');
     }
     $settings = new ConnectionSettings($from, $secret);
     $connector = new Connection($settings, $this->publicKeyStore);
     $helper = new E2EHelper($privateKey, $connector);
     $result = $helper->sendTextMessage($threemaId, $message);
     if ($result->isSuccess()) {
         Common::l('Message ID: ' . $result->getMessageId());
     } else {
         Common::e('Error: ' . $result->getErrorMessage());
     }
 }