├── README.md ├── simulate.cr ├── LICENSE-CC-BY-SA.md ├── draft-20220609.md ├── draft-20220629.md └── draft-20220616.md /README.md: -------------------------------------------------------------------------------- 1 | # Spring '83 2 | 3 | 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. 4 | 5 | This is speculative software intended to invite consideration and imagination; it doesn't have any "users", only co-investigators. 6 | 7 | This spec is now a historical artifact, but/and I hope it might prompt you to think about new ways of relating online. 8 | 9 | Most recent draft: 10 | 11 | * [Protocol specification](draft-20220629.md) 12 | 13 | Previous drafts: 14 | 15 | * [20220619](draft-20220616.md) 16 | * [20220609](draf-20220609.md) 17 | 18 | Here are the implementations I know about currently: 19 | 20 | * [The Kingswood Palimpsest](https://cyborg.rodeo/palimpsest/), a client 21 | * [rdmurphy/spring-board-element](https://github.com/rdmurphy/spring-board-element), a web component 22 | * [rpj/spring83](https://github.com/rpj/spring83), in JavaScript 23 | * [royragsdale/s83](https://github.com/royragsdale/s83), in Go 24 | * [motevets/springboard](https://github.com/motevets/springboard), in Go (running [here](https://spring83.kindrobot.ca)) 25 | * [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)) 26 | * [pteichman/ahoy](https://github.com/pteichman/ahoy), in Go 27 | * [cellu_cc/so83-gpu](https://gitlab.com/cellu_cc/so83-gpu), on GitLab, in OpenCL 🤯 28 | * [JohnB/spring83](https://github.com/JohnB/spring83), a client 29 | 30 | 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. 31 | 32 | This work is offered under a Creative Commons Attribution-ShareAlike license. -------------------------------------------------------------------------------- /simulate.cr: -------------------------------------------------------------------------------- 1 | struct Peer 2 | property data 3 | property already_shared 4 | property num_inbound 5 | property evil 6 | 7 | def initialize( 8 | @data : Int32, 9 | @already_shared : Bool, 10 | @num_inbound : Int32, 11 | @evil : Bool 12 | ) 13 | end 14 | end 15 | 16 | module Sim 17 | extend self 18 | DESIRED_DATA = 99 19 | NUM_PEERS = 1000 20 | NUM_SAMPLED = 5 21 | 22 | PROPORTION_EVIL = 0.1 23 | 24 | @@peers = Array(Peer).new 25 | 26 | def convergence_ratio 27 | num_with_data = 0 28 | @@peers.each do |peer| 29 | if peer.data == DESIRED_DATA 30 | num_with_data += 1 31 | end 32 | end 33 | 34 | return (num_with_data.to_f / NUM_PEERS.to_f).significant(2) 35 | end 36 | 37 | def propagate 38 | bandwidth = 0 39 | wasted = 0 40 | new_peers = @@peers.dup 41 | 42 | NUM_PEERS.times do |index| 43 | peer = @@peers[index] 44 | 45 | if peer.data == DESIRED_DATA && !peer.already_shared && !peer.evil 46 | # Share with sampled peers 47 | NUM_SAMPLED.times do 48 | r_index = (Random.rand * NUM_PEERS).to_i 49 | bandwidth += 1 50 | if @@peers[r_index].data == DESIRED_DATA 51 | wasted += 1 52 | 53 | new_peers[r_index] = Peer.new( 54 | @@peers[r_index].data, 55 | @@peers[r_index].already_shared, 56 | @@peers[r_index].num_inbound + 1, 57 | @@peers[r_index].evil 58 | ) 59 | else 60 | new_num_inbound = @@peers[r_index].num_inbound + 1 61 | new_peers[r_index] = Peer.new( 62 | DESIRED_DATA, 63 | @@peers[r_index].already_shared, 64 | new_num_inbound, 65 | @@peers[r_index].evil 66 | ) 67 | end 68 | end 69 | 70 | # Mark that I shared with sampled peers 71 | new_peers[index] = Peer.new(DESIRED_DATA, true, peer.num_inbound, peer.evil) 72 | end 73 | end 74 | 75 | @@peers = new_peers 76 | return {bandwidth, wasted} 77 | end 78 | 79 | def run 80 | avg_steps = 0 81 | avg_bandwidth = 0 82 | avg_inbound_per_peer = 0 83 | avg_wasted = 0 84 | did_not_converge = 0 85 | 86 | max_inbound_per_peer = 0 87 | 88 | 50.times do |n| 89 | puts "---" 90 | puts "Run #{n}" 91 | 92 | @@peers = Array(Peer).new 93 | 94 | NUM_PEERS.times do |i| 95 | evil = Random.rand < PROPORTION_EVIL ? true : false 96 | new_peer = Peer.new(0, false, 0, evil) 97 | @@peers.push(new_peer) 98 | end 99 | 100 | @@peers[0] = Peer.new(DESIRED_DATA, false, 0, false) 101 | 102 | steps = 0 103 | bandwidth = 0 104 | wasted = 0 105 | 106 | while steps < 100 107 | added_bandwidth, added_wasted = propagate 108 | bandwidth += added_bandwidth 109 | wasted += added_wasted 110 | convergence = convergence_ratio 111 | puts "Step #{steps}: #{convergence}" 112 | if convergence >= 1.0 113 | break 114 | end 115 | steps += 1 116 | end 117 | 118 | if steps >= 100 119 | did_not_converge += 1 120 | end 121 | 122 | inbound_per_peer = 0 123 | 124 | @@peers.each do |peer| 125 | inbound_per_peer += peer.num_inbound 126 | if (peer.num_inbound > max_inbound_per_peer) 127 | max_inbound_per_peer = peer.num_inbound 128 | end 129 | end 130 | 131 | inbound_per_peer /= @@peers.size 132 | 133 | if (avg_inbound_per_peer == 0) 134 | avg_inbound_per_peer = inbound_per_peer 135 | else 136 | avg_inbound_per_peer = (avg_inbound_per_peer + inbound_per_peer) / 2.0 137 | end 138 | 139 | if (avg_steps == 0) 140 | avg_steps = steps 141 | else 142 | avg_steps = (avg_steps + steps) / 2.0 143 | end 144 | 145 | if (avg_bandwidth == 0) 146 | avg_bandwidth = bandwidth 147 | else 148 | avg_bandwidth = (avg_bandwidth + bandwidth) / 2.0 149 | end 150 | 151 | if (avg_wasted == 0) 152 | avg_wasted = wasted 153 | else 154 | avg_wasted = (avg_wasted + wasted) / 2.0 155 | end 156 | end 157 | 158 | puts "Num did not converge: #{did_not_converge}" 159 | puts "Avg inbound reqs per peer: #{avg_inbound_per_peer}" 160 | puts "Max inbound reqs for any peer, in any run: #{max_inbound_per_peer}" 161 | puts "Avg time steps: #{avg_steps}" 162 | puts "Avg bandwidth: #{avg_bandwidth}" 163 | puts "Avg wasted bandwidth: #{avg_wasted}" 164 | puts "which is multiplier of #{(avg_bandwidth / NUM_PEERS).significant(1)}X direct" 165 | end 166 | end 167 | 168 | Sim.run 169 | -------------------------------------------------------------------------------- /LICENSE-CC-BY-SA.md: -------------------------------------------------------------------------------- 1 | Attribution-ShareAlike 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More_considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution-ShareAlike 4.0 International Public 58 | License 59 | 60 | By exercising the Licensed Rights (defined below), You accept and agree 61 | to be bound by the terms and conditions of this Creative Commons 62 | Attribution-ShareAlike 4.0 International Public License ("Public 63 | License"). To the extent this Public License may be interpreted as a 64 | contract, You are granted the Licensed Rights in consideration of Your 65 | acceptance of these terms and conditions, and the Licensor grants You 66 | such rights in consideration of benefits the Licensor receives from 67 | making the Licensed Material available under these terms and 68 | conditions. 69 | 70 | 71 | Section 1 -- Definitions. 72 | 73 | a. Adapted Material means material subject to Copyright and Similar 74 | Rights that is derived from or based upon the Licensed Material 75 | and in which the Licensed Material is translated, altered, 76 | arranged, transformed, or otherwise modified in a manner requiring 77 | permission under the Copyright and Similar Rights held by the 78 | Licensor. For purposes of this Public License, where the Licensed 79 | Material is a musical work, performance, or sound recording, 80 | Adapted Material is always produced where the Licensed Material is 81 | synched in timed relation with a moving image. 82 | 83 | b. Adapter's License means the license You apply to Your Copyright 84 | and Similar Rights in Your contributions to Adapted Material in 85 | accordance with the terms and conditions of this Public License. 86 | 87 | c. BY-SA Compatible License means a license listed at 88 | creativecommons.org/compatiblelicenses, approved by Creative 89 | Commons as essentially the equivalent of this Public License. 90 | 91 | d. Copyright and Similar Rights means copyright and/or similar rights 92 | closely related to copyright including, without limitation, 93 | performance, broadcast, sound recording, and Sui Generis Database 94 | Rights, without regard to how the rights are labeled or 95 | categorized. For purposes of this Public License, the rights 96 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 97 | Rights. 98 | 99 | e. Effective Technological Measures means those measures that, in the 100 | absence of proper authority, may not be circumvented under laws 101 | fulfilling obligations under Article 11 of the WIPO Copyright 102 | Treaty adopted on December 20, 1996, and/or similar international 103 | agreements. 104 | 105 | f. Exceptions and Limitations means fair use, fair dealing, and/or 106 | any other exception or limitation to Copyright and Similar Rights 107 | that applies to Your use of the Licensed Material. 108 | 109 | g. License Elements means the license attributes listed in the name 110 | of a Creative Commons Public License. The License Elements of this 111 | Public License are Attribution and ShareAlike. 112 | 113 | h. Licensed Material means the artistic or literary work, database, 114 | or other material to which the Licensor applied this Public 115 | License. 116 | 117 | i. Licensed Rights means the rights granted to You subject to the 118 | terms and conditions of this Public License, which are limited to 119 | all Copyright and Similar Rights that apply to Your use of the 120 | Licensed Material and that the Licensor has authority to license. 121 | 122 | j. Licensor means the individual(s) or entity(ies) granting rights 123 | under this Public License. 124 | 125 | k. Share means to provide material to the public by any means or 126 | process that requires permission under the Licensed Rights, such 127 | as reproduction, public display, public performance, distribution, 128 | dissemination, communication, or importation, and to make material 129 | available to the public including in ways that members of the 130 | public may access the material from a place and at a time 131 | individually chosen by them. 132 | 133 | l. Sui Generis Database Rights means rights other than copyright 134 | resulting from Directive 96/9/EC of the European Parliament and of 135 | the Council of 11 March 1996 on the legal protection of databases, 136 | as amended and/or succeeded, as well as other essentially 137 | equivalent rights anywhere in the world. 138 | 139 | m. You means the individual or entity exercising the Licensed Rights 140 | under this Public License. Your has a corresponding meaning. 141 | 142 | 143 | Section 2 -- Scope. 144 | 145 | a. License grant. 146 | 147 | 1. Subject to the terms and conditions of this Public License, 148 | the Licensor hereby grants You a worldwide, royalty-free, 149 | non-sublicensable, non-exclusive, irrevocable license to 150 | exercise the Licensed Rights in the Licensed Material to: 151 | 152 | a. reproduce and Share the Licensed Material, in whole or 153 | in part; and 154 | 155 | b. produce, reproduce, and Share Adapted Material. 156 | 157 | 2. Exceptions and Limitations. For the avoidance of doubt, where 158 | Exceptions and Limitations apply to Your use, this Public 159 | License does not apply, and You do not need to comply with 160 | its terms and conditions. 161 | 162 | 3. Term. The term of this Public License is specified in Section 163 | 6(a). 164 | 165 | 4. Media and formats; technical modifications allowed. The 166 | Licensor authorizes You to exercise the Licensed Rights in 167 | all media and formats whether now known or hereafter created, 168 | and to make technical modifications necessary to do so. The 169 | Licensor waives and/or agrees not to assert any right or 170 | authority to forbid You from making technical modifications 171 | necessary to exercise the Licensed Rights, including 172 | technical modifications necessary to circumvent Effective 173 | Technological Measures. For purposes of this Public License, 174 | simply making modifications authorized by this Section 2(a) 175 | (4) never produces Adapted Material. 176 | 177 | 5. Downstream recipients. 178 | 179 | a. Offer from the Licensor -- Licensed Material. Every 180 | recipient of the Licensed Material automatically 181 | receives an offer from the Licensor to exercise the 182 | Licensed Rights under the terms and conditions of this 183 | Public License. 184 | 185 | b. Additional offer from the Licensor -- Adapted Material. 186 | Every recipient of Adapted Material from You 187 | automatically receives an offer from the Licensor to 188 | exercise the Licensed Rights in the Adapted Material 189 | under the conditions of the Adapter's License You apply. 190 | 191 | c. No downstream restrictions. You may not offer or impose 192 | any additional or different terms or conditions on, or 193 | apply any Effective Technological Measures to, the 194 | Licensed Material if doing so restricts exercise of the 195 | Licensed Rights by any recipient of the Licensed 196 | Material. 197 | 198 | 6. No endorsement. Nothing in this Public License constitutes or 199 | may be construed as permission to assert or imply that You 200 | are, or that Your use of the Licensed Material is, connected 201 | with, or sponsored, endorsed, or granted official status by, 202 | the Licensor or others designated to receive attribution as 203 | provided in Section 3(a)(1)(A)(i). 204 | 205 | b. Other rights. 206 | 207 | 1. Moral rights, such as the right of integrity, are not 208 | licensed under this Public License, nor are publicity, 209 | privacy, and/or other similar personality rights; however, to 210 | the extent possible, the Licensor waives and/or agrees not to 211 | assert any such rights held by the Licensor to the limited 212 | extent necessary to allow You to exercise the Licensed 213 | Rights, but not otherwise. 214 | 215 | 2. Patent and trademark rights are not licensed under this 216 | Public License. 217 | 218 | 3. To the extent possible, the Licensor waives any right to 219 | collect royalties from You for the exercise of the Licensed 220 | Rights, whether directly or through a collecting society 221 | under any voluntary or waivable statutory or compulsory 222 | licensing scheme. In all other cases the Licensor expressly 223 | reserves any right to collect such royalties. 224 | 225 | 226 | Section 3 -- License Conditions. 227 | 228 | Your exercise of the Licensed Rights is expressly made subject to the 229 | following conditions. 230 | 231 | a. Attribution. 232 | 233 | 1. If You Share the Licensed Material (including in modified 234 | form), You must: 235 | 236 | a. retain the following if it is supplied by the Licensor 237 | with the Licensed Material: 238 | 239 | i. identification of the creator(s) of the Licensed 240 | Material and any others designated to receive 241 | attribution, in any reasonable manner requested by 242 | the Licensor (including by pseudonym if 243 | designated); 244 | 245 | ii. a copyright notice; 246 | 247 | iii. a notice that refers to this Public License; 248 | 249 | iv. a notice that refers to the disclaimer of 250 | warranties; 251 | 252 | v. a URI or hyperlink to the Licensed Material to the 253 | extent reasonably practicable; 254 | 255 | b. indicate if You modified the Licensed Material and 256 | retain an indication of any previous modifications; and 257 | 258 | c. indicate the Licensed Material is licensed under this 259 | Public License, and include the text of, or the URI or 260 | hyperlink to, this Public License. 261 | 262 | 2. You may satisfy the conditions in Section 3(a)(1) in any 263 | reasonable manner based on the medium, means, and context in 264 | which You Share the Licensed Material. For example, it may be 265 | reasonable to satisfy the conditions by providing a URI or 266 | hyperlink to a resource that includes the required 267 | information. 268 | 269 | 3. If requested by the Licensor, You must remove any of the 270 | information required by Section 3(a)(1)(A) to the extent 271 | reasonably practicable. 272 | 273 | b. ShareAlike. 274 | 275 | In addition to the conditions in Section 3(a), if You Share 276 | Adapted Material You produce, the following conditions also apply. 277 | 278 | 1. The Adapter's License You apply must be a Creative Commons 279 | license with the same License Elements, this version or 280 | later, or a BY-SA Compatible License. 281 | 282 | 2. You must include the text of, or the URI or hyperlink to, the 283 | Adapter's License You apply. You may satisfy this condition 284 | in any reasonable manner based on the medium, means, and 285 | context in which You Share Adapted Material. 286 | 287 | 3. You may not offer or impose any additional or different terms 288 | or conditions on, or apply any Effective Technological 289 | Measures to, Adapted Material that restrict exercise of the 290 | rights granted under the Adapter's License You apply. 291 | 292 | 293 | Section 4 -- Sui Generis Database Rights. 294 | 295 | Where the Licensed Rights include Sui Generis Database Rights that 296 | apply to Your use of the Licensed Material: 297 | 298 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 299 | to extract, reuse, reproduce, and Share all or a substantial 300 | portion of the contents of the database; 301 | 302 | b. if You include all or a substantial portion of the database 303 | contents in a database in which You have Sui Generis Database 304 | Rights, then the database in which You have Sui Generis Database 305 | Rights (but not its individual contents) is Adapted Material, 306 | 307 | including for purposes of Section 3(b); and 308 | c. You must comply with the conditions in Section 3(a) if You Share 309 | all or a substantial portion of the contents of the database. 310 | 311 | For the avoidance of doubt, this Section 4 supplements and does not 312 | replace Your obligations under this Public License where the Licensed 313 | Rights include other Copyright and Similar Rights. 314 | 315 | 316 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 317 | 318 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 319 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 320 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 321 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 322 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 323 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 324 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 325 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 326 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 327 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 328 | 329 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 330 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 331 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 332 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 333 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 334 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 335 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 336 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 337 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 338 | 339 | c. The disclaimer of warranties and limitation of liability provided 340 | above shall be interpreted in a manner that, to the extent 341 | possible, most closely approximates an absolute disclaimer and 342 | waiver of all liability. 343 | 344 | 345 | Section 6 -- Term and Termination. 346 | 347 | a. This Public License applies for the term of the Copyright and 348 | Similar Rights licensed here. However, if You fail to comply with 349 | this Public License, then Your rights under this Public License 350 | terminate automatically. 351 | 352 | b. Where Your right to use the Licensed Material has terminated under 353 | Section 6(a), it reinstates: 354 | 355 | 1. automatically as of the date the violation is cured, provided 356 | it is cured within 30 days of Your discovery of the 357 | violation; or 358 | 359 | 2. upon express reinstatement by the Licensor. 360 | 361 | For the avoidance of doubt, this Section 6(b) does not affect any 362 | right the Licensor may have to seek remedies for Your violations 363 | of this Public License. 364 | 365 | c. For the avoidance of doubt, the Licensor may also offer the 366 | Licensed Material under separate terms or conditions or stop 367 | distributing the Licensed Material at any time; however, doing so 368 | will not terminate this Public License. 369 | 370 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 371 | License. 372 | 373 | 374 | Section 7 -- Other Terms and Conditions. 375 | 376 | a. The Licensor shall not be bound by any additional or different 377 | terms or conditions communicated by You unless expressly agreed. 378 | 379 | b. Any arrangements, understandings, or agreements regarding the 380 | Licensed Material not stated herein are separate from and 381 | independent of the terms and conditions of this Public License. 382 | 383 | 384 | Section 8 -- Interpretation. 385 | 386 | a. For the avoidance of doubt, this Public License does not, and 387 | shall not be interpreted to, reduce, limit, restrict, or impose 388 | conditions on any use of the Licensed Material that could lawfully 389 | be made without permission under this Public License. 390 | 391 | b. To the extent possible, if any provision of this Public License is 392 | deemed unenforceable, it shall be automatically reformed to the 393 | minimum extent necessary to make it enforceable. If the provision 394 | cannot be reformed, it shall be severed from this Public License 395 | without affecting the enforceability of the remaining terms and 396 | conditions. 397 | 398 | c. No term or condition of this Public License will be waived and no 399 | failure to comply consented to unless expressly agreed to by the 400 | Licensor. 401 | 402 | d. Nothing in this Public License constitutes or may be interpreted 403 | as a limitation upon, or waiver of, any privileges and immunities 404 | that apply to the Licensor or You, including from the legal 405 | processes of any jurisdiction or authority. 406 | 407 | 408 | ======================================================================= 409 | 410 | Creative Commons is not a party to its public 411 | licenses. Notwithstanding, Creative Commons may elect to apply one of 412 | its public licenses to material it publishes and in those instances 413 | will be considered the “Licensor.” The text of the Creative Commons 414 | public licenses is dedicated to the public domain under the CC0 Public 415 | Domain Dedication. Except for the limited purpose of indicating that 416 | material is shared under a Creative Commons public license or as 417 | otherwise permitted by the Creative Commons policies published at 418 | creativecommons.org/policies, Creative Commons does not authorize the 419 | use of the trademark "Creative Commons" or any other trademark or logo 420 | of Creative Commons without its prior written consent including, 421 | without limitation, in connection with any unauthorized modifications 422 | to any of its public licenses or any other arrangements, 423 | understandings, or agreements concerning use of licensed material. For 424 | the avoidance of doubt, this paragraph does not form part of the 425 | public licenses. 426 | 427 | Creative Commons may be contacted at creativecommons.org. 428 | -------------------------------------------------------------------------------- /draft-20220609.md: -------------------------------------------------------------------------------- 1 | # Spring '83 2 | 3 | *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/).* 4 | 5 | *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...* 6 | 7 | ## Introduction 8 | 9 | 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. 10 | 11 | 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. 12 | 13 | Each publisher maintains just one board. There is no concept of a history; think instead of a whiteboard that is amended or erased. 14 | 15 | Spring '83 aspires to be: 16 | 17 | **Simple.** This means the protocol is easy to understand and implement, even for a non-expert programmer. 18 | 19 | **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. 20 | 21 | (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!) 22 | 23 | **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. 24 | 25 | In addition, Spring '83 is 26 | 27 | **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. 28 | 29 | 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. 30 | 31 | Spring '83 draws inspiration from many existing protocols and technologies; you can read about these in Discussion 1. 32 | 33 | ## Implementation 34 | 35 | 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. 36 | 37 | https://www.ietf.org/rfc/rfc2119.txt 38 | 39 | ## Terminology 40 | 41 | *board*: a fragment of HTML -- not necessarily a valid HTML5 document -- not more than 2217 bytes long, encoded in UTF-8. 42 | 43 | *publisher*: the entity responsible for specifying a board's content. 44 | 45 | *key*: a public key on the Ed25519 curve, formatted as 64 hex characters. 46 | 47 | *signature*: a public key signature, formatted as 128 hex characters. 48 | 49 | *client*: an application, web or standalone, that publishes, retrieves, and displays boards. 50 | 51 | *server*: an application, reachable on the public internet using a domain name, that receives, stores, and provides boards. 52 | 53 | *peer*: another server. 54 | 55 | *difficulty factor*: a server's current requirement for new keys 56 | 57 | *realm*: a set of peers, listed together in a YAML document reachable on the public internet. The default *realm* is defined at TKTK. 58 | 59 | ## Publishers and keys 60 | 61 | 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. 62 | 63 | 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. 64 | 65 | 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. 66 | 67 | See Discussion 2 for a consideration of the benefits (substantial) and drawbacks (likewise) of keypair identity schemes. 68 | 69 | ### Format requirements 70 | 71 | 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. 72 | 73 | To be used in Spring '83, a key's final six hex characters must match this regex: 74 | 75 | ``` 76 | /ed[0-9]{4}$/ 77 | ``` 78 | 79 | Furthermore, the final four characters, interpreted as a decimal number, must fall in the range 2022 .. 2099. 80 | 81 | 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 82 | 83 | ``` 84 | 1c6ffef2825b294274478bad8c80a7a610d38245a9fded18cd004c4a67ed2023 85 | ``` 86 | 87 | is valid between 2022-01-01T00:00:00:00Z and 2023-12-31T23:59:59Z. 88 | 89 | In this way, a key's final four characters represent its "expiration date". 90 | 91 | 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. 92 | 93 | (TKTK is this too much? I like it, but...) 94 | 95 | ## Boards in the client 96 | 97 | 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. 98 | 99 | The client must: 100 | 101 | * limit incoming boards to 2217 bytes 102 | * validate each board's cryptographic signature 103 | * situate each board inside its own Shadow DOM 104 | 105 | The client must not: 106 | 107 | * execute any JavaScript included in the board 108 | * load any images, media, or fonts linked by the board 109 | 110 | These two requirements should be satisfied with a Content Security Policy. 111 | 112 | The client should: 113 | 114 | * allow users to manage a collection of followed keys 115 | * display each board in a region with an aspect ratio of either 1:sqrt(2) or sqrt(2):1 116 | * make available to boards the Spring '83 suite of CSS variables, listed in TKTK 117 | * open links in new windows or tabs 118 | 119 | 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. 120 | 121 | Boards might be: 122 | 123 | * mini home pages, updated regularly with new work 124 | * lists of links to web pages recently read, perhaps with brief notes 125 | * daily logs, wiped clean each morning 126 | * yawlps to the universe 127 | 128 | Beyond the standards described above, Spring '83 doesn't specify how the client should display boards. For example, the client may: 129 | 130 | * allow users to explore overflowing boards by scrolling 131 | * apply post-processing effects to boards (e.g., a limited color palette) 132 | * organize boards according to an abstruse algorithm 133 | * handle links to Spring '83 keys in a helpful way 134 | 135 | Publishers should expect their boards to be placed on a 2D canvas alongside many others. 136 | 137 | ## Boards on the server 138 | 139 | Spring '83 servers are, in operation, very similar to "plain old web" servers, with a few additional behaviors. 140 | 141 | The server must 142 | 143 | * maintain a persistent store of boards 144 | * enforce a TTL, dropping boards over 28 days old 145 | * share newly-received boards with peers 146 | 147 | The transmission portion of Spring '83 operates over HTTP/1.1, using TLS, so it can be implemented easily using existing tools. 148 | 149 | A Spring '83 server must respond at the following HTTP endpoints: 150 | 151 | ``` 152 | PUT / 153 | GET / 154 | GET / 155 | ``` 156 | 157 | 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. 158 | 159 | It's a pretty small API surface! We'll go through the endpoints one by one. 160 | 161 | ### Publishing boards: PUT /`` 162 | 163 | To publish a board, a client must send a request of this form: 164 | 165 | ``` 166 | PUT / HTTP/1.1 167 | Content-Type: text/html;charset=utf-8 168 | Spring-Version: 83 169 | If-Unmodified-Since: 170 | Authorization: Spring-83 Signature= 171 | 172 | 173 | ``` 174 | 175 | Upon receipt, servers should validate the non-cryptographic part of the PUT request immediately, and, if necessary, respond with an error code. 176 | 177 | #### Verifying boards 178 | 179 | ##### Size 180 | 181 | If the board is larger than 2217 bytes, the server must reject the request with 413 Payload Too Large. 182 | 183 | ##### Timestamp 184 | 185 | 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. 186 | 187 | 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. 188 | 189 | The client must also include a last-modified meta tag in the board's HTML: 190 | 191 | ``` 192 | 193 | ``` 194 | 195 | 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. 196 | 197 | The server must reject the PUT request, returning 400 Bad Request, if 198 | 199 | * the board is transmitted without a last-modified meta tag; or 200 | * it is transmitted with more than one last-modified meta tag; or 201 | * its last-modified meta tag isn't parsable as an HTTP-format date and time; or 202 | * its last-modified meta tag is set to a date in the future. 203 | 204 | 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. 205 | 206 | ##### Cryptographic validity 207 | 208 | The server must verify that `` is a valid signature for the entire request body, exactly as transmitted. If the board isn't signed properly, the server should reject it, returning 401 Unauthorized. 209 | 210 | ##### Cryptographic difficulty 211 | 212 | 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. 213 | 214 | The server must reject other keys with 400 Bad Request. 215 | 216 | Additionally, if the server doesn't have any board stored for ``, then it must apply another check. The key, interpreted as a 256-bit number, must be less than a threshold defined by the server's difficulty factor: 217 | 218 | ``` 219 | MAX_SIG = (2**256 - 1) 220 | key_threshold = MAX_SIG * ( 1.0 - difficulty_factor) 221 | ``` 222 | 223 | 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. 224 | 225 | ##### Final considerations 226 | 227 | Spring '83 specifies a test keypair: 228 | 229 | ``` 230 | public: fad415fbaa0339c4fd372d8287e50f67905321ccfd9c43fa4c20ac40afed1983 231 | secret: a7e4d1c8be858d683ab9cb15574bd0bc3a87e6c846cdaf848da498909cb574f7 232 | ``` 233 | 234 | Servers must not accept PUTs for this key, returning 401 Unauthorized. (See the section detailing GET /``, below, for more guidance.) 235 | 236 | The server may also use a denylist to block certain keys, rejecting all PUTs for those keys. 237 | 238 | If all the preceding checks are met, the server must store the board and share it with peers. 239 | 240 | ### Sharing boards: peer to peer PUT /`` 241 | 242 | 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! 243 | 244 | 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. 245 | 246 | 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 247 | 248 | ``` 249 | min(round(total_peer_count * 0.5), 5) 250 | ``` 251 | 252 | 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. 253 | 254 | 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: 255 | 256 | ``` 257 | PUT / HTTP/1.1 258 | Content-Type: text/html;charset=utf-8 259 | Spring-Version: 83 260 | Prefer: respond-async 261 | If-Unmodified-Since: 262 | Authorization: Spring-83 Signature= 263 | 264 | 265 | ``` 266 | 267 | 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.) 268 | 269 | 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: 270 | 271 | ``` 272 | new_timeout = current_timeout + current_timeout * random(0.0 .. 1.0) 273 | ``` 274 | 275 | The server should cap this timeout at some maximum; 7 days is recommended. 276 | 277 | #### Forgetting boards 278 | 279 | The server must store boards with a TTL. One week is recommended; the maximum TTL is 28 days. 280 | 281 | The server must provide identical responses to requests for 282 | 283 | * ``, for which it once stored a board, now deleted, and 284 | * ``, for which it never stored any board. 285 | 286 | Finally, the server must not enumerate keys or boards for any requester; the server must only respond to requests for specific keys. 287 | 288 | ## Difficulty factor: GET / 289 | 290 | 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!) 291 | 292 | This limit is enforced through a difficulty factor that draws inspiration from the mining difficulty factor used in many cryptocurrencies. 293 | 294 | Spring '83's difficulty factor ranges from 0.0 to 1.0, calculated in this way: 295 | 296 | ``` 297 | difficulty_factor = ( num_boards_stored / 10_000_000 )**4 298 | ``` 299 | 300 | (TKTK is that the right exponent? Explain it, I suppose.) 301 | 302 | 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. 303 | 304 | 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. 305 | 306 | Let's consider the example of a server that is already storing 8.5 million boards. 307 | 308 | ``` 309 | difficulty_factor = ( 8_500_000 / 10_000_000 )**4 = 0.52 310 | ``` 311 | 312 | Using that difficulty factor, we can calculate the key threshold: 313 | 314 | ``` 315 | MAX_KEY = (2**256 - 1) 316 | key_threshold = MAX_KEY * ( 1.0 - 0.52 ) = 317 | ``` 318 | 319 | The server must reject PUT requests for new keys that are not less than ``. 320 | 321 | A client should determine a server's current difficulty factor using a request of this form: 322 | 323 | ``` 324 | GET / HTTP/1.1 325 | Spring-Version: 83 326 | ``` 327 | 328 | The server's response must take the form: 329 | 330 | ``` 331 | HTTP/1.1 200 OK 332 | Content-Length: 333 | Content-Type: text/html;charset=utf-8 334 | Spring-Version: 83 335 | Spring-Difficulty: 336 | 337 | 338 | ``` 339 | 340 | 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. 341 | 342 | ### Retrieving boards: GET /`` 343 | 344 | 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. 345 | 346 | To retrieve the board for ``, a client must choose one or more servers to which it has access and transmit a request of this form: 347 | 348 | ``` 349 | GET / HTTP/1.1 350 | Spring-Version: 83 351 | If-Modified-Since: 352 | ``` 353 | 354 | If the server has a board for `` but it is not newer than the timestamp specified in If-Modified-Since, it must respond with 304 Not Modified. 355 | 356 | If the client omits If-Modified-Since, the server should return whatever board it has for ``, if it has one. 357 | 358 | The server's response must take the form: 359 | 360 | ``` 361 | HTTP/1.1 200 OK 362 | Content-Length: 363 | Content-Type: text/html;charset=utf-8 364 | Spring-Version: 83 365 | Authorization: Spring-83 Signature= 366 | 367 | 368 | ``` 369 | 370 | The client must verify that the `` is valid for `` and `` before processing or displaying the board. If the signature is not valid, the client must drop the response and remove the server from its list of trustworthy peers. 371 | 372 | (TKTK clients should assist servers with out-of-date boards.) 373 | 374 | Spring '83 specifies a test keypair: 375 | 376 | ``` 377 | public: fad415fbaa0339c4fd372d8287e50f67905321ccfd9c43fa4c20ac40afed1983 378 | secret: a7e4d1c8be858d683ab9cb15574bd0bc3a87e6c846cdaf848da498909cb574f7 379 | ``` 380 | 381 | 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. 382 | 383 | ## Error code quick reference 384 | 385 | * 400: Board was submitted with impromper meta timestamp tags. 386 | * 401: Board was submitted without a valid signature. 387 | * 404: No board for this key found on this server. 388 | * 403: Board was submitted for a key that does not meet the difficulty factor. 389 | * 409: Board was submitted with a timestamp older than the server's timestamp for this key. 390 | * 513: Board is larger than 2217 bytes. 391 | 392 | ## Discussions 393 | 394 | ### 1: Inspirations 395 | 396 | This protocol draws inspiration 397 | 398 | * from Secure Scuttlebutt: the power of cryptographic keypairs as identities 399 | * from Hashcash: the notion of guarding server resources with client puzzles 400 | * from Ethereum: the gonzo strategy of storing the whole universe in one place 401 | * from ZeroTier: the spirit of "decentralize until it hurts, then centralize until it works". 402 | 403 | and, most of all, 404 | 405 | * 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 406 | 407 | 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. 408 | 409 | 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. 410 | 411 | So, not without regret, Spring '83 goes with the flow. 412 | 413 | ### 2: The agony and ecstasy of public key cryptography 414 | 415 | 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. 416 | 417 | 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. 418 | 419 | 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. 420 | 421 | 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. 422 | 423 | 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. 424 | 425 | 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. 426 | 427 | 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. -------------------------------------------------------------------------------- /draft-20220629.md: -------------------------------------------------------------------------------- 1 | # Spring '83 2 | 3 | > *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! 4 | 5 | > This is being posted for discussion -- definitely do not implement anything in here yet! 6 | 7 | ## Introduction 8 | 9 | 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. 10 | 11 | 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. 12 | 13 | > *Aside:* If 2217 bytes is enough for [the first web page](http://info.cern.ch/hypertext/WWW/TheProject.html), it's enough for us. 14 | 15 | Each publisher maintains just one board. There is no concept of a history; think instead of a whiteboard that is amended or erased. 16 | 17 | Spring '83 aspires to be: 18 | 19 | **Simple.** This means the protocol is easy to understand and implement, even for a non-expert programmer. 20 | 21 | **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. 22 | 23 | **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. 24 | 25 | (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!) 26 | 27 | In addition, Spring '83 is 28 | 29 | **Federated.** This means boards are stored on different servers operated by different people. 30 | 31 | Spring '83 draws inspiration from many existing protocols and technologies; you can read about these in Discussion 1. 32 | 33 | ## Implementation 34 | 35 | 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. 36 | 37 | https://www.ietf.org/rfc/rfc2119.txt 38 | 39 | ## Terminology 40 | 41 | *board*: a fragment of HTML5, not necessarily a valid HTML5 document, not more than 2217 bytes long, encoded in UTF-8. 42 | 43 | *publisher*: the entity responsible for specifying a board's content. 44 | 45 | *key*: a public key on the Ed25519 curve, formatted as 64 hex characters. 46 | 47 | *signature*: a public key signature, formatted as 128 hex characters. 48 | 49 | *client*: an application, web or standalone, that publishes, retrieves, and displays boards. 50 | 51 | *server*: an application, reachable on the public internet, that accepts requests from clients to publish and retrieve boards. 52 | 53 | ## Publishers, keys, and servers 54 | 55 | 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. 56 | 57 | See Discussion 2 for a consideration of the benefits (substantial) and drawbacks (likewise) of keypair identity schemes. 58 | 59 | 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. 60 | 61 | 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. 62 | 63 | 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. 64 | 65 | 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. 66 | 67 | > *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! 68 | 69 | 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 70 | 71 | ``` 72 | https://// 73 | ``` 74 | 75 | For example, a board hosted on the server `bogbody.biz` is available at this URL: 76 | 77 | ``` 78 | https://bogbody.biz/ca93846ae61903a862d44727c16fed4b80c0522cab5e5b8b54763068b83e0623 79 | ``` 80 | 81 | ### Generating conforming keys 82 | 83 | 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. 84 | 85 | The format requirement accomplishes two things at once: 86 | 87 | 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. 88 | 89 | 2. It "bakes" some useful metadata into the key itself. 90 | 91 | 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: 92 | 93 | ``` 94 | /83e(0[1-9]|1[0-2])(\d\d)$/ 95 | ``` 96 | 97 | 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. 98 | 99 | 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).) 100 | 101 | For example, the key 102 | 103 | ``` 104 | ca93846ae61903a862d44727c16fed4b80c0522cab5e5b8b54763068b83e0623 105 | ``` 106 | 107 | 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. 108 | 109 | 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. 110 | 111 | 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. 112 | 113 | ### Discovering keys 114 | 115 | The process of discovering a particular publisher's board URL, or discovering board URLs to follow generally, is not part of this specification. 116 | 117 | However, it is presumed that a home page or profile page might contain a `` element analogous to the kind used to specify RSS feeds. A client scanning a web page for an associated board should look for `` elements with the `type` attribute set to `text/board+html`. 118 | 119 | ``` 120 | 121 | ``` 122 | 123 | ## Boards in the client 124 | 125 | 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. 126 | 127 | The client must: 128 | 129 | * reject boards larger than 2217 bytes 130 | * verify each board's cryptographic signature 131 | * situate each board inside its own Shadow DOM 132 | 133 | The client must not: 134 | 135 | * execute any JavaScript included in the board 136 | * load any images, media, or fonts linked by the board 137 | 138 | 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: 139 | 140 | ``` 141 | default-src 'none'; 142 | style-src 'self' 'unsafe-inline'; 143 | font-src 'self'; 144 | script-src 'self'; 145 | form-action *; 146 | connect-src *; 147 | ``` 148 | 149 | It's important to allow `unsafe-inline` CSS so boards can style themselves! 150 | 151 | > *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! 152 | > 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. 153 | > Once they open, there's no going back! 154 | 155 | The element that encloses the Shadow DOM must be set to `display: block`. 156 | 157 | Preparing each board for display in its Shadow DOM, the client should prepend this default CSS: 158 | 159 | ``` 160 | 170 | ``` 171 | 172 | The board's inline CSS may override any of those rules. It may also "reset the world": 173 | 174 | ``` 175 | :host { 176 | all: initial; 177 | } 178 | ``` 179 | 180 | The client should: 181 | 182 | * provide at least one mode in which boards are juxtaposed on a 2D canvas 183 | * present boards in an aspect ratio of roughly `1:sqrt(2)` or `sqrt(2):1` 184 | * open links in new windows or tabs 185 | 186 | Beyond the standards described above, Spring '83 doesn't specify how the client should display boards. For example, the client may: 187 | 188 | * provide a mode in which boards can be viewed one at a time 189 | * organize boards according to an abstruse algorithm 190 | * handle links to board URLs in a helpful way, even "transcluding" them (!) 191 | 192 | 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. 193 | 194 | Boards might be: 195 | 196 | * ephemeral notes about web pages recently read 197 | * weekly logs, wiped clean on Monday morning 198 | * yawlps to the universe 199 | 200 | 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. 201 | 202 | ### Boards with special instructions 203 | 204 | Clients should scan board HTML for the `` element: 205 | 206 | ``` 207 | 208 | ``` 209 | 210 | This element is used by publishers to migrate from key to key and server to server. When the client finds a `` element, it should retrieve the board at the URL specified, verify it normally, and either (a) notify the user, or (b) automatically update its record of the board's URL. 211 | 212 | A board should contain only one `` element. If it contains more than one, the client must honor the first and ignore the rest. 213 | 214 | The new board specified by a `` element must not, itself, have a `` element. If it does, the client must cancel the migration, ignoring the new board. 215 | 216 | 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. 217 | 218 | ## Boards on the server 219 | 220 | Spring '83 servers are, in operation, very similar to "plain old web" servers, with a few additional behaviors. 221 | 222 | 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. 223 | 224 | 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. 225 | 226 | A Spring '83 server must respond at the following HTTP endpoints: 227 | 228 | ``` 229 | OPTIONS 230 | GET / 231 | PUT / 232 | GET / 233 | DELETE / 234 | ``` 235 | 236 | That's a pretty small API surface! We'll go through the endpoints one by one. 237 | 238 | ### Serving clients: OPTIONS 239 | 240 | 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: 241 | 242 | ``` 243 | HTTP/1.1 204 No Content 244 | Access-Control-Allow-Methods: GET, OPTIONS, PUT 245 | Access-Control-Allow-Origin: * 246 | Access-Control-Allow-Headers: Content-Type, If-Modified-Since, Spring-Signature, Spring-Version 247 | Access-Control-Expose-Headers: Content-Type, Last-Modified, Spring-Signature, Spring-Version 248 | ``` 249 | 250 | ### Introducing yourself: GET / 251 | 252 | The server must provide a valid HTML page at its base URL containing, at minimum: 253 | 254 | * its operator's contact information 255 | * its current board TTL 256 | * a rough assessment of its robustness and availability 257 | * an articulation of its publishing standards 258 | 259 | ### Publishing boards: PUT /`` 260 | 261 | 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: 262 | 263 | ``` 264 | PUT / HTTP/1.1 265 | Content-Type: text/html;charset=utf-8 266 | Spring-Version: 83 267 | Spring-Signature: 268 | 269 | 270 | ``` 271 | 272 | Upon receipt, the server must check the non-cryptographic part of the PUT request immediately, and, if necessary, return an error code. 273 | 274 | #### Checking boards 275 | 276 | ##### Size 277 | 278 | If the board is larger than 2217 bytes, the server must reject the PUT request with 413 Payload Too Large. 279 | 280 | ##### Timestamp 281 | 282 | The timestamp is transmitted as part of the board HTML. The client must include a `