-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathformal.html
541 lines (505 loc) · 34.2 KB
/
formal.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
<!doctype html>
<html class="no-js" lang="en">
<head><meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<link rel="index" title="Index" href="genindex.html" /><link rel="search" title="Search" href="search.html" /><link rel="next" title="Installation" href="install.html" /><link rel="prev" title="Background and Discussion" href="discussion.html" />
<!-- Generated with Sphinx 5.3.0 and Furo 2023.03.27 -->
<title>Formal Treatment - snackabra 1.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/styles/furo.css?digest=fad236701ea90a88636c2a8c73b44ae642ed2a53" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" />
<link rel="stylesheet" type="text/css" href="_static/css/custom.css" />
<style>
body {
--color-code-background: #f8f8f8;
--color-code-foreground: black;
}
@media not print {
body[data-theme="dark"] {
--color-code-background: #202020;
--color-code-foreground: #d0d0d0;
}
@media (prefers-color-scheme: dark) {
body:not([data-theme="light"]) {
--color-code-background: #202020;
--color-code-foreground: #d0d0d0;
}
}
}
</style></head>
<body>
<script>
document.body.dataset.theme = localStorage.getItem("theme") || "auto";
</script>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="svg-toc" viewBox="0 0 24 24">
<title>Contents</title>
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024">
<path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/>
</svg>
</symbol>
<symbol id="svg-menu" viewBox="0 0 24 24">
<title>Menu</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu">
<line x1="3" y1="12" x2="21" y2="12"></line>
<line x1="3" y1="6" x2="21" y2="6"></line>
<line x1="3" y1="18" x2="21" y2="18"></line>
</svg>
</symbol>
<symbol id="svg-arrow-right" viewBox="0 0 24 24">
<title>Expand</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right">
<polyline points="9 18 15 12 9 6"></polyline>
</svg>
</symbol>
<symbol id="svg-sun" viewBox="0 0 24 24">
<title>Light mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</symbol>
<symbol id="svg-moon" viewBox="0 0 24 24">
<title>Dark mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
</svg>
</symbol>
<symbol id="svg-sun-half" viewBox="0 0 24 24">
<title>Auto light/dark mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<circle cx="12" cy="12" r="9" />
<path d="M13 12h5" />
<path d="M13 15h4" />
<path d="M13 18h1" />
<path d="M13 9h4" />
<path d="M13 6h1" />
</svg>
</symbol>
</svg>
<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation">
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc">
<label class="overlay sidebar-overlay" for="__navigation">
<div class="visually-hidden">Hide navigation sidebar</div>
</label>
<label class="overlay toc-overlay" for="__toc">
<div class="visually-hidden">Hide table of contents sidebar</div>
</label>
<div class="page">
<header class="mobile-header">
<div class="header-left">
<label class="nav-overlay-icon" for="__navigation">
<div class="visually-hidden">Toggle site navigation sidebar</div>
<i class="icon"><svg><use href="#svg-menu"></use></svg></i>
</label>
</div>
<div class="header-center">
<a href="index.html"><div class="brand">snackabra 1.0 documentation</div></a>
</div>
<div class="header-right">
<div class="theme-toggle-container theme-toggle-header">
<button class="theme-toggle">
<div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
<svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
</button>
</div>
<label class="toc-overlay-icon toc-header-icon" for="__toc">
<div class="visually-hidden">Toggle table of contents sidebar</div>
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
</label>
</div>
</header>
<aside class="sidebar-drawer">
<div class="sidebar-container">
<div class="sidebar-sticky"><a class="sidebar-brand" href="index.html">
<span class="sidebar-brand-text">snackabra 1.0 documentation</span>
</a><form class="sidebar-search-container" method="get" action="search.html" role="search">
<input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
<input type="hidden" name="check_keywords" value="yes">
<input type="hidden" name="area" value="default">
</form>
<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="overview.html">Technical Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="system-architecture.html">System Architecture</a></li>
<li class="toctree-l1"><a class="reference internal" href="discussion.html">Background and Discussion</a></li>
<li class="toctree-l1 current current-page"><a class="current reference internal" href="#">Formal Treatment</a></li>
<li class="toctree-l1"><a class="reference internal" href="install.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="contact.html">Contact and Feedback</a></li>
<li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</a></li>
<li class="toctree-l1"><a class="reference internal" href="future.html">Future Work</a></li>
<li class="toctree-l1"><a class="reference internal" href="references.html">References / Further Reading</a></li>
<li class="toctree-l1"><a class="reference internal" href="license.html">LICENSE</a></li>
<li class="toctree-l1"><a class="reference internal" href="jslib.html">JSLib User Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">JSLib Reference Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="server.html">Snackabra Server</a></li>
<li class="toctree-l1"><a class="reference internal" href="pylib.html">Python Library</a></li>
<li class="toctree-l1"><a class="reference internal" href="appendix-a-crypto.html">Appendix A: Cryptography</a></li>
<li class="toctree-l1"><a class="reference internal" href="user-guide.html">Appendix B: Privacy.App Chat Room User Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="diag-sample.html">(ignore)</a></li>
<li class="toctree-l1"><a class="reference internal" href="motivation.html">Motivation</a></li>
</ul>
</div>
</div>
</div>
</div>
</aside>
<div class="main">
<div class="content">
<div class="article-container">
<a href="#" class="back-to-top muted-link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
</svg>
<span>Back to top</span>
</a>
<div class="content-icon-container">
<div class="theme-toggle-container theme-toggle-content">
<button class="theme-toggle">
<div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
<svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
</button>
</div>
<label class="toc-overlay-icon toc-content-icon" for="__toc">
<div class="visually-hidden">Toggle table of contents sidebar</div>
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
</label>
</div>
<article role="main">
<section id="formal-treatment">
<span id="formal"></span><h1>Formal Treatment<a class="headerlink" href="#formal-treatment" title="Permalink to this heading">#</a></h1>
<p>This section is currently a <em>start</em> to a formal treatment of the
snackabra design - this is early. The reality of the ~3 year
development period has been to begin with a simple implementation
using readily available building blocks, then iterating with input
from internal discussions combined with progressively deeper research
into academic work. We expect this to continue for some time, and we
continue to appreciate any and all inputs, critiques, and pointers to
relevant work.</p>
<p>Within the scope of tentative steps, we begin not with the core room
(group) chat service, but with the storage service. This is for two
reasons: firstly we have more confidence that any issues that arise
with chat messaging can be addressed, given the large amount of work
done in this space, whereas for the storage service, it feels like we
are breaking some new ground, which is always worrisome. Probably for
that reason, the storage design has attracted more initial interest
and questions, which is the second reason to prioritize it.</p>
<section id="photos-and-files-blobs">
<h2>Photos and Files (Blobs)<a class="headerlink" href="#photos-and-files-blobs" title="Permalink to this heading">#</a></h2>
<p>For a new group chat service to be a credible alternative to the
myriad existing alternatives, it needs these basic features: text chat
(either one-to-one or group) and photo sharing (again, either
one-to-one or group). Seen from a more abstract view, a minimal
messaging fabric needs to be able to exchange simple (text) messages,
as well as arbitrary blobs of data. We picked photos first for reasons
explained elsewhere.</p>
<p>For the purposes of this section, we will refer to any blob of data
as <span class="math notranslate nohighlight">\(\mathcal{M}\)</span>. <a class="footnote-reference brackets" href="#f201" id="id1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a> Small messages (next section) are
referred to as <span class="math notranslate nohighlight">\(\mathcal{m}\)</span>. <a class="footnote-reference brackets" href="#f202" id="id2" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>
Consider Alice wants to send <span class="math notranslate nohighlight">\(\mathcal{M}\)</span> to Bob:</p>
<ol class="arabic simple">
<li><p>Alice creates a partial hash <span class="math notranslate nohighlight">\(\mathfrak{H}_1(\mathcal{M})\)</span>.
<span class="math notranslate nohighlight">\(\mathfrak{H}_1\)</span> and <span class="math notranslate nohighlight">\(\mathfrak{H}_2\)</span> are decompositions
<span class="math notranslate nohighlight">\(\mathfrak{H}(\mathcal{M}) = \mathfrak{H}_1(\mathcal{M}) | \mathfrak{H}_2(\mathcal{M})\)</span>.
Alice sends this to the storage server, which returns a nonce <span class="math notranslate nohighlight">\(\mathcal{iv}\)</span> and salt <span class="math notranslate nohighlight">\(\mathcal{s}\)</span>.</p></li>
<li><p>The server mantains a mapping <span class="math notranslate nohighlight">\(\mathcal{T}'(h)\longmapsto\langle\mathcal{iv},\mathcal{s}\rangle\)</span> which
relates <em>half</em> of the hash of the full plaintext to enryption parameters;
if the values existed already, they are returned, otherwise, they are created on the fly (and saved and returned). <a class="footnote-reference brackets" href="#f203" id="id3" role="doc-noteref"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></a>
This is the point where deduplication occurs: any attempts to upload an identical message
will always result in the same encryption parameters.</p></li>
<li><p>Alice next generates an encryption key <span class="math notranslate nohighlight">\(\mathcal{k}=\mathcal{K}(\mathfrak{H}_2(\mathcal{M}), \mathcal{s})\)</span> from
the second half of the hash of the plaintext message (and salted), then
generates the cryptotext of the message <span class="math notranslate nohighlight">\(\mathcal{C}=\mathscr{E}(\mathcal{k},\mathcal{iv}|\mathcal{M})\)</span>,
and then constructs a new hash of the encrypted message <span class="math notranslate nohighlight">\(\mathcal{c}=\mathcal{H}(\mathcal{C})\)</span>.
Alice sends the full encrypted message <span class="math notranslate nohighlight">\(\mathcal{C}\)</span> to the server.</p></li>
<li><p>The storage server maintains a second mapping <span class="math notranslate nohighlight">\(\mathcal{T}''(c)\longmapsto\langle\mathcal{v},\mathcal{C}\rangle\)</span>,
which simply relates a hash of the encrypted contents to the contents, as well as a random
verification identifier <span class="math notranslate nohighlight">\(\mathcal{v}\)</span>, which is returned only if the server receives the full encrypted message.</p></li>
<li><p>At this point Alice has collected the full “manifest”:
<span class="math notranslate nohighlight">\(\langle\mathcal{H}(\mathcal{C}),\mathcal{k},\mathcal{iv},\mathcal{s},\mathcal{v}\rangle\)</span>,
which can be sent to Bob.</p></li>
</ol>
<p>When Bob wants to fetch the object, Bob sends <span class="math notranslate nohighlight">\(\langle\mathcal{H}(\mathcal{C}),\mathcal{v}\rangle\)</span> to the
storage server which first confirms correct <span class="math notranslate nohighlight">\(\mathcal{T}''(c)\longmapsto\langle\mathcal{v}\rangle\)</span> and then returns
<span class="math notranslate nohighlight">\(\mathcal{C}\)</span>. Bob then has <span class="math notranslate nohighlight">\(\mathcal{M}\)</span> from <span class="math notranslate nohighlight">\(\mathcal{D}(\mathcal{C},\mathcal{k},\mathcal{iv},\mathcal{s})\)</span>.</p>
<p>The storage server (obviously) never sees <span class="math notranslate nohighlight">\(\mathcal{M}\)</span>. Furthermore, it doesn’t track an explicit relationship
between <span class="math notranslate nohighlight">\(\mathcal{M}\)</span> and <span class="math notranslate nohighlight">\(\mathcal{C}\)</span> in any manner. <a class="footnote-reference brackets" href="#f204" id="id4" role="doc-noteref"><span class="fn-bracket">[</span>4<span class="fn-bracket">]</span></a></p>
<p>Now, consider another user, Charles, who independently uploads the same object
to share with some other party. The above process will play out the same, and the resulting
<span class="math notranslate nohighlight">\(\langle\mathcal{H}(\mathcal{C}),\mathcal{k},\mathcal{iv},\mathcal{s},\mathcal{v}\rangle\)</span> will end up
being identical. Thus, re-uploading or sharing (copying and distributing the manifest) results
in the exact same data.</p>
<p>An outside adversary cannot determine what objects have been shared: all
they can do is go through the above process and abort at some point, but
won’t learn anything: they won’t receive the full manifest until all steps
are completed, and at no point will the server act differently than if it
had never seen the object.</p>
<p>The manifest is portable outside the system: it doesn’t matter if the manifest was
shared within a chat room (see next section), or in some other manner (SMS, emailed,
copied to file across flash USB, etc). Regardless of how Bob receives the manifest,
Bob can ask for <span class="math notranslate nohighlight">\(\mathcal{C}\)</span> and can perform <span class="math notranslate nohighlight">\(\mathcal{D}(\mathcal{C},\mathcal{k},\mathcal{iv},\mathcal{s})\)</span>.</p>
<p>Deduplication will occur at step “1” and “3”: when the server receives <span class="math notranslate nohighlight">\(\mathcal{C}\)</span> it calculates
<span class="math notranslate nohighlight">\(\mathcal{c}=\mathcal{H}(\mathcal{C})\)</span>, and if it has already seen it, it returns the stored value
<span class="math notranslate nohighlight">\(\mathcal{T}''(c)\longmapsto\langle\mathcal{v},\mathcal{C}\rangle\)</span>, otherwise it
generates a new <span class="math notranslate nohighlight">\(\mathcal{v}\)</span> (and stores and returns it). Regardless, it goes through the
motions of “storing” <span class="math notranslate nohighlight">\(\mathcal{C}\)</span>, which will in effect be a no-op if it had already stored it.</p>
<p>The final result is a <span class="math notranslate nohighlight">\(\mathcal{T}''(c)\longmapsto\langle\mathcal{v},\mathcal{C}\rangle\)</span> storage system,
that will only respond if you already have <span class="math notranslate nohighlight">\(\mathcal{v}\)</span>, which you can only have if you either
went through the above steps yourself, or somebody else did and gave you the results. And of course
the resulting <span class="math notranslate nohighlight">\(\mathcal{C}\)</span> is of no use to you without <span class="math notranslate nohighlight">\(\langle\mathcal{k},\mathcal{iv},\mathcal{s}\rangle\)</span>.</p>
<section id="future-design-directions">
<span id="blob-future-design"></span><h3>Future Design Directions<a class="headerlink" href="#future-design-directions" title="Permalink to this heading">#</a></h3>
<p>The above design is the current one. The next generation will be
a slight tweak: you can access either with the ID plus the
verification, or a hash of both. It’s up to the shard server
to decide on policy.</p>
</section>
</section>
<section id="ledger">
<span id="ledger-formal"></span><h2>Ledger<a class="headerlink" href="#ledger" title="Permalink to this heading">#</a></h2>
<p>For a conversational (and more complete) exposition of how the Ledger
currently works, see <a class="reference internal" href="overview.html#ledgerserver"><span class="std std-ref">Storage Ledger Server</span></a>. Note
also that this (slightly more) formal presentation presuposes the
next-generation usage of OPRF() functions (see <a class="reference internal" href="#blob-future-design"><span class="std std-ref">this discussion</span></a>). The Ledger complements the flow of uploading
and sharing files and documents (blobs), thus make sure to have read those
sections first.</p>
<p>A global ledger <span class="math notranslate nohighlight">\(\mathfrak{D_1}\mathcal{(a)}\mapsto\mathcal{b}\)</span>
maintains account balance <span class="math notranslate nohighlight">\(\mathcal{b}\)</span> for every account
<span class="math notranslate nohighlight">\(\mathcal{a}\)</span>. Balance is a positive integer that defaults to
zero (ergo all possible accounts ‘exist’), corresponding to bytes of
storage. Account is either a <a class="reference internal" href="glossary.html#term-Room-Name"><span class="xref std std-term">Room Name</span></a>, or one of two
reserved account names that correspond to two special accounts:
<span class="math notranslate nohighlight">\(\mathcal{B_g}\)</span> is the global budget for the service, and
<span class="math notranslate nohighlight">\(\mathcal{B_s}\)</span> is the total spent so far.</p>
<p>Every <a class="reference internal" href="glossary.html#term-Room"><span class="xref std std-term">Room</span></a> maintains a budget <span class="math notranslate nohighlight">\(\mathcal{B_r}\)</span> that was assigned
to it at creation by taking an initial budget from <span class="math notranslate nohighlight">\(\mathcal{B_g}\)</span> and adding
it to both <span class="math notranslate nohighlight">\(\mathcal{B_s}\)</span> and <span class="math notranslate nohighlight">\(\mathcal{B_r}\)</span>. <a class="footnote-reference brackets" href="#f208" id="id5" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a></p>
<p>When a client uploads an item <span class="math notranslate nohighlight">\(\mathcal{M}\)</span>, it first needs to
calculate what <span class="math notranslate nohighlight">\(\mathcal{|C|}\)</span> will become. <a class="footnote-reference brackets" href="#f207" id="id6" role="doc-noteref"><span class="fn-bracket">[</span>8<span class="fn-bracket">]</span></a>
It first requests from the room to spend
<span class="math notranslate nohighlight">\(\mathcal{s = |C|}\)</span> bytes out of the Room balance <span class="math notranslate nohighlight">\(\mathcal{B_r}\)</span>.</p>
<p>If approved, the Room <span class="math notranslate nohighlight">\(\mathcal{r}\)</span> requests an identifier
<span class="math notranslate nohighlight">\(\mathcal{t}\)</span> (elsewhere called <a class="reference internal" href="glossary.html#term-TID"><span class="xref std std-term"><TID></span></a>) from the Ledger. <a class="footnote-reference brackets" href="#f209" id="id7" role="doc-noteref"><span class="fn-bracket">[</span>9<span class="fn-bracket">]</span></a> This is a random
token generated by the Ledger which maintains
<span class="math notranslate nohighlight">\(\mathfrak{D_2}\mathcal{h(t)}\mapsto\langle\mathcal{s,
u}\rangle\)</span> where <span class="math notranslate nohighlight">\(\mathcal{h()}\)</span> is a hash function, <span class="math notranslate nohighlight">\(\mathcal{s}\)</span> is the size and
<span class="math notranslate nohighlight">\(\mathcal{u}\)</span> is a boolean indicating if this has been ‘spent’
or not. Essentially, we are generating a local cryptocurrency token
of sorts, that can be traded for an upload of <span class="math notranslate nohighlight">\(\mathcal{s}\)</span> bytes.</p>
<p>The Room never shares <span class="math notranslate nohighlight">\(\mathcal{t}\)</span> with the Client, instead it
returns
<span class="math notranslate nohighlight">\(\mathcal{T=}\mathfrak{E}\mathcal{(}\langle\mathcal{h(t), R(t),
R(h(t)}\mathcal{)}\rangle\)</span> where <span class="math notranslate nohighlight">\(\mathfrak{E}\mathcal{()}\)</span> is
encrypted into a magical token <span class="math notranslate nohighlight">\(\mathcal{T}\)</span> such that only the
Storage server can untangle it. <span class="math notranslate nohighlight">\(\mathcal{R()}\)</span> is encryption
using the <a class="reference internal" href="glossary.html#term-LEDGER_KEY"><span class="xref std std-term">LEDGER_KEY</span></a> for future garbage collection.</p>
<p>The Client can now do the actual upload of <span class="math notranslate nohighlight">\(\mathcal{v|C}\)</span>, sending
along with it <span class="math notranslate nohighlight">\(\mathcal{T}\)</span>.</p>
</section>
<section id="rooms-chats-groups">
<h2>Rooms, Chats, Groups<a class="headerlink" href="#rooms-chats-groups" title="Permalink to this heading">#</a></h2>
<p>For a conversational exposition of how Rooms work, see the
<a class="reference internal" href="overview.html#overview"><span class="std std-ref">Technical Overview</span></a>.</p>
<p>To be written, we’re saving the formal treatment for this for last, since
it’s quite conventional.</p>
<div class="line-block">
<div class="line"><br /></div>
<div class="line"><br /></div>
</div>
<hr class="docutils" />
<p class="rubric">Footnotes</p>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="f201" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id1">1</a><span class="fn-bracket">]</span></span>
<p>In this section we will largely follow the nomenclature in
<em>Message-Locked Encryption and Secure Deduplication</em>;
Mihir Bellare, Sriram Keelveedhi, Thomas Ristenpart;
Full version, original version in Eurocrypt 2013.</p>
</aside>
<aside class="footnote brackets" id="f202" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id2">2</a><span class="fn-bracket">]</span></span>
<p>You can think about it as follows: think of a generic
message as being <span class="math notranslate nohighlight">\(\mathfrak{m}\)</span> with size
<span class="math notranslate nohighlight">\(\vert\mathfrak{m}\vert\)</span>.
We wish to distinguish between “small” and “large”
<span class="math notranslate nohighlight">\(\mathfrak{m}\)</span>. That’s an engineering and
cost analysis question. Given a boundary <span class="math notranslate nohighlight">\(\mathfrak{S}\)</span>,
then messages where <span class="math notranslate nohighlight">\(\vert\mathfrak{m}\vert < \mathfrak{S}\)</span>
are treated as <span class="math notranslate nohighlight">\(\mathcal{m}\)</span> otherwise
<span class="math notranslate nohighlight">\(\mathcal{M}\)</span>. The smaller objects <span class="math notranslate nohighlight">\(\mathcal{m}\)</span>
are replicated wherever they are used, and the
larger <span class="math notranslate nohighlight">\(\mathcal{M}\)</span> are essentially
<em>converted into a reference</em> and embedded inside a
new <span class="math notranslate nohighlight">\(\mathcal{m}\)</span>. That conversion includes
handling deduplication.</p>
</aside>
<aside class="footnote brackets" id="f203" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id3">3</a><span class="fn-bracket">]</span></span>
<p>There is a race condition if multiple parties are trying to
create a new entry in this mapping at the same time.
To address this, the underlying primitive should be a
<em>compare-and-exchange</em>-style operation, where a new
nonce and salt are always generated, and are then
atomically compared with existing storage, which should
default to zero if not allocated: ergo, if there’s a zero
(unallocated), write the new values, otherwise, return
the old ones. This would also reduce timing differences,
since the overhead of generating enryption parameters
is <em>always</em> carried, but optionally discarded.</p>
</aside>
<aside class="footnote brackets" id="f204" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id4">4</a><span class="fn-bracket">]</span></span>
<p>Note that this is slightly different from the current
implementation, and is a (believed) improvement: current
code (soon to be updated) creates a concatenation of
partial hash of the plaintext with partial hash of
the encrypted. The problem this creates is that an
adversary that is able to gain full access to the storage
server at some point in time could look for the existence
of matches to known plaintext messages by simply inspecting
the first half. In this revised design, a storage server
has the option of clearing the mapping of
<span class="math notranslate nohighlight">\(\mathcal{T}'(h)\longmapsto\langle\mathcal{iv},\mathcal{s}\rangle\)</span>
at any time: sharing manifests and retrieving encrypted
messages would be unaffected, to the detriment of reduced
effectiveness of deduplication. This allows for a form of
forward privacy (on the aggregate): for example, a storage
server configured to reset this mapping every week
could only leverage deduplication within each distinct
weekly period, but conversely an adversary that could
completely compromise the system would only be able to
determine if a given plaintext message was uploaded
and shared by anybody in the past week.</p>
</aside>
<aside class="footnote brackets" id="f205" role="note">
<span class="label"><span class="fn-bracket">[</span>5<span class="fn-bracket">]</span></span>
<p>The final xor operation with
<span class="math notranslate nohighlight">\(\mathfrak{H}(\mathcal{M})\)</span> exists to protect for the case where the
<span class="math notranslate nohighlight">\(\mathcal{OPRF_1}\)</span> server has been compromised.</p>
</aside>
<aside class="footnote brackets" id="f206" role="note">
<span class="label"><span class="fn-bracket">[</span>6<span class="fn-bracket">]</span></span>
<p>A concern is that OPRF is not yet an accepted IETF
standard. Latest draft is here <a class="reference external" href="https://www.ietf.org/id/draft-irtf-cfrg-voprf-09.html">https://www.ietf.org/id/draft-irtf-cfrg-voprf-09.html</a>
and current (Draft 9) reference implementations
are here <a class="reference external" href="https://github.com/cfrg/draft-irtf-cfrg-voprf">https://github.com/cfrg/draft-irtf-cfrg-voprf</a>.
So far in snackabra design, we have avoided using any functions
that triggers the necessity of including libraries
or even major sections of code. The advantages of improving
the blob storage system with OPRF might outweigh those
concerns, but we have not made a final decision.</p>
</aside>
<aside class="footnote brackets" id="f208" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id5">7</a><span class="fn-bracket">]</span></span>
<p>The Room balance is actually simply a local cached value that
matches whatever the balance is for the room according to the
Ledger server. The Room ‘copy’ of the balance serves as a synchronization
primitive, allowing the Ledger server to not have to worry
about that - the Ledger server can fullfil account balance
changes in any order. Similarly, this naturally protects against
various abuse and DDOS scenarios.</p>
</aside>
<aside class="footnote brackets" id="f207" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id6">8</a><span class="fn-bracket">]</span></span>
<p>Because of the very specific padding requirements, this is
predictable.</p>
</aside>
<aside class="footnote brackets" id="f209" role="note">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id7">9</a><span class="fn-bracket">]</span></span>
<p>Note that <a class="reference internal" href="glossary.html#term-TID"><span class="xref std std-term"><TID></span></a> and <a class="reference internal" href="glossary.html#term-verification"><span class="xref std std-term">verification</span></a> are different.</p>
</aside>
</aside>
</section>
</section>
</article>
</div>
<footer>
<div class="related-pages">
<a class="next-page" href="install.html">
<div class="page-info">
<div class="context">
<span>Next</span>
</div>
<div class="title">Installation</div>
</div>
<svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
</a>
<a class="prev-page" href="discussion.html">
<svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
<div class="page-info">
<div class="context">
<span>Previous</span>
</div>
<div class="title">Background and Discussion</div>
</div>
</a>
</div>
<div class="bottom-of-page">
<div class="left-details">
<div class="copyright">
Copyright © 2019-2023, Magnusson Institute
</div>
Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s
<a href="https://github.com/pradyunsg/furo">Furo</a>
</div>
<div class="right-details">
</div>
</div>
</footer>
</div>
<aside class="toc-drawer">
<div class="toc-sticky toc-scroll">
<div class="toc-title-container">
<span class="toc-title">
On this page
</span>
</div>
<div class="toc-tree-container">
<div class="toc-tree">
<ul>
<li><a class="reference internal" href="#">Formal Treatment</a><ul>
<li><a class="reference internal" href="#photos-and-files-blobs">Photos and Files (Blobs)</a><ul>
<li><a class="reference internal" href="#future-design-directions">Future Design Directions</a></li>
</ul>
</li>
<li><a class="reference internal" href="#ledger">Ledger</a></li>
<li><a class="reference internal" href="#rooms-chats-groups">Rooms, Chats, Groups</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</aside>
</div>
</div><script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<script src="_static/scripts/furo.js"></script>
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</body>
</html>