about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2023-04-04 16:13:34 -0500
committerCase Duckworth2023-04-04 16:13:34 -0500
commit25ceaa1fd3575383641b28ab6c3f6f02f6da5883 (patch)
tree945083e8603ae2585b4cfd30508a72bf7fd8e0bb
parentAdd readme (diff)
downloadpostcard-25ceaa1fd3575383641b28ab6c3f6f02f6da5883.tar.gz
postcard-25ceaa1fd3575383641b28ab6c3f6f02f6da5883.zip
Add protocol description
-rw-r--r--protocol.txt46
1 files changed, 46 insertions, 0 deletions
diff --git a/protocol.txt b/protocol.txt new file mode 100644 index 0000000..0fa5ca6 --- /dev/null +++ b/protocol.txt
@@ -0,0 +1,46 @@
1THE POSTCARD PROTOCOL
2
3The postcard protocol is a small client-server protocol built on udp for short
4one-off messages. Messages must be contained in one packet (512 bytes); with
5metadata taking up around 100 bytes that means messages can be up to around 400
6bytes in length, which is roughly postcard-sized.
7
8A postcard message looks like this (sans leading indentation):
9
10 <recipient><newline>
11 <ed25519 public key of sender><newline>
12 <message>
13
14A postcard server ("Post office") is a persistent process somewhere online that exists to
15receive postcards and deliver them to the proper user. It could be fun to have
16a block of ports, each of which serves as one user's "P.O. box" on that server.
17If an entire block isn't available, one port could be used and delivery made
18using the first line of the postcard.
19
20Spam mitigation has two layers:
21
221. The sender must know the recipient's server (and possibly port number) and
23 user name. Post offices must keep a list of user names and their associated
24 port numbers, and if the recipient's name and port fail to align, or if the
25 office doesn't have a user, the message is rejected.
26
272. Sender identity is verified using ED25519 public key cryptography (chosen
28 because of its short length---a mere 32 bytes). Post offices should keep
29 lists of friends and fuckers, letting the first deliver to their users and
30 telling the second to shove it. When receiving a message from an unknown
31 recipient, the post office should hold the message for a given amount of time
32 and allow a moderator ("postmaster") to decide whether the sender is a
33 friend or fucker.
34
35UDP was chosen as a protocol precisely for its lossy and unpredictable nature:
36postcards themselves can get lost in the mail or damaged by rain or machinery,
37after all. However, if a postmaster wants to provide a greater level of
38service for senders to their office, they may respond with one of the following
39codes upon receipt of message:
40
41(1) HM --- message received but waiting for moderation
42(2) OK --- message received and delivered
43(3) FU --- fuck off, fucker!
44
45Of course, a postmaster can decide to not send HM or simply not to reply to
46fuckers. They can just pretend the message was lost in the mail.