commit 5ee02573e1cc40b8cf69d101038028f36a2f64ec
Author: c0repwn3r <core@coredoes.dev>
Date:   Tue Mar 14 23:58:29 2023 -0400

    work on palmdef

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..3ce3588
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="MarkdownSettingsMigration">
+    <option name="stateVersion" value="1" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..b0c0509
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/palm.iml" filepath="$PROJECT_DIR$/.idea/palm.iml" />
+    </modules>
+  </component>
+</project>
\ No newline at end of file
diff --git a/.idea/palm.iml b/.idea/palm.iml
new file mode 100644
index 0000000..c254557
--- /dev/null
+++ b/.idea/palm.iml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="CPP_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000..e1586a4
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,7 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "palm"
+version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..72f9b34
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "palm"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/palmdef/palmdef.proto b/palmdef/palmdef.proto
new file mode 100644
index 0000000..e240fbc
--- /dev/null
+++ b/palmdef/palmdef.proto
@@ -0,0 +1,56 @@
+syntax = "proto3";
+
+/*
+  There are four types of messages that palm can send.
+    1. Unencrypted reflection. This is unencrypted communication between a relay and a client.
+    2. Encrypted reflection. This is encrypted communication between a relay and a client.
+    3. Unencrypted tunnel. This is unencrypted communication between a client and a client, through a relay. Note that it is encrypted both ways via encrypted reflection.
+    4. Encrypted tunnel. This is doubly-encrypted communcation between a client and a client, through a relay.
+
+  The following convention is used:
+    C2R Client to Relay - Reflection
+    R2C Relay to Client - Reflection
+    I2R Initiating Client to Receiving Client - Tunneled
+    R2I Receiving Client to Initiating Client - Tunneled
+ */
+
+/////// UNENCRYPTED REFLECTION ///////
+
+// Sent by client at start of connection
+message PalmC2RHandshakeStart {
+  bytes ClientPublicKey = 1;  // 32-byte X25519 public key
+  bytes SessionIV = 2;        // 12-byte randomized IV generated by the client
+  bytes Check = 3;            // 32-byte randomized value used to check encryption
+}
+
+// Sent by relay in response to PalmC2RHandshakeStart
+message PalmR2CHandshakeFinish {
+  bytes ServerPublicKey = 1;  // 32-byte X25519 public key
+  bytes Check = 2;            // The same 32-byte value provided in PalmC2SHandshakeStart, used to tie this response to the original session
+}
+
+/////// ENCRYPTED REFLECTED MESSAGES ///////
+
+// Sent by client after receiving PalmR2CHandshakeFinish.
+// Used by the client to request a room on the server.
+message PalmC2RRelayRequest {
+  bytes Check = 1;            // The same 32-byte value used in initial reflected handshake, ties this to the session.
+  string ChannelID = 2;       // The string channel ID this client is requested to be routed to.
+}
+
+// Represents the states a room/channel can be in.
+enum PalmRoomStatus {
+  NotReady = 0;               // Waiting for a peer to join
+  Ready = 1;                  // A peer has joined, and the relay is ready to relay the connection
+  InUse = 2;                  // This channel is already in use and cannot be used currently
+}
+
+// Send at *any time* by the server to indicate the current status of the server.
+// Must also be sent in response to PalmC2RRelayRequest to indicate the current status of the room.
+// If the other peer is disconnected, PalmR2CChannelStatus will be sent again with Status = NotReady;
+// The client must handle this correctly.
+message PalmR2CChannelStatus {
+  bytes Check = 1;            // The same 32-byte value used in previous packets, ties this packet to the session.
+  string ChannelID = 2;       // The channel that the client requested.
+  PalmRoomStatus Status = 3;  // The current status of the room.
+}
\ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..e7a11a9
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+    println!("Hello, world!");
+}