◢███◤      ◢██◤                            ◢██◤                            
     ◢██◤       ◢██◤                            ◢██◤                             
    ◢██◤       ◢██◤                            ◢██◤                              
   ◢██◤       ◢██◤                            ◢██◤                               
  ◢██◤       ◢██◤                            ◢██◤                                
◢███◤       ◢██◤                            ◢██◤                          ◥██◣   
◥███       ◢█████◣    ◢████████◤ ◢███████◤ ◢██◤ ◢██◤                 ◢██◤   ██◣  
 ███      ◢███████◣        ◢██◤ ◢██◤ ◢██◤ ◢███████◤                 ◢██◤    ███  
 ███     ◢██◤  ◢██◤ ◢████████◤ ◢██◤      ◢█████◣                   ◢██◤     ███  
 ███    ◢██◤  ◢██◤ ◢██◤  ███◤ ◢██◤ ◢██◤ ◢██◤◥███◣                 ◢██◤      ███  
 ◥██   ◢██◤  ◢██◤ ◢████████◤ ◢███████◤ ◢██◤  ◥███◣               ◢██◤       ███◣ 
  ◥██◣                                                          ◢██◤       ◢███◤ 
                                 ◢███◤ ◢███◤ ◢██◤  ◢██◤ ◢█████████◤       ◢██◤   
                                ◢█████████◤ ◢██◤  ◢██◤ ◢██◤  ████◤       ◢██◤    
                               ◢██◤◢█◤◢██◤ ◢██◤  ◢██◤ ◢██◤   ███◤       ◢██◤     
                              ◢██◤   ◢██◤ ◢████████◤ ◢█████████◤       ◢██◤      
                             ◢██◤   ◢██◤ ◢████████◤ ◢█████████◤      ◢███◤       

0002
mudmail protocol spec
zo57ej
`Fmudmail protocol spec` written by `1mogery` version 0.1.1 (210606, rough draft) `FChapter 1: Introduction` mudmail is a collection of protocols for decentralized mailservers and clients in hackmud. It enables users to send and receive messages between different mail scripts. This is good, while people can selfhost a mailserver, if they do not trust the operator of an other one. The issue of trust could be avoided with `Fchats`.`2tell`, however the throughput is very limited. mudmail has two components: * mail servers, that communicate with each other to deliver messages using the S2S (server-to-server) protocol * mail clients, that communicate with a mailserver to send and receive messages using the C2S (client-to-server) protocol mudmail must always be adressed to hackmud usernames. If servers were to maintain special inboxes, they should start with the character `1%`, and follow the hackmud username format otherwise. `FChapter 2: Mailservers` mudmail-compatible mailservers must be `2FULLSEC`, and must support both the S2S and C2S protocols. A mailserver needn't contain a mail client. A reference (quineable) mail client will be available at `0mail`.`2box`. If users do not trust it, they can use alternatives, or roll their own. A reference mailserver will also be available at `0mail`.`2server`. `FChapter 3: S2S protocol` The S2S protocol is based on scriptor calls. Mailservers must consider accepting S2S packets when `1context.is_scriptor`, needn't consider accepting S2S packets when `1context.calling_script`, and shouldn't consider accepting S2S packets otherwise. S2S packets must be delivered to the `N_s2s` argument. The argument must be either an array of packet objects or a packet object. The response must be respectively either an array of packet objects or a packet object. If the response is an array of packet objects, the order of the responses must match the order of the requests. `1mailserver.call({` `N_s2s`: `1{` `Nt`: `V"mm_hello"` `1}` `1});` `0-----` `1{` `Nt`: `V"mm_hello"`, `Nv`: `V"0.1.1"` `1}` `1mailserver.call({` `N_s2s`: `1[` `1{` `Nt`: `V"mm_hello"` `1}`, `1{` `Nt`: `V"mm_send"`, `No`: `V"mogery"`, `Nr`: `V"mg"`, `Ns`: `V"greeting"`, `Nc`: `V"hi there, mg! -mogery"` `1}` `1]` `1});` `0-----` `1[` `1{` `Nt`: `V"mm_hello"`, `Nv`: `V"0.1.1"` `1}`, `1{`, `Nt`: `V"mm_send"`, `Nk`: `Vtrue` `1}` `1]` `JExample of S2S packets.` `FChapter 3.1: Packets` `2Packet ``Vmm_hello` `1Description`: Server handshake. `1Request properties`: `0(none)` `1Response properties`: `Nv`: Implemented mudmail version `0(current: ``V"0.1.1"``0)` `2Packet ``Vmm_send` `1Description`: E-mail send packet. `JNote`: receiveing mailserver should store time of arrival and store it as a timestamp to use in the future. `1Request properties`: `No`: Username of sender `0(origin)` `Nr`: Username of recipient `Ns`: Subject `0(max. 256 chars)` `Nc`: Content `0(max. chars to be decided per-instance. recommended max.: 5k chars)` `1Response properties`: `Nk`: Was the e-mail recieved successfully? `Ne`: Error object `0(only if ``Nk``0 is false.)` `Nc`: HTTP-like error code `Nt`: Error message shown to user `1Possible error codes:` `V400`: Invalid properties `V403`: Sender/sender's mailserver is blacklisted `V404`: Recipient not found `V429`: Spam detected/Rate limited `FChapter 4: C2S Protocol` The C2S protocol is based on scriptor and subscript calls. Mailservers must consider accepting S2S packets when `1context.is_scriptor` or `1context.calling_script`, and shouldn't consider accepting C2S packets otherwise. C2S authentication is based on `1context.caller`. Implementations can add custom authentication methods for accessing speical inboxes, however, if based on packets, their packet names must not start with `Vmm_`, rather a custom prefix. C2S packets must be delivered to the `N_c2s` argument. The argument must be either an array of packet objects or a packet object. The response must be respectively either an array of packet objects or a packet object. If the response is an array of packet objects, the order of the responses must match the order of the requests. `1mailserver.call({` `N_c2s`: `1{` `Nt`: `V"mm_hello"` `1}` `1});` `0-----` `1{` `Nt`: `V"mm_hello"`, `Nv`: `V"0.1.1"` `1}` `1mailserver.call({` `N_c2s`: `1[` `1{` `Nt`: `V"mm_hello"` `1}`, `1 {` `Nt`: `Vmm_mailbox`, `Nc`: `V10`, `Np`: `V0` `1}` `1{`, `Nt`: `V"mm_send"`, `Nr`: `V["mg", targetMailServer]`, `Ns`: `V"re: greeting"`, `Nc`: `V"hi there, mg! -mogery"` `1}` `1]` `1});` `0-----` `1[` `1{` `Nt`: `V"mm_hello"`, `Nv`: `V"0.1.1"` `1}`, `1{`, `Nt`: `Vmm_mailbox`, `Nm`: `1[` `1{` `Nf`: `V["mg", "senderMailServer"]`, `Ns`: `V"greeting"`, `Nc`: `V"hi there, mogery! -mg"`, `Nt`: `V1623009420048` `1}` `1]` `1}`, `1{`, `Nt`: `V"mm_send"`, `Nk`: `Vtrue` `1}` `1]` `JExample of C2S packets.` `FChapter 4.1: Packets` `2Packet ``Vmm_hello` `1Description`: Server handshake. `1Request properties`: `0(none)` `1Response properties`: `Nv`: Implemented mudmail version `0(current: ``V"0.1.1"``0)` `2Packet ``Vmm_send` `1Description`: E-mail send packet. `1Request properties`: `Nr`: Array of recipient name and mailserver scriptor. `Ns`: Subject `0(max. 256 chars)` `Nc`: Content `0(max. chars to be decided per-instance. recommended max.: 5k chars)` `1Response properties`: `Nk`: Was the e-mail sent/received successfully? (Possible error from recipient's mailserver should be forwarded.) `Ne`: Error object `0(only if ``Nk``0 is false.)` `Nc`: HTTP-like error code `Nt`: Error message shown to user `1Possible error codes:` `V400`: Invalid properties/Recipient mailserver does not match requirements (e.g. SECLEVEL) `V403`: Recipient/recipient's mailserver is blacklisted `V404`: Recipient not found `V429`: Spam detected/Rate limited + possible codes of `FS2S``1/``Vmm_send` `2Packet ``Vmm_mailbox` `1Description`: E-mail retrieve packet. `1Request properties`: `Nc`: Count of messages to return `Np`: Page to return `0(0-based)` `1Response properties`: `Nm`: Array of messages `Nf`: Array of recipient name and mailserver name. `Ns`: Subject `Nc`: Content `Nt`: Time of arrival to mailserver, from `VDate.now()` `1Possible error codes:` `V400`: Invalid properties/Recipient mailserver does not match requirements (e.g. SECLEVEL) `V403`: Recipient/recipient's mailserver is blacklisted `V404`: Recipient not found `V429`: Spam detected/Rate limited + possible codes of `FS2S``1/``Vmm_send` `FAppendix A: Changelog` `10.1.1` changed `V421` error codes to `V429`s changed version number format to be semver-compatible added `Vmm_mailbox` `FC2S` packet
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -