Repository: robinsloan/spring-83 Branch: main Commit: 4cea222979d3 Files: 6 Total size: 100.5 KB Directory structure: gitextract_saknyp78/ ├── LICENSE-CC-BY-SA.md ├── README.md ├── draft-20220609.md ├── draft-20220616.md ├── draft-20220629.md └── simulate.cr ================================================ FILE CONTENTS ================================================ ================================================ FILE: LICENSE-CC-BY-SA.md ================================================ Attribution-ShareAlike 4.0 International ======================================================================= Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an "as-is" basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. Using Creative Commons Public Licenses Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC- licensed material, or material used under an exception or limitation to copyright. More considerations for licensors: wiki.creativecommons.org/Considerations_for_licensors Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor's permission is not necessary for any reason--for example, because of any applicable exception or limitation to copyright--then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More_considerations for the public: wiki.creativecommons.org/Considerations_for_licensees ======================================================================= Creative Commons Attribution-ShareAlike 4.0 International Public License By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. Section 1 -- Definitions. a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. c. BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License. d. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. e. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. f. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. g. License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike. h. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. i. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. j. Licensor means the individual(s) or entity(ies) granting rights under this Public License. k. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. l. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. m. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. Section 2 -- Scope. a. License grant. 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: a. reproduce and Share the Licensed Material, in whole or in part; and b. produce, reproduce, and Share Adapted Material. 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 3. Term. The term of this Public License is specified in Section 6(a). 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a) (4) never produces Adapted Material. 5. Downstream recipients. a. Offer from the Licensor -- Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. b. Additional offer from the Licensor -- Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter's License You apply. c. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). b. Other rights. 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 2. Patent and trademark rights are not licensed under this Public License. 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. Section 3 -- License Conditions. Your exercise of the Licensed Rights is expressly made subject to the following conditions. a. Attribution. 1. If You Share the Licensed Material (including in modified form), You must: a. retain the following if it is supplied by the Licensor with the Licensed Material: i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); ii. a copyright notice; iii. a notice that refers to this Public License; iv. a notice that refers to the disclaimer of warranties; v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; b. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and c. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. b. ShareAlike. In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply. 1. The Adapter's License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License. 2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material. 3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply. Section 4 -- Sui Generis Database Rights. Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. Section 5 -- Disclaimer of Warranties and Limitation of Liability. a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. Section 6 -- Term and Termination. a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 2. upon express reinstatement by the Licensor. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. Section 7 -- Other Terms and Conditions. a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. Section 8 -- Interpretation. a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. ======================================================================= Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. Creative Commons may be contacted at creativecommons.org. ================================================ FILE: README.md ================================================ # Spring '83 Welcome! This is a draft protocol intended to suggest new ways of relating online. If you are just discovering it, I recommend reading [this narrative description](https://www.robinsloan.com/lab/specifying-spring-83/). Don't miss my notes on [a summer spent operating the protocol with other people](https://www.robinsloan.com/lab/specifying-spring-83/#summer), either. This is speculative software intended to invite consideration and imagination; it doesn't have any "users", only co-investigators. This spec is now a historical artifact, but/and I hope it might prompt you to think about new ways of relating online. Most recent draft: * [Protocol specification](draft-20220629.md) Previous drafts: * [20220619](draft-20220616.md) * [20220609](draf-20220609.md) Here are the implementations I know about currently: * [The Kingswood Palimpsest](https://cyborg.rodeo/palimpsest/), a client * [rdmurphy/spring-board-element](https://github.com/rdmurphy/spring-board-element), a web component * [rpj/spring83](https://github.com/rpj/spring83), in JavaScript * [royragsdale/s83](https://github.com/royragsdale/s83), in Go * [motevets/springboard](https://github.com/motevets/springboard), in Go (running [here](https://spring83.kindrobot.ca)) * [michael-lazar/lets-dance](https://github.com/michael-lazar/lets-dance), in Python (with some great [notes](https://github.com/michael-lazar/lets-dance/blob/main/Notes.md)) * [pteichman/ahoy](https://github.com/pteichman/ahoy), in Go * [cellu_cc/so83-gpu](https://gitlab.com/cellu_cc/so83-gpu), on GitLab, in OpenCL 🤯 * [JohnB/spring83](https://github.com/JohnB/spring83), a client If you've implemented a client, server, or utility, at any level of completeness, and you would like me to list it here, let me know. This work is offered under a Creative Commons Attribution-ShareAlike license. ================================================ FILE: draft-20220609.md ================================================ # Spring '83 *Note: this is a first draft specification published in June 2022. You can find a narrative description of the protocol, and my contact information, [in this newsletter](https://www.robinsloan.com/lab/specifying-spring-83/).* *Note also: this draft has been superceded by the [June 16 version](https://github.com/robinsloan/spring-83-spec/blob/main/draft-20220616.md), which will be superceded in turn. But we are winding our way towards something final-ish...* ## Introduction Spring '83 is a protocol that allows users to follow publishers on the internet -- who might be people, computer programs, or anything else -- in a way that's simple, expressive, and predictable. The basic unit of the protocol is the board, which is an HTML fragment, limited to 2217 bytes, unable to execute JavaScript or load external resources, but otherwise unrestricted. Each publisher maintains just one board. There is no concept of a history; think instead of a whiteboard that is amended or erased. Spring '83 aspires to be: **Simple.** This means the protocol is easy to understand and implement, even for a non-expert programmer. **Expressive.** This means protocol embraces the richness, flexibility, and chaos of modern HTML and CSS. It does not formalize interactions and relationships into database schemas. (It also means the protocol doesn't provide any mechanism for replies, likes, favorites, or, indeed, feedback of any kind. Publishers are encouraged to use the full flexibility of HTML to develop their own approaches, inviting readers to respond via email, join a live chat, send a postcard... whatever!) **Predictable.** This means boards holds their place, maintaing a steady presence. It means also that clients only receive the boards they request, when they request them; there is no mechanism by which a server can "push" an unsolicited board. In addition, Spring '83 is **Federated.** This means it spans a network of servers operated by different people. The protocol is not, however, "trustless"; in Spring '83, connection requires conversation. Although the transmission portion of the protocol operates over HTTP/1.1, its approach to HTML storage is very different. Rather than store different boards on different servers, Spring '83 stores ALL the boards on EVERY server. The network converges to a consistent global state -- eventually; maybe -- using a simple gossip algorithm. Spring '83 draws inspiration from many existing protocols and technologies; you can read about these in Discussion 1. ## Implementation The key words "must", "must not", "required", "shall", "shall not", "should", "should not", "recommended", "may", and "optional" in this document are to be interpreted as described in RFC 2119. https://www.ietf.org/rfc/rfc2119.txt ## Terminology *board*: a fragment of HTML -- not necessarily a valid HTML5 document -- not more than 2217 bytes long, encoded in UTF-8. *publisher*: the entity responsible for specifying a board's content. *key*: a public key on the Ed25519 curve, formatted as 64 hex characters. *signature*: a public key signature, formatted as 128 hex characters. *client*: an application, web or standalone, that publishes, retrieves, and displays boards. *server*: an application, reachable on the public internet using a domain name, that receives, stores, and provides boards. *peer*: another server. *difficulty factor*: a server's current requirement for new keys *realm*: a set of peers, listed together in a YAML document reachable on the public internet. The default *realm* is defined at TKTK. ## Publishers and keys Publishers (who might be people, computer programs, or anything else) are identified and authorized by keypairs on the Ed25519 curve. The public part of the keypair, formatted as 64 hex characters, is the publisher's identifier, used to request their board from any available server. The secret part of the keypair allows the publisher alone to edit their board. Each keypair corresponds to exactly one board. Again, there is no concept of a history; think instead of a whiteboard that is amended or erased. Because a publisher is identified by their public key, boards are easy to verify. When a client requests a board for a particular *key*, the server might send an incorrect or modified response -- appending an advertisement, perhaps -- but the client will detect the invalid signature, drop the board, and mark the server as untrustworthy. See Discussion 2 for a consideration of the benefits (substantial) and drawbacks (likewise) of keypair identity schemes. ### Format requirements Keys are generated randomly, but they must fit a particular format; this functions as a simple Hashcash variation, providing a rudimentary form of abuse mitigation. Concocting a compatible key isn't instantaneous; it takes between a few seconds and a few minutes on modern hardware. To be used in Spring '83, a key's final six hex characters must match this regex: ``` /ed[0-9]{4}$/ ``` Furthermore, the final four characters, interpreted as a decimal number, must fall in the range 2022 .. 2099. That number has teeth. Keys are only valid in two calendar years: the year specified in their final four digits, and the year previous. For example, the key ``` 1c6ffef2825b294274478bad8c80a7a610d38245a9fded18cd004c4a67ed2023 ``` is valid between 2022-01-01T00:00:00:00Z and 2023-12-31T23:59:59Z. In this way, a key's final four characters represent its "expiration date". This requirement makes key rotation mandatory over the long term. Clients may implement features that make the process more convenient, but the recurring "stress test" on the publisher-follower link is a feature, not a bug. The goal is to keep Spring '83 relationships "live" and engaged, rather than weigh publishers down with zombie followers. (TKTK is this too much? I like it, but...) ## Boards in the client Much of the burden of the protocol falls on the client: to make requests on the user's behalf, store keypairs securely, and display boards safely. The client must: * limit incoming boards to 2217 bytes * validate each board's cryptographic signature * situate each board inside its own Shadow DOM The client must not: * execute any JavaScript included in the board * load any images, media, or fonts linked by the board These two requirements should be satisfied with a Content Security Policy. The client should: * allow users to manage a collection of followed keys * display each board in a region with an aspect ratio of either 1:sqrt(2) or sqrt(2):1 * make available to boards the Spring '83 suite of CSS variables, listed in TKTK * open links in new windows or tabs Other than the byte-size threshold and a timestamp requirement discussed below, Spring '83 places no limitations on the HTML content of a board. Knowing that the client will not execute JavaScript, publishers will probably not want to spend their precious bytes on inert code... but they are free to do so. Boards might be: * mini home pages, updated regularly with new work * lists of links to web pages recently read, perhaps with brief notes * daily logs, wiped clean each morning * yawlps to the universe Beyond the standards described above, Spring '83 doesn't specify how the client should display boards. For example, the client may: * allow users to explore overflowing boards by scrolling * apply post-processing effects to boards (e.g., a limited color palette) * organize boards according to an abstruse algorithm * handle links to Spring '83 keys in a helpful way Publishers should expect their boards to be placed on a 2D canvas alongside many others. ## Boards on the server Spring '83 servers are, in operation, very similar to "plain old web" servers, with a few additional behaviors. The server must * maintain a persistent store of boards * enforce a TTL, dropping boards over 28 days old * share newly-received boards with peers The transmission portion of Spring '83 operates over HTTP/1.1, using TLS, so it can be implemented easily using existing tools. A Spring '83 server must respond at the following HTTP endpoints: ``` PUT / GET / GET / ``` A server that provides boards to browsers will also need an appropriate OPTIONS endpoint to satisfy CORS, but that's not part of this specification. It's a pretty small API surface! We'll go through the endpoints one by one. ### Publishing boards: PUT /`` To publish a board, a client must send a request of this form: ``` PUT / HTTP/1.1 Content-Type: text/html;charset=utf-8 Spring-Version: 83 If-Unmodified-Since: Authorization: Spring-83 Signature= ``` Upon receipt, servers should validate the non-cryptographic part of the PUT request immediately, and, if necessary, respond with an error code. #### Verifying boards ##### Size If the board is larger than 2217 bytes, the server must reject the request with 413 Payload Too Large. ##### Timestamp The client must include the publishing timestamp in the If-Unmodified-Since header. If this value is older or equal to the timestamp of the server's version of the board, the server must reject the request with 409 Conflict. The If-Unmodified-Since header is transmitted as a convenience, to allow the server to "fail fast" if the request is out of date. However, because it's not cryptographically signed, the server can't rely on it entirely. The client must also include a last-modified meta tag in the board's HTML: ``` ``` It's important that the timestamp is transmitted this way, because it needs to be signed along with the rest of the board's HTML. The client may add the meta tag automatically, just before signing and transmitting the board. The server must reject the PUT request, returning 400 Bad Request, if * the board is transmitted without a last-modified meta tag; or * it is transmitted with more than one last-modified meta tag; or * its last-modified meta tag isn't parsable as an HTTP-format date and time; or * its last-modified meta tag is set to a date in the future. These criteria are EXTREMELY important. The last-modified meta tag modulates a board's change over time; if it gets screwed up, the publisher could lose the ability to update their board. ##### Cryptographic validity The server must verify that `` is a valid signature for the entire request body, exactly as transmitted. If the board isn't signed properly, the server should reject it, returning 401 Unauthorized. ##### Cryptographic difficulty If the current four-digit year is YYYY, and the previous four-digit year is YYYX, the server must only accept PUTs for keys that end with the four digits YYYY or YYYX, preceded in turn by the two hex digits "ed". This is the years-of-use requirement. The server must reject other keys with 400 Bad Request. Additionally, if the server doesn't have any board stored for ``, then it must apply another check. The key, interpreted as a 256-bit number, must be less than a threshold defined by the server's difficulty factor: ``` MAX_SIG = (2**256 - 1) key_threshold = MAX_SIG * ( 1.0 - difficulty_factor) ``` This check is not applied to keys for which the server already has a board stored. You can read more about the difficulty factor later in this document. ##### Final considerations Spring '83 specifies a test keypair: ``` public: fad415fbaa0339c4fd372d8287e50f67905321ccfd9c43fa4c20ac40afed1983 secret: a7e4d1c8be858d683ab9cb15574bd0bc3a87e6c846cdaf848da498909cb574f7 ``` Servers must not accept PUTs for this key, returning 401 Unauthorized. (See the section detailing GET /``, below, for more guidance.) The server may also use a denylist to block certain keys, rejecting all PUTs for those keys. If all the preceding checks are met, the server must store the board and share it with peers. ### Sharing boards: peer to peer PUT /`` A realm is a set of Spring '83 servers, specified by a YAML document reachable on the public internet. (The format of this document is TKTK.) There is no automatic or "trustless" way to join a realm; as with BGP, the foundational routing protocol of the internet, you gotta talk to somebody! Within a realm, Spring '83 servers communicate directly with each other, sharing new boards using a simple gossip algorithm. Their aim is to converge on a shared state of the realm, each server's copy exactly the same. In the froth of real activity, that will never actually happen -- but we can get pretty close. After receiving and verifying a new board from a client, the server must share it with N peers selected randomly from the realm. N is ``` min(round(total_peer_count * 0.5), 5) ``` New boards should be transmitted to peers asynchronously. The server must wait at least five minutes before sharing, but it may wait longer. In this way, the server acts as a buffer, absorbing and "compacting" rapid PUTs. To share a board with a peer, the server must transmit a PUT request similar to the one described above. Note the addition of the `Prefer: respond-async` header: ``` PUT / HTTP/1.1 Content-Type: text/html;charset=utf-8 Spring-Version: 83 Prefer: respond-async If-Unmodified-Since: Authorization: Spring-83 Signature= ``` When the server receives a PUT with the `respond-async` preference, it should respond immediately with 202 Accepted and place the board into a queue for asynchronous validation. (If the server doesn't have a task queue, it may respond synchronously.) If a peer is not reachable or responds with an error code, the server must wait for a minimum timeout of 5 minutes before attempting to contact that peer again. If the peer is still not reachable, the server must apply jittered exponential backoff, calculating each new timeout in this way: ``` new_timeout = current_timeout + current_timeout * random(0.0 .. 1.0) ``` The server should cap this timeout at some maximum; 7 days is recommended. #### Forgetting boards The server must store boards with a TTL. One week is recommended; the maximum TTL is 28 days. The server must provide identical responses to requests for * ``, for which it once stored a board, now deleted, and * ``, for which it never stored any board. Finally, the server must not enumerate keys or boards for any requester; the server must only respond to requests for specific keys. ## Difficulty factor: GET / Disk space is a concern for a protocol that allows anyone on the internet with a trivially-concocted cryptographic key to store a chunk of data, "for free", on a network of servers. Accordingly, a Spring '83 realm is limited to 10 million boards, for a maximum possible disk size of 22.17 gigabytes. (Ambitious servers might keep the whole thing in RAM!) This limit is enforced through a difficulty factor that draws inspiration from the mining difficulty factor used in many cryptocurrencies. Spring '83's difficulty factor ranges from 0.0 to 1.0, calculated in this way: ``` difficulty_factor = ( num_boards_stored / 10_000_000 )**4 ``` (TKTK is that the right exponent? Explain it, I suppose.) In normal operation, the server's difficulty factor is very close to 0.0, and boards for new keys are freely accepted. As the difficulty factor rises, the concoction of a suitable key becomes more time-consuming for prospective publishers. This has the effect of both (1) slowing the introduction of new keys, and (2) dissuading some publishers entirely. When the server's database maxes out at 10 million boards, the difficulty factor is 1.0, and the server does not accept any boards for keys it doesn't already know. Let's consider the example of a server that is already storing 8.5 million boards. ``` difficulty_factor = ( 8_500_000 / 10_000_000 )**4 = 0.52 ``` Using that difficulty factor, we can calculate the key threshold: ``` MAX_KEY = (2**256 - 1) key_threshold = MAX_KEY * ( 1.0 - 0.52 ) = ``` The server must reject PUT requests for new keys that are not less than ``. A client should determine a server's current difficulty factor using a request of this form: ``` GET / HTTP/1.1 Spring-Version: 83 ``` The server's response must take the form: ``` HTTP/1.1 200 OK Content-Length: Content-Type: text/html;charset=utf-8 Spring-Version: 83 Spring-Difficulty: ``` Using that information, the client can choose either to spend the time required to concoct a suitable key... or give up, and perhaps try another time. ### Retrieving boards: GET /`` Servers are not obligated to provide this endpoint for all requesters; they might provide it only to users of a particular client, or only to users who have paid for access, or according to any other scheme. Such schemes are beyond the scope of this specification, which describes the behavior of a publicly-available server. To retrieve the board for ``, a client must choose one or more servers to which it has access and transmit a request of this form: ``` GET / HTTP/1.1 Spring-Version: 83 If-Modified-Since: ``` If the server has a board for `` but it is not newer than the timestamp specified in If-Modified-Since, it must respond with 304 Not Modified. If the client omits If-Modified-Since, the server should return whatever board it has for ``, if it has one. The server's response must take the form: ``` HTTP/1.1 200 OK Content-Length: Content-Type: text/html;charset=utf-8 Spring-Version: 83 Authorization: Spring-83 Signature= ``` The client must verify that the `` is valid for `` and `` before processing or displaying the board. If the signature is not valid, the client must drop the response and remove the server from its list of trustworthy peers. (TKTK clients should assist servers with out-of-date boards.) Spring '83 specifies a test keypair: ``` public: fad415fbaa0339c4fd372d8287e50f67905321ccfd9c43fa4c20ac40afed1983 secret: a7e4d1c8be858d683ab9cb15574bd0bc3a87e6c846cdaf848da498909cb574f7 ``` Servers should respond to GETs for this key with an ever-changing board, generated internally, with a timestamp set to the time of the request. This board is provided to help client developers understand and troubleshoot their applications. ## Error code quick reference * 400: Board was submitted with impromper meta timestamp tags. * 401: Board was submitted without a valid signature. * 404: No board for this key found on this server. * 403: Board was submitted for a key that does not meet the difficulty factor. * 409: Board was submitted with a timestamp older than the server's timestamp for this key. * 513: Board is larger than 2217 bytes. ## Discussions ### 1: Inspirations This protocol draws inspiration * from Secure Scuttlebutt: the power of cryptographic keypairs as identities * from Hashcash: the notion of guarding server resources with client puzzles * from Ethereum: the gonzo strategy of storing the whole universe in one place * from ZeroTier: the spirit of "decentralize until it hurts, then centralize until it works". and, most of all, * from [the Quote of the Day Protocol](https://datatracker.ietf.org/doc/html/rfc865), defined by Jon Postel in May 1983: the vision of simplicity For those not familiar: QOTD operates over both TCP and UDP; the server responds to a TCP connection or a UDP datagram with a single brief message. In fact, I very badly wanted Spring '83 to operate over UDP -- responding to a request with, in some cases, a single datagram packet: beautiful -- but the architecture of the modern internet makes that much more difficult today than it was in 1983, and, anyway, there's a universe of capable tooling for HTTP. So, not without regret, Spring '83 goes with the flow. ### 2: The agony and ecstasy of public key cryptography There are a lot of reasons NOT to use cryptographic keypairs as identities, not least of which: the certainty that a user will eventually lose their secret key. But the profound magic trick of the signature: that it allows a piece of content to flow around the internet, handed from peer to peer, impossible to tamper with... it's too good to pass up. And the way public key cryptography allows anyone to "join" the system, without registering anywhere, simply by generating an appropriate keypair -- again, it's a trick so good it seems like it shouldn't work. The trapdoor function at the heart of public key cryptography is mirrored in the trapdoor of its user experience: once a secret key is lost or compromised, the identity is done. Game over. The system offers no customer support, because the system is math, and all the angels are busy assisting other callers. It's one of the harshest if/thens in all of computing, and a steep price to pay for the magic trick. Spring '83, given its other priorities and constraints, is willing to pay that price -- but only barely. The compromise is mandatory key rotation, enforced with the years-of-use requirement. This policy suggests, "you're going to lose your private key eventually... why not lose it now?" and uses that loss as a mechanism to strengthen, rather than weaken, the network. Beyond that, there is plenty of space for Spring '83 clients to offer hosted ("custodial") private keys, abstracting the keypair behind a more traditional username/password. ================================================ FILE: draft-20220616.md ================================================ # Spring '83 > *Discussion: This is an updated draft specification published in June 2022. You can find a narrative description of the protocol, and my contact information, [in this newsletter](https://www.robinsloan.com/lab/specifying-spring-83/).* ## Introduction Spring '83 is a protocol that allows users to follow publishers on the internet -- who might be people, computer programs, or anything else -- in a way that's simple, expressive, and predictable. The basic unit of the protocol is the board, which is an HTML fragment, limited to [2217 bytes](http://info.cern.ch/hypertext/WWW/TheProject.html), unable to execute JavaScript or load external resources, but otherwise unrestricted. Each publisher maintains just one board. There is no concept of a history; think instead of a whiteboard that is amended or erased. Spring '83 aspires to be: **Simple.** This means the protocol is easy to understand and implement, even for a non-expert programmer. **Expressive.** This means the protocol embraces the richness, flexibility, and chaos of modern HTML and CSS. It does not formalize interactions and relationships into database schemas. (It also means the protocol doesn't provide any mechanism for replies, likes, favorites, or, indeed, feedback of any kind. Publishers are encouraged to use the flexibility of HTML to develop their own approaches, inviting readers to respond via email, join a live chat, send a postcard... whatever!) **Predictable.** This means boards holds their place, maintaining a steady presence. It means also that clients only receive the boards they request, when they request them; there is no mechanism by which a server can "push" an unsolicited board. In addition, Spring '83 is **Federated.** This means boards live on different servers operated by different people. It means also that groups of peers share boards with one another, a strategy intended to support exploration and analysis of the full "board flow". Spring '83 draws inspiration from many existing protocols and technologies; you can read about these in Discussion 1. ## Implementation The key words "must", "must not", "required", "shall", "shall not", "should", "should not", "recommended", "may", and "optional" in this document are to be interpreted as described in RFC 2119. https://www.ietf.org/rfc/rfc2119.txt ## Terminology *board*: a fragment of HTML, not necessarily a valid HTML5 document, not more than 2217 bytes long, encoded in UTF-8. *publisher*: the entity responsible for specifying a board's content. *key*: a public key on the Ed25519 curve, formatted as 64 hex characters. *signature*: a public key signature, formatted as 128 hex characters. *client*: an application, web or standalone, that publishes, retrieves, and displays boards. *server*: an application, reachable on the public internet, that accepts requests from clients to publish and retrieve boards. *listener*: an application, reachable on the public internet, that receives boards not from clients but from servers, subscribing to the full "board flow" through a realm. (The listener's possible reasons for doing this are described later.) *peer*: a server or listener. *realm*: a group of peers who have agreed to circulate the full "board flow" using a simple gossip algorithm. *difficulty factor*: a server's current requirement for new boards. ## Publishers, keys, and servers Publishers -- who might be people, computer programs, or anything else -- are identified and authorized by keypairs on the Ed25519 curve. The public part of the keypair, formatted as 64 hex characters, is the publisher's identifier, used to request their board from the server. The secret part of the keypair allows the publisher alone to edit their board. See Discussion 2 for a consideration of the benefits (substantial) and drawbacks (likewise) of keypair identity schemes. Each keypair corresponds to exactly one board. Again, there is no concept of a history; think instead of a whiteboard that is amended or erased. Every publisher has a home server to which they transmit their board, and from which clients generally retrieve it. Publishers can always migrate to a new home server, taking their key with them. (This process is described in the section on clients, below.) Because a publisher is identified by their key, boards are easy to verify. When a client requests a board for a particular key, the server might send an incorrect or modified response -- inserting an advertisement, perhaps -- but the client will detect the invalid signature, drop the board, and mark the server as untrustworthy. Keys are globally unique, and they act as "coordination-free" identifiers, similar to UUIDs. Publishers don't need to register with any central authority. Instead, they need only to generate a keypair on the Ed25519 curve that conforms to a format requirement and then select, or start, a home server. > *Aside:* The use of keys for identification and authorization is, like many things in this protocol, motivated partially by a desire to keep implementation easy and stateless for server programmers and operators. Who wants to manage a complete login system? And send password reset emails? Not me! A server is identified by a domain name and, optionally, a path. The transmission protocol is an HTTP API over TLS; therefore, the full URL for a board is ``` https://// ``` For example, a board currently hosted on the server `bogbody.biz` would be identified as ``` https://bogbody.biz/ca93846ae61903a862d44727c16fed4b80c0522cab5e5b8b54763068b83e0623 ``` > Discussion: A client may allow users to follow Spring '83 publishers alongside RSS feeds and other resources. In these situations, the client should distinguish Spring '83 URLs with a regex that recognizes conforming keys, or simply by making a request and noting the presence of a Spring-Version header. > The ambiguity of Spring '83 URLs is somewhat intentional; they are just HTML fragments, and users can always preview them in a web browser. ### Generating conforming keys The protocol imposes a format requirement on keys. The content of Ed25519 keypairs is mostly (but not totally) random, so conforming keys can only be generated by trial and error. The format requirement accomplishes two things at once: 1. It presents a "client puzzle" which requires a one-time investment of compute resources to "solve". Like [Hashcash](http://www.hashcash.org/), this provides a rudimentary form of abuse mitigation: a malicious publisher cannot generate conforming keys instantly and endlessly. 2. It "bakes" some useful metadata into the key itself. A conforming key's final seven hex characters must be `83e` followed by four characters that, interpreted as MMYY, express a valid month and year in the range 01/00 .. 12/99. Formally, the key must match this regex: ``` /83e(0[1-9]|1[0-2])(\d\d)$/ ``` Again, a conforming keypair can only be generated by trial and error. On a single thread in an Apple M1 chip, this is accomplished in tens of minutes, not seconds or less. > *Aside:* I am not totally sure it's impossible to "program" the content of an Ed25519 public key, particularly if you abandon security considerations. My impression is that [it can't be done](https://crypto.stackexchange.com/questions/3596/is-it-possible-to-pick-your-ed25519-public-key), but I could be wrong. If you have any insight into this, let me know. This format requirement could always be applied instead to the SHA-256 hash of the key. The date "encoded" in those final four characters has teeth: the key is only valid in the two years preceding it, and expires at the end of the last day of the month specified. (This is analogous to a [credit card expiration date](https://en.wikipedia.org/wiki/ISO/IEC_7813#Physical_characteristics).) For example, the key ``` ca93846ae61903a862d44727c16fed4b80c0522cab5e5b8b54763068b83e0623 ``` has an encoded expiration date of 0623, or 06/2023. This key is valid between 2021-06-01T00:00:00:00Z and 2023-07-01T00:00:00Z. This expiration policy makes key rotation mandatory over the long term. Clients may implement features that make the process more convenient, even automatic, but the recurring "stress test" on the publisher-follower link is a feature, not a bug. The goal is to keep Spring '83 relationships "live" and engaged, with fresh opt-ins every two years at most. The policy suggests, "you're going to lose your secret key eventually... why not lose it now?" and uses that loss as a mechanism to strengthen, rather than weaken, the network. ### Discovering keys The process of discovering a particular publisher's key, or discovering keys to follow generally, is not part of this specification. However, it is presumed that a home page or profile page might contain a `` element analogous to the kind used to specify RSS feeds. A client scanning a web page for an associated board should look for `` elements with the `type` attribute set to `text/board+html`. ``` ``` ## Boards in the client Much of the burden of the protocol falls on the client: to store a user's keypair securely, allow them to manage a collection of followed keys, and display boards safely. The client must: * limit incoming boards to 2217 bytes * verify each board's cryptographic signature * situate each board inside its own Shadow DOM The client must not: * execute any JavaScript included in the board * load any images, media, or fonts linked by the board These two requirements should be satisfied with a [Content Security Policy](https://content-security-policy.com/). The design of this policy is not part of this specification, but here's an example that works for a simple web-based client: ``` default-src 'none'; style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self'; form-action *; connect-src *; ``` It's important to allow `unsafe-inline` CSS so boards can style themselves! > *Aside:* Yes, HTML forms are allowed -- unless someone explains to me why this is a horrible idea 😝 > *Aside:* The prohibition against images and other external resources is a matter of privacy and safety. Privacy, because it prevents the use of tracking pixels and other "transponders". Safety, because it lowers the stakes for malicious and illegal content. However, it is totally possible to imagine a future version of this protocol, Spring '84 or beyond, in which > * a particular domain could be added to the CSP, providing a shared image catalog, analogous to the funky clip art choices offered to purchasers of classified ads. "You can use any pic you want, as long as it's on [bukk.it](https://bukk.it/)!" > * or, images and other external resources could simply be permitted. The client should: * display each board in a region with an aspect ratio of either 1:sqrt(2) or sqrt(2):1 * make available to boards the Spring '83 suite of CSS variables, listed in TKTK * open links in new windows or tabs Spring '83 places no limitations on the HTML content of a board. Knowing that the client will not execute JavaScript, publishers will probably not want to spend their precious bytes on inert code... but they are free to do so. Boards might be: * mini home pages, updated regularly with new work * lists of links to web pages recently read, perhaps with brief notes * daily logs, wiped clean each morning * yawlps to the universe Beyond the standards described above, Spring '83 doesn't specify how the client should display boards. For example, the client may: * allow users to explore overflowing boards by scrolling * organize boards according to an abstruse algorithm * handle links to boards in a helpful way, even "transcluding" them (!) Publishers should expect their boards to be placed on a 2D canvas alongside many others. ### Boards with special client instructions Clients should scan for the `` element: ``` ``` This element is used by publishers to migrate from key to key and server to server. When the client finds a `` element, it should retrieve the board at the URL, verify it normally, and update its record of the publisher's home server and/or key accordingly. The board should contain only one one `` element. If it contains more than one, the client must honor the first and ignore the rest. The client may also scan for arbitrary data stored in `data-spring-*` attributes throughout the board. These attributes and their uses will be defined by publishers and client developers. ## Boards on the server Spring '83 servers are, in operation, very similar to "plain old web" servers, with a few additional behaviors. The server must * maintain a persistent store of boards * enforce a TTL, dropping boards over 22 days old * share newly-received boards with listeners The transmission portion of Spring '83 operates over HTTP, using TLS, so it can be implemented easily using existing tools. A Spring '83 server must respond at the following HTTP endpoints: ``` OPTIONS PUT / GET / GET / ``` That's a pretty small API surface! We'll go through the endpoints one by one. ### Serving clients: OPTIONS Many clients will, by dint of being web apps, depend on CORS to retrieve boards from non-origin servers. Servers must support preflight OPTIONS requests to all endpoints, replying with: ``` HTTP/1.1 204 No Content Access-Control-Allow-Methods: GET, PUT, OPTIONS Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Content-Type, If-Modified-Since, Spring-Signature, Spring-Version Access-Control-Expose-Headers: Content-Type, Last-Modified, Spring-Difficulty, Spring-Signature, Spring-Version ``` ### Publishing boards: PUT /`` To publish a board, a client must send a request of this form: ``` PUT / HTTP/1.1 Content-Type: text/html;charset=utf-8 Spring-Version: 83 Spring-Signature: ``` Upon receipt, servers should check the non-cryptographic part of the PUT request immediately, and, if necessary, respond with an error code. #### Checking boards ##### Size If the board is larger than 2217 bytes, the server must reject the PUT request with 413 Payload Too Large. ##### Timestamp The timestamp is transmitted as part of the board HTML. The client must include a `