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 /<key>
GET /
GET /<key>
```
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 /`<key>`
To publish a board, a client must send a request of this form:
```
PUT /<key> HTTP/1.1
Content-Type: text/html;charset=utf-8
Spring-Version: 83
If-Unmodified-Since: <date and time in HTTP format>
Authorization: Spring-83 Signature=<signature>
<board>
```
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:
```
<meta http-equiv="last-modified" content="<date and time in HTTP format>">
```
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 `<signature>` 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 `<key>`, 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 /`<key>`, 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 /`<key>`
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 /<key> HTTP/1.1
Content-Type: text/html;charset=utf-8
Spring-Version: 83
Prefer: respond-async
If-Unmodified-Since: <timestamp>
Authorization: Spring-83 Signature=<signature>
<board>
```
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
* `<key A>`, for which it once stored a board, now deleted, and
* `<key B>`, 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 ) = <an inscrutable gigantic number>
```
The server must reject PUT requests for new keys that are not less than `<an inscrutable gigantic number>`.
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: <length>
Content-Type: text/html;charset=utf-8
Spring-Version: 83
Spring-Difficulty: <difficulty factor>
<arbitrary HTML greeting>
```
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 /`<key>`
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 `<key>`, a client must choose one or more servers to which it has access and transmit a request of this form:
```
GET /<key> HTTP/1.1
Spring-Version: 83
If-Modified-Since: <HTTP formatted timestamp>
```
If the server has a board for `<key>` 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 `<key>`, if it has one.
The server's response must take the form:
```
HTTP/1.1 200 OK
Content-Length: <length>
Content-Type: text/html;charset=utf-8
Spring-Version: 83
Authorization: Spring-83 Signature=<signature>
<board>
```
The client must verify that the `<signature>` is valid for `<key>` and `<board>` 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://<host>/<path>/<key>
```
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 `<link>` element analogous to the kind used to specify RSS feeds. A client scanning a web page for an associated board should look for `<link>` elements with the `type` attribute set to `text/board+html`.
```
<link rel="alternate" type="text/board+html" href="https://bogbody.biz/ca93846ae61903a862d44727c16fed4b80c0522cab5e5b8b54763068b83e0623" />
```
## 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 `<link rel="next">` element:
```
<link rel="next" href="<URL>">
```
This element is used by publishers to migrate from key to key and server to server. When the client finds a `<link rel="next">` 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 `<link rel="next">` 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 /<key>
GET /
GET /<key>
```
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 /`<key>`
To publish a board, a client must send a request of this form:
```
PUT /<key> HTTP/1.1
Content-Type: text/html;charset=utf-8
Spring-Version: 83
Spring-Signature: <signature>
<board>
```
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 `<time>` element with its `datetime` attribute set to a UTC timestamp in ISO 8601 format, without milliseconds: `YYYY-MM-DDTHH:MM:SSZ`.
For the convenience of server implementers, the `<time>` element must fit the following format exactly; "valid HTML" is not sufficient:
```
<time datetime="YYYY-MM-DDTHH:MM:SSZ"></time>
```
The client should append the `<time>` element to the beginning of the board, allowing the server to "match fast".
The `<time>` element should have a closing tag. It may have text content. The client should include default CSS that hides the element; a publisher may choose to override that CSS, revealing it.
> *Aside:* Is this too fiddly? I am trying to save server implementers the trouble of running full HTML parsers!
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 should add the `<time>` element automatically, just before signing and transmitting the board.
The server must reject the PUT request, returning 400 Bad Request, if
* the request is transmitted without a `<time>` element; or
* its `<time>` element's `datetime` attribute is not a UTC timestamp in ISO 8601 format; or
* its `<time>` element's `datetime` attribute is set to a timestamp in the future.
The board should contain only one `<time>` element. If it contains more than one, the server must honor the first and ignore the rest.
If the board's timestamp is older than or equal to the timestamp of the server's version of the board, the server must reject the request, returning 409 Conflict.
These criteria are EXTREMELY important. The `<time>` element 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 `<signature>` is `<key>`'s valid signature for the board, exactly as transmitted. If the board isn't properly signed, the server must reject the request, returning 401 Unauthorized.
##### Conforming keys
The key format requirements are described earlier in this specification, and reproduced here for convenience.
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)$/
```
If the key does not match that regex, the server must reject the request, returning 403 Forbidden.
The key is only valid in the two years preceding its encoded expiration date, and expires at the end of the last day of the month specified. For example, the key
```
c761fd8e4abc6ee4ca6d0883a95b7f0c88d33835a085b382dfbfb435283e0623
```
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.
If the key has expired or is set to a date more than two years in the future, the server must reject the request, returning 403 Forbidden.
##### Difficulty factor
If the server doesn't yet have any board stored for the key, then it must apply an additional check. The key's first 16 hex characters, interpreted as a 64-bit number, must be less than a threshold defined by the server's difficulty factor:
```
MAX_KEY_64 = (2**64 - 1)
key_64_threshold = round(MAX_KEY_64 * ( 1.0 - difficulty_factor))
```
If the key fails this check, the server must reject the PUT request, returning 403 Forbidden.
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 specification.)
If the difficulty factor is `1.0`, the server must reject all PUT requests for new boards.
> *Aside:* The difficulty factor check only operates on the key's first 64 bits for convenience, avoiding the use of special "big number" data types. JavaScript developers will, however, still have to use BigInt.
##### Final considerations
Spring '83 defines a test keypair:
```
public: ab589f4dde9fce4180fcf42c7b05185b0a02a5d682e353fa39177995083e0583
secret: 3371f8b011f51632fea33ed0a3688c26a45498205c6097c352bd4d079d224419
```
Servers must reject PUT requests for this key, returning 401 Unauthorized. (See the section detailing GET /`<key>`, below, for additional guidance.)
The server may use a denylist to block certain keys, rejecting all PUTs for those keys.
> *Aside:* It's likely this would be a shared denylist, but I don't yet have a proposal for how that would operate. It fits into the realm, of course, and feels like part of the contract: you get to be included in the "board flow", but/and you need to honor this shared denylist. Where is the list stored? How is it updated? Does efficient matching become a problem if a denylist has 100,000 entries? Lots of puzzles here.
If the preceding checks are all met, the server must store the board and share it with listeners in its realm.
### Listeners and realms: peer-to-peer PUT /`<key>`
> *ALERT:* This section is extremely fiddly, and none of it is implemented in my demo server. I am leaving the text intact for the sake of discussion, but feel free to skip it.
A realm is a group of Spring '83 servers and listeners who have agreed to circulate new boards using a simple gossip algorithm. It provides a framework for aggregating "the whole network" in one place, something that's otherwise difficult to do in a federated system.
Why would a listener want to join a realm and receive all its PUT requests? Well, with access to full "board flow", the listener could
* scan boards and produce a report of top links across the realm
* calculate algorithmic “who to follow” recommendations and offer them to anyone who might be interested
* scan for malicious or illegal content and alert server operators
In this way, listeners can add new "features" to the protocol.
A realm is described by a UTF-8 text document reachable on the public internet. Each of the document's lines lists one server. Lines containing only whitespace must be ignored. Lines that begin with `#` are comments and must be ignored. For example, the file `https://spring83.net/supreme.txt` might describe a very small realm:
```
# behold, the Realm Supreme
# to join, email robin@robinsloan.com
bogbody.biz
working.directory
publisher.pizza
# well, maybe it's not so Supreme
```
> *Aside:* This is where I got frustrated and gave up on this section, at least for the time being. I feel like servers and listeners in a realm really ought to be able to authenticate each other's requests... but does that require each to have a public key listed in this text document? And to calculate an additional signature for all the boards they circulate? Suddenly, this is feeling sort of "heavy" and, perhaps, stupid.
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!
In the section below, the term "peer" means servers, who receive PUT requests from clients, AND listeners, who receive PUT requests from servers.
The peer should belong to one realm. It may belong to zero or many, but the protocol's design favors one. A server that belongs to zero realms can still store a publisher's board without any problem, providing it to clients of all kinds; it just won't provide that board to any listeners.
After receiving and verifying a new board, the peer must share it with N listeners selected randomly from the realm. N is
```
min(round(total_peer_count * 0.5), 5)
```
New boards should be transmitted to listeners asynchronously. The server should wait at least five minutes before sharing, and it may wait longer. In this way, the server can act as a buffer, absorbing and "compacting" rapid PUTs.
To share a board with a listener, the server must transmit a PUT request exactly like the one described above.
When the listener receives a PUT, it should respond immediately with 202 Accepted and place the board into a queue for asynchronous processing. (If the listener doesn't have a queue, it may respond synchronously.)
If a listener 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 listener again. If the listener is still not reachable, the server must apply a jittered backoff strategy. The server should cap its timeout at some maximum; one hour is recommended.
> *Relief*: It's over. Thank goodness.
### Difficulty factor: GET /
Spring '83 is intended to invite participation from people with "normal" compute resources, whether that means a home server with a public IP address or a free-tier cloud instance. The protocol includes, therefore, a mechanism to apply "backpressure" to publishers, slowing or stopping the creation of new boards.
The difficulty factor is a decimal number in the range 0.0 .. 1.0, and is calculated based on the maximum number of boards the server would like to store. As described earlier in this specification, the difficulty factor is used to apply an extra (and potentially quite stringent) check on new boards.
> *Aside:* It's very possible that none of this is needed. Instead, when a server is under stress, it could just flip the sign on the door: CLOSED! Aha, yes, there's an elegant algorithm for you.
> Besides, the format requirement already imposes a substantial "cost" on the creation of new boards. Ugh, but this was so CLEVER. We are in "kill your darlings" territory here...
The calculation of the difficulty factor is not part of this specification, but here's an example formula that works well:
```
difficulty_factor = ( num_boards_stored / max_boards )**4
```
The exponent is included because the difficulty factor is only intended to dissuade new boards "at the margin"; after all, we're here to store and provide HTML, aren't we?
Let's consider the example of a server that is currently storing 60,000 boards and would like to store, at most, 100,000.
```
difficulty_factor = ( 60_000 / 100_000 )**4 = 0.1296
```
Using that difficulty factor, we can calculate the key threshold:
```
MAX_KEY_64 = (2**64 - 1)
key_64_threshold = MAX_KEY_64 * ( 1.0 - 0.1296 ) = <a 64-bit number>
```
The server must check the key's first 64 bits against that 64-bit number, as described earlier in this specification.
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-Type: text/html;charset=utf-8
Spring-Version: 83
Spring-Difficulty: <difficulty factor>
<server greeting>
```
Using that information, the client can choose either to spend the time required to generate a conforming key... or give up, and perhaps try later.
### Retrieving boards: GET /`<key>`
To retrieve the board for `<key>` from its home server, the client must transmit a request of this form:
```
GET /<key> HTTP/1.1
Spring-Version: 83
If-Modified-Since: <date and time in UTC, RFC 5322 format>
```
If the server has a board for `<key>` 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 `<key>`, if it has one.
The server's response must take the form:
```
HTTP/1.1 200 OK
Content-Type: text/html;charset=utf-8
Spring-Version: 83
Last-Modified: <date and time in UTC, HTTP (RFC 5322) format>
Spring-Signature: <signature>
<board>
```
The client must verify that `<signature>` is `<key>`'s valid signature for the board, exactly as transmitted. If the board isn't signed properly, the client must drop the response. It should communicate to the user that the server is either faulty or dishonest.
Spring '83 specifies a test keypair:
```
public: ab589f4dde9fce4180fcf42c7b05185b0a02a5d682e353fa39177995083e0583
secret: 3371f8b011f51632fea33ed0a3688c26a45498205c6097c352bd4d079d224419
```
The server should respond to GET requests 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.
#### Forgetting boards
The server must store boards with a TTL of, at most, 22 days.
The server must provide identical responses to requests for
* `<key A>`, for which it once stored a board, now deleted, and
* `<key B>`, 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.
## Error code quick reference
* 400: Board was submitted with an impromper timestamp.
* 401: Board was submitted without a valid signature.
* 403: Board was submitted for a non-conforming key.
* 404: No board for this key found on this server.
* 409: Board was submitted with a timestamp older than the server's timestamp for this key.
* 413: 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 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 move through the internet, handed from server to server, 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 time-of-use requirement. This 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.
Beyond that, there is plenty of space for Spring '83 clients to offer hosted ("custodial") secret keys, abstracting the keypair behind a more traditional username and password.
================================================
FILE: draft-20220629.md
================================================
# Spring '83
> *Note:* This is an updated draft specification published at the tail end of June 2022. It's the result of lots of correspondence, some private, some public, that resulted in many clarifications... and just as many deletions. That's good editing!
> This is being posted for discussion -- definitely do not implement anything in here yet!
## 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.
> *Aside:* If 2217 bytes is enough for [the first web page](http://info.cern.ch/hypertext/WWW/TheProject.html), it's enough for us.
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.
**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.
(Going further, the protocol doesn't provide any mechanism for replies, likes, favorites, or, indeed, feedback of any kind. Publishers are invited to use the flexibility of HTML to develop their own approaches, inviting readers to respond via email, submit a form, mail a postcard... whatever!)
In addition, Spring '83 is
**Federated.** This means boards are stored on different servers operated by different people.
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 HTML5, 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.
## 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.
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 a modified response -- inserting an advertisement, perhaps -- but the client will detect the invalid signature and ignore the board.
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 publish their first board to the server of their choice.
In this way, the keypair provides the identity and authorization "API" for the protocol, and the key becomes a consistent identity that publishers can move between servers.
> *Aside:* The choice of the keypair is also, like several features of this protocol, motivated by a desire to keep implementation easy and stateless. Who wants to manage a complete login system? And send password reset emails? Not me!
A server is identified by a hostname and, optionally, a path. Spring '83 is an HTTP API over TLS; therefore, the URL used to retrieve a board is
```
https://<hostname>/<path?>/<key>
```
For example, a board hosted on the server `bogbody.biz` is available at this URL:
```
https://bogbody.biz/ca93846ae61903a862d44727c16fed4b80c0522cab5e5b8b54763068b83e0623
```
### Generating conforming keys
The protocol imposes a format requirement on keys. The content of Ed25519 keypairs is mostly 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. Using a single thread in an Apple M1 chip, this is accomplished in tens of minutes. Using many threads, it is accomplished in minutes, not seconds.
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 to publishers, "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 board URL, or discovering board URLs to follow generally, is not part of this specification.
However, it is presumed that a home page or profile page might contain a `<link>` element analogous to the kind used to specify RSS feeds. A client scanning a web page for an associated board should look for `<link>` elements with the `type` attribute set to `text/board+html`.
```
<link rel="alternate" type="text/board+html" href="https://bogbody.biz/ca93846ae61903a862d44727c16fed4b80c0522cab5e5b8b54763068b83e0623" />
```
## 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 board URLs, and display boards safely.
The client must:
* reject boards larger than 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:* The prohibition against images and other external resources is a matter of privacy, safety, and charisma. Privacy, because it prevents the use of tracking pixels and other "transponders". Safety, because it lowers the stakes for malicious and illegal content. Charisma, because images are so rich and appealing, they blot out everything else!
> A future version of this protocol (Spring '84?) will support images, video, and/or audio, but I think it's worthwhile, at this time, to explore new "ways of relating" with those particular nozzles still shut.
> Once they open, there's no going back!
The element that encloses the Shadow DOM must be set to `display: block`.
Preparing each board for display in its Shadow DOM, the client should prepend this default CSS:
```
<style>
:host {
position: relative;
background-color: <some light, desaturated color>;
box-sizing: border-box;
padding: 2rem;
}
time { display: none; }
p, h1, h2, h3, h4, h5 { margin: 0 0 2rem 0; }
</style>
```
The board's inline CSS may override any of those rules. It may also "reset the world":
```
:host {
all: initial;
}
```
The client should:
* provide at least one mode in which boards are juxtaposed on a 2D canvas
* present boards in an aspect ratio of roughly `1:sqrt(2)` or `sqrt(2):1`
* open links in new windows or tabs
Beyond the standards described above, Spring '83 doesn't specify how the client should display boards. For example, the client may:
* provide a mode in which boards can be viewed one at a time
* organize boards according to an abstruse algorithm
* handle links to board URLs in a helpful way, even "transcluding" them (!)
The protocol places no limitations on the HTML content of a board. Yes, forms are allowed! 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:
* ephemeral notes about web pages recently read
* weekly logs, wiped clean on Monday morning
* yawlps to the universe
Publishers should expect their boards to be placed on a 2D canvas alongside many others. They should also expect their boards to be presented in an aspect ratio of `1:sqrt(2)` or `sqrt(2):1`, although clients may display them differently.
### Boards with special instructions
Clients should scan board HTML for the `<link rel="next">` element:
```
<link rel="next" href="<board URL>">
```
This element is used by publishers to migrate from key to key and server to server. When the client finds a `<link rel="next">` element, it should retrieve the board at the URL specified, verify it normally, and either (a) notify the user, or (b) automatically update its record of the board's URL.
A board should contain only one `<link rel="next">` element. If it contains more than one, the client must honor the first and ignore the rest.
The new board specified by a `<link rel="next">` element must not, itself, have a `<link rel="next">` element. If it does, the client must cancel the migration, ignoring the new board.
The client may also scan for data stored in `meta` tags and `data-spring-*` attributes throughout the board. These fields 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 and enforce a TTL, which must be not less than 7 days and not more than 22 days.
The transmission portion of Spring '83 operates over HTTP, using TLS, so it can be implemented easily using existing tools. The examples below use HTTP/1.1, but transmission over HTTP/2 and HTTP/3 is permitted.
A Spring '83 server must respond at the following HTTP endpoints:
```
OPTIONS
GET /
PUT /<key>
GET /<key>
DELETE /<key>
```
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 (1) support preflight OPTIONS requests, and (2) add the appropriate CORS headers to all responses:
```
HTTP/1.1 204 No Content
Access-Control-Allow-Methods: GET, OPTIONS, PUT
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-Signature, Spring-Version
```
### Introducing yourself: GET /
The server must provide a valid HTML page at its base URL containing, at minimum:
* its operator's contact information
* its current board TTL
* a rough assessment of its robustness and availability
* an articulation of its publishing standards
### Publishing boards: PUT /`<key>`
Publishers will generally select a home server that they consider reliable and trustworthy. To publish a board, the client must send that server a request of this form:
```
PUT /<key> HTTP/1.1
Content-Type: text/html;charset=utf-8
Spring-Version: 83
Spring-Signature: <signature>
<board>
```
Upon receipt, the server must check the non-cryptographic part of the PUT request immediately, and, if necessary, return 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 `<time>` element with its `datetime` attribute set to a UTC timestamp in ISO 8601 format, sans milliseconds: `YYYY-MM-DDTHH:MM:SSZ`.
For the convenience of server implementers, the `<time>` element's opening tag must fit the following format exactly; "valid HTML" is not sufficient:
```
<time datetime="YYYY-MM-DDTHH:MM:SSZ">
```
The `<time>` element may have text content, or it may be empty. Clients should hide the element by default; the board may include CSS that reveals it.
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 should add the `<time>` element automatically, just before signing and transmitting the board.
The board should contain only one `<time>` element. If it contains more than one, the server must honor the first and ignore the rest.
The server must reject the PUT request, returning 400 Bad Request, if
* the request is transmitted without a `<time>` element; or
* the element's `datetime` attribute is not a UTC timestamp in the ISO 8601 format described above; or
* the element's `datetime` attribute contains a timestamp in the future; or
* the element's `datetime` attribute contains a timestamp more than 22 days in the past.
If the incoming board's timestamp is older than or equal to the timestamp of the server's version of the board, the server must reject the request, returning 409 Conflict.
These criteria are EXTREMELY important. The `<time>` element modulates a board's change over time; if it gets screwed up, the publisher could lose the ability to update their board.
##### Key format
The key format requirements are described earlier in this specification, and reproduced here for convenience.
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)$/
```
If the key does not match that regex, the server must reject the request, returning 403 Forbidden.
The key is only valid in the two years preceding its encoded expiration date, and expires at the end of the last day of the month specified. For example, the key
```
c761fd8e4abc6ee4ca6d0883a95b7f0c88d33835a085b382dfbfb435283e0623
```
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.
If the key has expired, or indicates a date more than two years in the future, the server must reject the request, returning 403 Forbidden.
##### Cryptographic validity
The server must verify that `<signature>` is `<key>`'s valid signature for the board, exactly as transmitted. If the board isn't properly signed, the server must reject the request, returning 401 Unauthorized.
##### A special case
Spring '83 defines a test keypair:
```
public: ab589f4dde9fce4180fcf42c7b05185b0a02a5d682e353fa39177995083e0583
secret: 3371f8b011f51632fea33ed0a3688c26a45498205c6097c352bd4d079d224419
```
Servers must reject PUT requests for this key, returning 401 Unauthorized. (See the section on GET /`<key>`, below, for more guidance.)
#### Denying boards
The server must implement a denylist. If `<key>` is on the server's denylist, it must reject the request, returning 403 Forbidden.
The protocol defines an infernal key:
```
d17eef211f510479ee6696495a2589f7e9fb055c2576749747d93444883e0123
```
which the server must deny, returning 403 Forbidden. This is to validate it has implemented a denylist.
#### Storing boards
If the preceding checks are all met, the server must store the board with a TTL of, at most, 22 days.
If the server is busy, it may decline the PUT request, returning 429 Too Many Requests.
#### "Deleting" boards
The protocol does not provide a DELETE endpoint.
Instead, the publisher should transmit a PUT request for a board containing nothing except the `<time>` element, as described above.
> *Aside:* This limitation has to do with the protocol's cryptographic infrastructure. A malicious user can replace a deleted board with a copy of a previous version. To prevent this, we need a "tombstone" with a proper timestamp: the empty board.
The server should interpret a stored board containing nothing but a `<time>` element as "missing" and return 404 Not Found.
The server may provide this empty board to requesters until it expires -- at most, 22 days later -- at which point, the server must return 404 Not Found.
#### Displaying boards
Outside the context of a specific PUT request, the server must not display or enumerate boards unless those boards, or their publishers, have been reviewed and approved by its operator.
So, for example, if the operator wishes to display a list of recently updated boards on the server's home page, they may do so -- if they (a) have reviewed those boards, or (b) know and trust their publishers.
> *Aside:* The logic here is simple: an unknown board from an unknown publisher might contain anything! Displaying arbitrary -- possibly malicious -- content goes against the protocol's value of predictability, its "pull-only" design.
### Retrieving boards: GET /`<key>`
The client must transmit a request of this form:
```
GET /<key> HTTP/1.1
Spring-Version: 83
If-Modified-Since: <date and time in UTC, RFC 5322 format>
```
If the server does not have a board for `<key>`, it must return 404 Not Found.
If the server has a board for `<key>` but it is not newer than the timestamp specified in If-Modified-Since, it must return 304 Not Modified.
If the client omits If-Modified-Since, the server should return whatever board it has for `<key>`, if it has one.
The server's response must take the form:
```
HTTP/1.1 200 OK
Content-Type: text/html;charset=utf-8
Spring-Version: 83
Last-Modified: <date and time in UTC, HTTP (RFC 5322) format>
Spring-Signature: <signature>
<board>
```
The client must verify that `<signature>` is `<key>`'s valid signature for the board, exactly as transmitted. If the board isn't signed properly, the client must drop the response. It should communicate to the user that the server is either faulty or dishonest.
The `Last-Modified` header is provided for proxies that "speak HTTP"; the client should not consider it authoritative, attending instead to the `<time>` element included in the board HTML.
If the server is busy, it may decline the GET request, returning 429 Too Many Requests.
If the server is unreachable, or returns an error code, the client must wait for a minimum timeout of 5 minutes before attempting to contact that peer again. If the server is still not reachable, the client must apply a jittered backoff strategy. The client should cap its timeout at some maximum; one hour is recommended.
#### Serving web browsers
If the server receives a request without a `Spring-Version` header -- indicating it did not come from a client aware of the protocol -- it may serve the requested board "wrapped" in a simple, informative HTML document.
> *Aside:* Yes, this "tempers" with the board's HTML... but the web browser wasn't going to verify its signature anyway! A scrap of context -- "This is a Spring '83 board; here's a link to an appropriate client" -- helps bring viewers into the Spring '83 ecosystem.
This is optional; the server may also provide the raw board HTML.
#### Forgetting boards
The server must store boards with a TTL of, at most, 22 days.
> *Aside:* 22 is a magic number.
The server must provide identical responses to requests for
* `<key A>`, for which it once stored a board, now expired or deleted, and
* `<key B>`, for which it never stored any board.
#### Helping developers
Spring '83 specifies a test keypair:
```
public: ab589f4dde9fce4180fcf42c7b05185b0a02a5d682e353fa39177995083e0583
secret: 3371f8b011f51632fea33ed0a3688c26a45498205c6097c352bd4d079d224419
```
The server should respond to GET requests for this key with an ever-changing board, generated internally, signed appropriately, with a timestamp set to the time of the request. This board is provided to help client developers understand and troubleshoot their applications.
> *Aside:* This test keypair technically expired a long time ago, so servers will have to add special logic to recognize and handle it.
## Error code quick reference
* 400: Board was submitted with an impromper timestamp.
* 401: Board was submitted without a valid signature.
* 403: Board was submitted for a non-conforming, expired, or blocked key.
* 404: No board for this key found on this server.
* 409: Board was transmitted with a timestamp older than the server's timestamp for this board.
* 413: 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 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 move through the internet, handed from server to server, 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 expiration policy.
Beyond that, there is plenty of space for Spring '83 clients to offer hosted ("custodial") secret keys, abstracting the keypair behind a more traditional username and password.
================================================
FILE: simulate.cr
================================================
struct Peer
property data
property already_shared
property num_inbound
property evil
def initialize(
@data : Int32,
@already_shared : Bool,
@num_inbound : Int32,
@evil : Bool
)
end
end
module Sim
extend self
DESIRED_DATA = 99
NUM_PEERS = 1000
NUM_SAMPLED = 5
PROPORTION_EVIL = 0.1
@@peers = Array(Peer).new
def convergence_ratio
num_with_data = 0
@@peers.each do |peer|
if peer.data == DESIRED_DATA
num_with_data += 1
end
end
return (num_with_data.to_f / NUM_PEERS.to_f).significant(2)
end
def propagate
bandwidth = 0
wasted = 0
new_peers = @@peers.dup
NUM_PEERS.times do |index|
peer = @@peers[index]
if peer.data == DESIRED_DATA && !peer.already_shared && !peer.evil
# Share with sampled peers
NUM_SAMPLED.times do
r_index = (Random.rand * NUM_PEERS).to_i
bandwidth += 1
if @@peers[r_index].data == DESIRED_DATA
wasted += 1
new_peers[r_index] = Peer.new(
@@peers[r_index].data,
@@peers[r_index].already_shared,
@@peers[r_index].num_inbound + 1,
@@peers[r_index].evil
)
else
new_num_inbound = @@peers[r_index].num_inbound + 1
new_peers[r_index] = Peer.new(
DESIRED_DATA,
@@peers[r_index].already_shared,
new_num_inbound,
@@peers[r_index].evil
)
end
end
# Mark that I shared with sampled peers
new_peers[index] = Peer.new(DESIRED_DATA, true, peer.num_inbound, peer.evil)
end
end
@@peers = new_peers
return {bandwidth, wasted}
end
def run
avg_steps = 0
avg_bandwidth = 0
avg_inbound_per_peer = 0
avg_wasted = 0
did_not_converge = 0
max_inbound_per_peer = 0
50.times do |n|
puts "---"
puts "Run #{n}"
@@peers = Array(Peer).new
NUM_PEERS.times do |i|
evil = Random.rand < PROPORTION_EVIL ? true : false
new_peer = Peer.new(0, false, 0, evil)
@@peers.push(new_peer)
end
@@peers[0] = Peer.new(DESIRED_DATA, false, 0, false)
steps = 0
bandwidth = 0
wasted = 0
while steps < 100
added_bandwidth, added_wasted = propagate
bandwidth += added_bandwidth
wasted += added_wasted
convergence = convergence_ratio
puts "Step #{steps}: #{convergence}"
if convergence >= 1.0
break
end
steps += 1
end
if steps >= 100
did_not_converge += 1
end
inbound_per_peer = 0
@@peers.each do |peer|
inbound_per_peer += peer.num_inbound
if (peer.num_inbound > max_inbound_per_peer)
max_inbound_per_peer = peer.num_inbound
end
end
inbound_per_peer /= @@peers.size
if (avg_inbound_per_peer == 0)
avg_inbound_per_peer = inbound_per_peer
else
avg_inbound_per_peer = (avg_inbound_per_peer + inbound_per_peer) / 2.0
end
if (avg_steps == 0)
avg_steps = steps
else
avg_steps = (avg_steps + steps) / 2.0
end
if (avg_bandwidth == 0)
avg_bandwidth = bandwidth
else
avg_bandwidth = (avg_bandwidth + bandwidth) / 2.0
end
if (avg_wasted == 0)
avg_wasted = wasted
else
avg_wasted = (avg_wasted + wasted) / 2.0
end
end
puts "Num did not converge: #{did_not_converge}"
puts "Avg inbound reqs per peer: #{avg_inbound_per_peer}"
puts "Max inbound reqs for any peer, in any run: #{max_inbound_per_peer}"
puts "Avg time steps: #{avg_steps}"
puts "Avg bandwidth: #{avg_bandwidth}"
puts "Avg wasted bandwidth: #{avg_wasted}"
puts "which is multiplier of #{(avg_bandwidth / NUM_PEERS).significant(1)}X direct"
end
end
Sim.run
gitextract_saknyp78/ ├── LICENSE-CC-BY-SA.md ├── README.md ├── draft-20220609.md ├── draft-20220616.md ├── draft-20220629.md └── simulate.cr
Condensed preview — 6 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (106K chars).
[
{
"path": "LICENSE-CC-BY-SA.md",
"chars": 20127,
"preview": "Attribution-ShareAlike 4.0 International\n\n=======================================================================\n\nCreat"
},
{
"path": "README.md",
"chars": 1860,
"preview": "# Spring '83\n\nWelcome! This is a draft protocol intended to suggest new ways of relating online. If you are just discove"
},
{
"path": "draft-20220609.md",
"chars": 21581,
"preview": "# Spring '83\n\n*Note: this is a first draft specification published in June 2022. You can find a narrative description of"
},
{
"path": "draft-20220616.md",
"chars": 30095,
"preview": "# Spring '83\n\n> *Discussion: This is an updated draft specification published in June 2022. You can find a narrative des"
},
{
"path": "draft-20220629.md",
"chars": 25290,
"preview": "# Spring '83\n\n> *Note:* This is an updated draft specification published at the tail end of June 2022. It's the result o"
},
{
"path": "simulate.cr",
"chars": 3957,
"preview": "struct Peer\n property data\n property already_shared\n property num_inbound\n property evil\n\n def initialize(\n @dat"
}
]
About this extraction
This page contains the full source code of the robinsloan/spring-83 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 6 files (100.5 KB), approximately 23.6k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.