-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
52 lines (46 loc) · 1.13 KB
/
main.cpp
File metadata and controls
52 lines (46 loc) · 1.13 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
#include "server.hpp"
#include <iostream>
//#include "send.cpp"
//int main()
//{
// std::string message;
// std::string room;
// int i = 0;
// std::cout << "Poslat/prijmout zpravu: ";
// std::cin >> i;
// switch (i)
// {
// case(0):
// std::cout << "Zadejte zpravu: ";
// std::cin >> message;
// std::cout << "Zadejte room: ";
// std::cin >> room;
// server::send_message(message, room);
// break;
// case(1):
// receive_message();
// break;
//
// default:
// break;
// }
//
//}
int main()
{
std::string room = "general";
std::cout << "Generating ephemeral X25519 key..." << std::endl;
std::string our_pub = server::generate_ephemeral_public_key();
std::cout << "Our public key (Base64):\n" << our_pub << std::endl;
std::cout << "Paste peer public key (Base64), then press Enter:\n> ";
std::string peer_pub;
std::cin >> peer_pub;
server::set_room_key_from_exchange(room, peer_pub);
std::cout << "Derived shared room key for '" << room << "'." << std::endl;
std::cout << "Enter message to send:\n> ";
std::string message;
std::cin.ignore();
std::getline(std::cin, message);
server::send_message_room_key(message, room);
return 0;
}