@secrecy/lib 1.0.0-dev.25 → 1.0.0-dev.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/BaseClient.d.ts +274 -0
  2. package/dist/BaseClient.js +2227 -0
  3. package/dist/PopupTools.d.ts +17 -0
  4. package/dist/PopupTools.js +213 -0
  5. package/dist/ZeusThunder.d.ts +2 -0
  6. package/dist/ZeusThunder.js +113 -0
  7. package/dist/cache.d.ts +7 -0
  8. package/dist/cache.js +5 -0
  9. package/dist/client/admin/index.d.ts +11 -0
  10. package/dist/client/admin/index.js +198 -0
  11. package/dist/client/convert/file.d.ts +5 -0
  12. package/dist/client/convert/file.js +39 -0
  13. package/dist/client/convert/folder.d.ts +8 -0
  14. package/dist/client/convert/folder.js +264 -0
  15. package/dist/client/convert/mail.d.ts +3 -0
  16. package/dist/client/convert/mail.js +46 -0
  17. package/dist/client/convert/vFile.d.ts +5 -0
  18. package/dist/client/convert/vFile.js +164 -0
  19. package/dist/client/helpers.d.ts +23 -0
  20. package/dist/client/helpers.js +114 -0
  21. package/dist/client/index.d.ts +172 -0
  22. package/dist/client/index.js +6169 -0
  23. package/dist/client/storage.d.ts +7 -0
  24. package/dist/client/storage.js +12 -0
  25. package/dist/client/types/File.d.ts +21 -0
  26. package/dist/client/types/File.js +3 -0
  27. package/dist/client/types/FilesOnUsersOnApplications.d.ts +9 -0
  28. package/dist/client/types/FilesOnUsersOnApplications.js +3 -0
  29. package/dist/client/types/Folder.d.ts +68 -0
  30. package/dist/client/types/Folder.js +7 -0
  31. package/dist/client/types/Inputs.d.ts +21 -0
  32. package/dist/client/types/Inputs.js +3 -0
  33. package/dist/client/types/UserAppNotifications.d.ts +6 -0
  34. package/dist/client/types/UserAppNotifications.js +3 -0
  35. package/dist/client/types/UserAppSettings.d.ts +7 -0
  36. package/dist/client/types/UserAppSettings.js +3 -0
  37. package/dist/client/types/VFile.d.ts +62 -0
  38. package/dist/client/types/VFile.js +4 -0
  39. package/dist/client/types/index.d.ts +154 -0
  40. package/dist/client/types/index.js +10 -0
  41. package/dist/client/types/queries.d.ts +535 -0
  42. package/dist/client/types/queries.js +192 -0
  43. package/dist/crypto/file.d.ts +14 -0
  44. package/dist/crypto/file.js +291 -0
  45. package/dist/crypto/index.d.ts +12 -0
  46. package/dist/crypto/index.js +45 -0
  47. package/dist/error.d.ts +30 -0
  48. package/dist/error.js +3 -0
  49. package/dist/index.d.ts +13 -3857
  50. package/dist/index.js +42 -255
  51. package/dist/minify/index.d.ts +2 -0
  52. package/dist/minify/index.js +28 -0
  53. package/dist/minify/lz4.d.ts +5 -0
  54. package/dist/minify/lz4.js +633 -0
  55. package/dist/sodium.d.ts +3 -0
  56. package/dist/sodium.js +28 -0
  57. package/dist/utils/store-buddy.d.ts +14 -0
  58. package/dist/utils/store-buddy.js +69 -0
  59. package/dist/utils/time.d.ts +10 -0
  60. package/dist/utils/time.js +22 -0
  61. package/dist/utils.d.ts +4 -0
  62. package/dist/utils.js +188 -0
  63. package/dist/worker/__mock__/sodium.worker.d.ts +19 -0
  64. package/dist/worker/__mock__/sodium.worker.js +46 -0
  65. package/dist/worker/md5.d.ts +1 -0
  66. package/dist/worker/md5.js +43 -0
  67. package/dist/worker/sodium.d.ts +3 -0
  68. package/dist/worker/sodium.js +155 -0
  69. package/dist/worker/workerCodes.d.ts +2 -0
  70. package/dist/worker/workerCodes.js +3 -0
  71. package/dist/zeus/const.d.ts +2 -0
  72. package/dist/zeus/const.js +2267 -0
  73. package/dist/zeus/index.d.ts +4043 -0
  74. package/dist/zeus/index.js +549 -0
  75. package/package.json +24 -16
  76. package/CHANGELOG.md +0 -178
  77. package/__tests__/client/client.test.ts +0 -81
  78. package/__tests__/client/folder.test.ts +0 -302
  79. package/__tests__/client/mail.test.ts +0 -476
  80. package/__tests__/client/timing.test.ts +0 -35
  81. package/__tests__/client/utils.ts +0 -41
  82. package/__tests__/client/vFile.test.ts +0 -207
  83. package/__tests__/index.test.ts +0 -171
  84. package/commitlint.config.cjs +0 -3
  85. package/dist/index.js.map +0 -1
  86. package/dist/index.mjs +0 -255
  87. package/dist/index.mjs.map +0 -1
  88. package/docs/assets/css/main.css +0 -2660
  89. package/docs/assets/images/icons.png +0 -0
  90. package/docs/assets/images/icons@2x.png +0 -0
  91. package/docs/assets/images/widgets.png +0 -0
  92. package/docs/assets/images/widgets@2x.png +0 -0
  93. package/docs/assets/js/main.js +0 -248
  94. package/docs/assets/js/search.js +0 -1
  95. package/docs/classes/baseclient.baseclient-1.html +0 -1165
  96. package/docs/classes/client.secrecyclient.html +0 -2527
  97. package/docs/enums/index.sodium.base64_variants.html +0 -205
  98. package/docs/index.html +0 -198
  99. package/docs/interfaces/client_types.draftmail.html +0 -335
  100. package/docs/interfaces/client_types.filecontentbase.html +0 -231
  101. package/docs/interfaces/client_types.filecontentcloud.html +0 -244
  102. package/docs/interfaces/client_types.filecontentreceivedmail.html +0 -244
  103. package/docs/interfaces/client_types.filecontentsentmail.html +0 -230
  104. package/docs/interfaces/client_types.receivedmail.html +0 -363
  105. package/docs/interfaces/client_types.sentmail.html +0 -335
  106. package/docs/interfaces/crypto.keypair.html +0 -202
  107. package/docs/interfaces/index.sodium.cryptobox.html +0 -185
  108. package/docs/interfaces/index.sodium.cryptokx.html +0 -185
  109. package/docs/interfaces/index.sodium.keypair.html +0 -199
  110. package/docs/interfaces/index.sodium.messagetag.html +0 -185
  111. package/docs/interfaces/index.sodium.secretbox.html +0 -185
  112. package/docs/interfaces/index.sodium.stateaddress.html +0 -171
  113. package/docs/interfaces/index.sodium.stringcryptobox.html +0 -185
  114. package/docs/interfaces/index.sodium.stringcryptokx.html +0 -185
  115. package/docs/interfaces/index.sodium.stringkeypair.html +0 -199
  116. package/docs/interfaces/index.sodium.stringmessagetag.html +0 -185
  117. package/docs/interfaces/index.sodium.stringsecretbox.html +0 -185
  118. package/docs/interfaces/utils_store_buddy.storebuddy.html +0 -333
  119. package/docs/modules/baseclient.html +0 -929
  120. package/docs/modules/cache.html +0 -185
  121. package/docs/modules/client.html +0 -207
  122. package/docs/modules/client_convert_file.html +0 -216
  123. package/docs/modules/client_convert_folder.html +0 -303
  124. package/docs/modules/client_convert_vfile.html +0 -216
  125. package/docs/modules/client_helpers.html +0 -311
  126. package/docs/modules/client_storage.html +0 -167
  127. package/docs/modules/client_types.html +0 -1227
  128. package/docs/modules/client_types_file.html +0 -233
  129. package/docs/modules/client_types_filesonusersonapplications.html +0 -168
  130. package/docs/modules/client_types_folder.html +0 -383
  131. package/docs/modules/client_types_inputs.html +0 -263
  132. package/docs/modules/client_types_mail.html +0 -181
  133. package/docs/modules/client_types_queries.html +0 -199
  134. package/docs/modules/client_types_userappsettings.html +0 -163
  135. package/docs/modules/client_types_vfile.html +0 -364
  136. package/docs/modules/crypto.html +0 -366
  137. package/docs/modules/crypto_file.html +0 -344
  138. package/docs/modules/index.html +0 -779
  139. package/docs/modules/index.sodium.html +0 -6039
  140. package/docs/modules/minify.html +0 -183
  141. package/docs/modules/minify_lz4.html +0 -279
  142. package/docs/modules/popuptools.html +0 -259
  143. package/docs/modules/sodium.html +0 -167
  144. package/docs/modules/utils.html +0 -219
  145. package/docs/modules/utils_store_buddy.html +0 -208
  146. package/docs/modules/utils_time.html +0 -330
  147. package/docs/modules/worker_md5.html +0 -156
  148. package/docs/modules/worker_sodium.html +0 -231
  149. package/docs/modules/worker_workercodes.html +0 -157
  150. package/docs/modules.html +0 -235
  151. package/index.html +0 -21
  152. package/jest.config.ts +0 -27
  153. package/jest.setup.ts +0 -6
  154. package/release.config.cjs +0 -15
  155. package/tsup.config.ts +0 -23
@@ -1,156 +0,0 @@
1
- <!doctype html>
2
- <html class="default no-js">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <title>worker/md5 | @secrecy/lib</title>
7
- <meta name="description" content="Documentation for @secrecy/lib">
8
- <meta name="viewport" content="width=device-width, initial-scale=1">
9
- <link rel="stylesheet" href="../assets/css/main.css">
10
- <script async src="../assets/js/search.js" id="search-script"></script>
11
- </head>
12
- <body>
13
- <header>
14
- <div class="tsd-page-toolbar">
15
- <div class="container">
16
- <div class="table-wrap">
17
- <div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
18
- <div class="field">
19
- <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
20
- <input id="tsd-search-field" type="text" />
21
- </div>
22
- <ul class="results">
23
- <li class="state loading">Preparing search index...</li>
24
- <li class="state failure">The search index is not available</li>
25
- </ul>
26
- <a href="../index.html" class="title">@secrecy/lib</a>
27
- </div>
28
- <div class="table-cell" id="tsd-widgets">
29
- <div id="tsd-filter">
30
- <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
31
- <div class="tsd-filter-group">
32
- <div class="tsd-select" id="tsd-filter-visibility">
33
- <span class="tsd-select-label">All</span>
34
- <ul class="tsd-select-list">
35
- <li data-value="public">Public</li>
36
- <li data-value="protected">Public/Protected</li>
37
- <li data-value="private" class="selected">All</li>
38
- </ul>
39
- </div>
40
- <input type="checkbox" id="tsd-filter-inherited" checked />
41
- <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
42
- <input type="checkbox" id="tsd-filter-externals" checked />
43
- <label class="tsd-widget" for="tsd-filter-externals">Externals</label>
44
- </div>
45
- </div>
46
- <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
47
- </div>
48
- </div>
49
- </div>
50
- </div>
51
- <div class="tsd-page-title">
52
- <div class="container">
53
- <ul class="tsd-breadcrumb">
54
- <li>
55
- <a href="../modules.html">@secrecy/lib</a>
56
- </li>
57
- <li>
58
- <a href="worker_md5.html">worker/md5</a>
59
- </li>
60
- </ul>
61
- <h1>Module worker/md5</h1>
62
- </div>
63
- </div>
64
- </header>
65
- <div class="container container-main">
66
- <div class="row">
67
- <div class="col-8 col-content">
68
- <section class="tsd-panel-group tsd-index-group">
69
- <h2>Index</h2>
70
- <section class="tsd-panel tsd-index-panel">
71
- <div class="tsd-index-content">
72
- <section class="tsd-index-section ">
73
- <h3>Functions</h3>
74
- <ul class="tsd-index-list">
75
- <li class="tsd-kind-function tsd-parent-kind-module"><a href="worker_md5.html#md5" class="tsd-kind-icon">md5</a></li>
76
- </ul>
77
- </section>
78
- </div>
79
- </section>
80
- </section>
81
- <section class="tsd-panel-group tsd-member-group ">
82
- <h2>Functions</h2>
83
- <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
84
- <a name="md5" class="tsd-anchor"></a>
85
- <h3>md5</h3>
86
- <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module">
87
- <li class="tsd-signature tsd-kind-icon">md5<span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li>
88
- </ul>
89
- <ul class="tsd-descriptions">
90
- <li class="tsd-description">
91
- <aside class="tsd-sources">
92
- <ul>
93
- <li>Defined in src/worker/md5.ts:3</li>
94
- </ul>
95
- </aside>
96
- <h4 class="tsd-parameters-title">Parameters</h4>
97
- <ul class="tsd-parameters">
98
- <li>
99
- <h5>data: <span class="tsd-signature-type">Uint8Array</span></h5>
100
- </li>
101
- </ul>
102
- <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4>
103
- </li>
104
- </ul>
105
- </section>
106
- </section>
107
- </div>
108
- <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
109
- <nav class="tsd-navigation primary">
110
- <ul>
111
- <li class=" ">
112
- <a href="../modules.html">Modules</a>
113
- </li>
114
- <li class="current tsd-kind-module">
115
- <a href="worker_md5.html">worker/md5</a>
116
- </li>
117
- </ul>
118
- </nav>
119
- <nav class="tsd-navigation secondary menu-sticky">
120
- <ul class="before-current">
121
- <li class=" tsd-kind-function tsd-parent-kind-module">
122
- <a href="worker_md5.html#md5" class="tsd-kind-icon">md5</a>
123
- </li>
124
- </ul>
125
- </nav>
126
- </div>
127
- </div>
128
- </div>
129
- <footer class="with-border-bottom">
130
- <div class="container">
131
- <h2>Legend</h2>
132
- <div class="tsd-legend-group">
133
- <ul class="tsd-legend">
134
- <li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
135
- <li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
136
- <li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
137
- <li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
138
- <li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
139
- </ul>
140
- <ul class="tsd-legend">
141
- <li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
142
- <li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
143
- </ul>
144
- <ul class="tsd-legend">
145
- <li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
146
- </ul>
147
- </div>
148
- </div>
149
- </footer>
150
- <div class="container tsd-generator">
151
- <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
152
- </div>
153
- <div class="overlay"></div>
154
- <script src="../assets/js/main.js"></script>
155
- </body>
156
- </html>
@@ -1,231 +0,0 @@
1
- <!doctype html>
2
- <html class="default no-js">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <title>worker/sodium | @secrecy/lib</title>
7
- <meta name="description" content="Documentation for @secrecy/lib">
8
- <meta name="viewport" content="width=device-width, initial-scale=1">
9
- <link rel="stylesheet" href="../assets/css/main.css">
10
- <script async src="../assets/js/search.js" id="search-script"></script>
11
- </head>
12
- <body>
13
- <header>
14
- <div class="tsd-page-toolbar">
15
- <div class="container">
16
- <div class="table-wrap">
17
- <div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
18
- <div class="field">
19
- <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
20
- <input id="tsd-search-field" type="text" />
21
- </div>
22
- <ul class="results">
23
- <li class="state loading">Preparing search index...</li>
24
- <li class="state failure">The search index is not available</li>
25
- </ul>
26
- <a href="../index.html" class="title">@secrecy/lib</a>
27
- </div>
28
- <div class="table-cell" id="tsd-widgets">
29
- <div id="tsd-filter">
30
- <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
31
- <div class="tsd-filter-group">
32
- <div class="tsd-select" id="tsd-filter-visibility">
33
- <span class="tsd-select-label">All</span>
34
- <ul class="tsd-select-list">
35
- <li data-value="public">Public</li>
36
- <li data-value="protected">Public/Protected</li>
37
- <li data-value="private" class="selected">All</li>
38
- </ul>
39
- </div>
40
- <input type="checkbox" id="tsd-filter-inherited" checked />
41
- <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
42
- <input type="checkbox" id="tsd-filter-externals" checked />
43
- <label class="tsd-widget" for="tsd-filter-externals">Externals</label>
44
- </div>
45
- </div>
46
- <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
47
- </div>
48
- </div>
49
- </div>
50
- </div>
51
- <div class="tsd-page-title">
52
- <div class="container">
53
- <ul class="tsd-breadcrumb">
54
- <li>
55
- <a href="../modules.html">@secrecy/lib</a>
56
- </li>
57
- <li>
58
- <a href="worker_sodium.html">worker/sodium</a>
59
- </li>
60
- </ul>
61
- <h1>Module worker/sodium</h1>
62
- </div>
63
- </div>
64
- </header>
65
- <div class="container container-main">
66
- <div class="row">
67
- <div class="col-8 col-content">
68
- <section class="tsd-panel-group tsd-index-group">
69
- <h2>Index</h2>
70
- <section class="tsd-panel tsd-index-panel">
71
- <div class="tsd-index-content">
72
- <section class="tsd-index-section ">
73
- <h3>Functions</h3>
74
- <ul class="tsd-index-list">
75
- <li class="tsd-kind-function tsd-parent-kind-module"><a href="worker_sodium.html#decrypt" class="tsd-kind-icon">decrypt</a></li>
76
- <li class="tsd-kind-function tsd-parent-kind-module"><a href="worker_sodium.html#encrypt" class="tsd-kind-icon">encrypt</a></li>
77
- </ul>
78
- </section>
79
- </div>
80
- </section>
81
- </section>
82
- <section class="tsd-panel-group tsd-member-group ">
83
- <h2>Functions</h2>
84
- <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
85
- <a name="decrypt" class="tsd-anchor"></a>
86
- <h3>decrypt</h3>
87
- <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module">
88
- <li class="tsd-signature tsd-kind-icon">decrypt<span class="tsd-signature-symbol">(</span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span>, dataToDecrypt<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span>, progress<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>progress<span class="tsd-signature-symbol">: </span><a href="crypto_file.html#Progress" class="tsd-signature-type" data-tsd-kind="Type alias">Progress</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Uint8Array</span><span class="tsd-signature-symbol">&gt;</span></li>
89
- </ul>
90
- <ul class="tsd-descriptions">
91
- <li class="tsd-description">
92
- <aside class="tsd-sources">
93
- <ul>
94
- <li>Defined in src/worker/sodium.ts:145</li>
95
- </ul>
96
- </aside>
97
- <h4 class="tsd-parameters-title">Parameters</h4>
98
- <ul class="tsd-parameters">
99
- <li>
100
- <h5>key: <span class="tsd-signature-type">Uint8Array</span></h5>
101
- </li>
102
- <li>
103
- <h5>dataToDecrypt: <span class="tsd-signature-type">Uint8Array</span></h5>
104
- </li>
105
- <li>
106
- <h5><span class="tsd-flag ts-flagOptional">Optional</span> progress: <span class="tsd-signature-symbol">(</span>progress<span class="tsd-signature-symbol">: </span><a href="crypto_file.html#Progress" class="tsd-signature-type" data-tsd-kind="Type alias">Progress</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h5>
107
- <ul class="tsd-parameters">
108
- <li class="tsd-parameter-signature">
109
- <ul class="tsd-signatures tsd-kind-type-literal">
110
- <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>progress<span class="tsd-signature-symbol">: </span><a href="crypto_file.html#Progress" class="tsd-signature-type" data-tsd-kind="Type alias">Progress</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li>
111
- </ul>
112
- <ul class="tsd-descriptions">
113
- <li class="tsd-description">
114
- <h4 class="tsd-parameters-title">Parameters</h4>
115
- <ul class="tsd-parameters">
116
- <li>
117
- <h5>progress: <a href="crypto_file.html#Progress" class="tsd-signature-type" data-tsd-kind="Type alias">Progress</a></h5>
118
- </li>
119
- </ul>
120
- <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
121
- </li>
122
- </ul>
123
- </li>
124
- </ul>
125
- </li>
126
- </ul>
127
- <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Uint8Array</span><span class="tsd-signature-symbol">&gt;</span></h4>
128
- </li>
129
- </ul>
130
- </section>
131
- <section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
132
- <a name="encrypt" class="tsd-anchor"></a>
133
- <h3>encrypt</h3>
134
- <ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module">
135
- <li class="tsd-signature tsd-kind-icon">encrypt<span class="tsd-signature-symbol">(</span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span>, dataToEncrypt<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8Array</span>, progress<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">(</span>progress<span class="tsd-signature-symbol">: </span><a href="crypto_file.html#Progress" class="tsd-signature-type" data-tsd-kind="Type alias">Progress</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="crypto_file.html#EncryptedFile" class="tsd-signature-type" data-tsd-kind="Type alias">EncryptedFile</a><span class="tsd-signature-symbol">&gt;</span></li>
136
- </ul>
137
- <ul class="tsd-descriptions">
138
- <li class="tsd-description">
139
- <aside class="tsd-sources">
140
- <ul>
141
- <li>Defined in src/worker/sodium.ts:98</li>
142
- </ul>
143
- </aside>
144
- <h4 class="tsd-parameters-title">Parameters</h4>
145
- <ul class="tsd-parameters">
146
- <li>
147
- <h5>key: <span class="tsd-signature-type">Uint8Array</span></h5>
148
- </li>
149
- <li>
150
- <h5>dataToEncrypt: <span class="tsd-signature-type">Uint8Array</span></h5>
151
- </li>
152
- <li>
153
- <h5><span class="tsd-flag ts-flagOptional">Optional</span> progress: <span class="tsd-signature-symbol">(</span>progress<span class="tsd-signature-symbol">: </span><a href="crypto_file.html#Progress" class="tsd-signature-type" data-tsd-kind="Type alias">Progress</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h5>
154
- <ul class="tsd-parameters">
155
- <li class="tsd-parameter-signature">
156
- <ul class="tsd-signatures tsd-kind-type-literal">
157
- <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>progress<span class="tsd-signature-symbol">: </span><a href="crypto_file.html#Progress" class="tsd-signature-type" data-tsd-kind="Type alias">Progress</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li>
158
- </ul>
159
- <ul class="tsd-descriptions">
160
- <li class="tsd-description">
161
- <h4 class="tsd-parameters-title">Parameters</h4>
162
- <ul class="tsd-parameters">
163
- <li>
164
- <h5>progress: <a href="crypto_file.html#Progress" class="tsd-signature-type" data-tsd-kind="Type alias">Progress</a></h5>
165
- </li>
166
- </ul>
167
- <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
168
- </li>
169
- </ul>
170
- </li>
171
- </ul>
172
- </li>
173
- </ul>
174
- <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="crypto_file.html#EncryptedFile" class="tsd-signature-type" data-tsd-kind="Type alias">EncryptedFile</a><span class="tsd-signature-symbol">&gt;</span></h4>
175
- </li>
176
- </ul>
177
- </section>
178
- </section>
179
- </div>
180
- <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
181
- <nav class="tsd-navigation primary">
182
- <ul>
183
- <li class=" ">
184
- <a href="../modules.html">Modules</a>
185
- </li>
186
- <li class="current tsd-kind-module">
187
- <a href="worker_sodium.html">worker/sodium</a>
188
- </li>
189
- </ul>
190
- </nav>
191
- <nav class="tsd-navigation secondary menu-sticky">
192
- <ul class="before-current">
193
- <li class=" tsd-kind-function tsd-parent-kind-module">
194
- <a href="worker_sodium.html#decrypt" class="tsd-kind-icon">decrypt</a>
195
- </li>
196
- <li class=" tsd-kind-function tsd-parent-kind-module">
197
- <a href="worker_sodium.html#encrypt" class="tsd-kind-icon">encrypt</a>
198
- </li>
199
- </ul>
200
- </nav>
201
- </div>
202
- </div>
203
- </div>
204
- <footer class="with-border-bottom">
205
- <div class="container">
206
- <h2>Legend</h2>
207
- <div class="tsd-legend-group">
208
- <ul class="tsd-legend">
209
- <li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
210
- <li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
211
- <li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
212
- <li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
213
- <li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
214
- </ul>
215
- <ul class="tsd-legend">
216
- <li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
217
- <li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
218
- </ul>
219
- <ul class="tsd-legend">
220
- <li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
221
- </ul>
222
- </div>
223
- </div>
224
- </footer>
225
- <div class="container tsd-generator">
226
- <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
227
- </div>
228
- <div class="overlay"></div>
229
- <script src="../assets/js/main.js"></script>
230
- </body>
231
- </html>
@@ -1,157 +0,0 @@
1
- <!doctype html>
2
- <html class="default no-js">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <title>worker/workerCodes | @secrecy/lib</title>
7
- <meta name="description" content="Documentation for @secrecy/lib">
8
- <meta name="viewport" content="width=device-width, initial-scale=1">
9
- <link rel="stylesheet" href="../assets/css/main.css">
10
- <script async src="../assets/js/search.js" id="search-script"></script>
11
- </head>
12
- <body>
13
- <header>
14
- <div class="tsd-page-toolbar">
15
- <div class="container">
16
- <div class="table-wrap">
17
- <div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
18
- <div class="field">
19
- <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
20
- <input id="tsd-search-field" type="text" />
21
- </div>
22
- <ul class="results">
23
- <li class="state loading">Preparing search index...</li>
24
- <li class="state failure">The search index is not available</li>
25
- </ul>
26
- <a href="../index.html" class="title">@secrecy/lib</a>
27
- </div>
28
- <div class="table-cell" id="tsd-widgets">
29
- <div id="tsd-filter">
30
- <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
31
- <div class="tsd-filter-group">
32
- <div class="tsd-select" id="tsd-filter-visibility">
33
- <span class="tsd-select-label">All</span>
34
- <ul class="tsd-select-list">
35
- <li data-value="public">Public</li>
36
- <li data-value="protected">Public/Protected</li>
37
- <li data-value="private" class="selected">All</li>
38
- </ul>
39
- </div>
40
- <input type="checkbox" id="tsd-filter-inherited" checked />
41
- <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
42
- <input type="checkbox" id="tsd-filter-externals" checked />
43
- <label class="tsd-widget" for="tsd-filter-externals">Externals</label>
44
- </div>
45
- </div>
46
- <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
47
- </div>
48
- </div>
49
- </div>
50
- </div>
51
- <div class="tsd-page-title">
52
- <div class="container">
53
- <ul class="tsd-breadcrumb">
54
- <li>
55
- <a href="../modules.html">@secrecy/lib</a>
56
- </li>
57
- <li>
58
- <a href="worker_workerCodes.html">worker/workerCodes</a>
59
- </li>
60
- </ul>
61
- <h1>Module worker/workerCodes</h1>
62
- </div>
63
- </div>
64
- </header>
65
- <div class="container container-main">
66
- <div class="row">
67
- <div class="col-8 col-content">
68
- <section class="tsd-panel-group tsd-index-group">
69
- <h2>Index</h2>
70
- <section class="tsd-panel tsd-index-panel">
71
- <div class="tsd-index-content">
72
- <section class="tsd-index-section ">
73
- <h3>Variables</h3>
74
- <ul class="tsd-index-list">
75
- <li class="tsd-kind-variable tsd-parent-kind-module"><a href="worker_workerCodes.html#workerMd5Script" class="tsd-kind-icon">worker<wbr>Md5<wbr>Script</a></li>
76
- <li class="tsd-kind-variable tsd-parent-kind-module"><a href="worker_workerCodes.html#workerSodiumScript" class="tsd-kind-icon">worker<wbr>Sodium<wbr>Script</a></li>
77
- </ul>
78
- </section>
79
- </div>
80
- </section>
81
- </section>
82
- <section class="tsd-panel-group tsd-member-group ">
83
- <h2>Variables</h2>
84
- <section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-module">
85
- <a name="workerMd5Script" class="tsd-anchor"></a>
86
- <h3><span class="tsd-flag ts-flagConst">Const</span> worker<wbr>Md5<wbr>Script</h3>
87
- <div class="tsd-signature tsd-kind-icon">worker<wbr>Md5<wbr>Script<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;importScripts(&#x27;https://cdnjs.cloudflare.com/ajax/libs/spark-md5/3.0.0/spark-md5.min.js&#x27;);\n\nfunction* chunks(arr, n) {\n for (let i &#x3D; 0; i &lt; arr.length; i +&#x3D; n) {\n yield arr.slice(i, i + n);\n }\n}\n\nconst CHUNK_SIZE &#x3D; 8192;\n\nfunction md5(data) {\n const spark &#x3D; new SparkMD5.ArrayBuffer();\n for (const chunk of chunks(data, CHUNK_SIZE)) {\n spark.append(chunk);\n }\n return spark.end();\n}\n\n\nself.onmessage &#x3D; ({ data }) &#x3D;&gt; {\n switch (data.event) {\n case \&quot;md5\&quot;: {\n postMessage({\n event: \&quot;md5-result\&quot;,\n data: md5(data.data)\n });\n break;\n }\n }\n}&quot;</span><span class="tsd-signature-symbol"> = ...</span></div>
88
- <aside class="tsd-sources">
89
- <ul>
90
- <li>Defined in src/worker/workerCodes.ts:215</li>
91
- </ul>
92
- </aside>
93
- </section>
94
- <section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-module">
95
- <a name="workerSodiumScript" class="tsd-anchor"></a>
96
- <h3><span class="tsd-flag ts-flagConst">Const</span> worker<wbr>Sodium<wbr>Script</h3>
97
- <div class="tsd-signature tsd-kind-icon">worker<wbr>Sodium<wbr>Script<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;let sodium;\n\nself.sodium &#x3D; {\n onload: (sod) &#x3D;&gt; {\n sodium &#x3D; sod\n postMessage({ event: \&quot;ready\&quot; })\n }\n};\n\nimportScripts(&#x27;https://cdn.jsdelivr.net/gh/jedisct1/libsodium.js@master/dist/browsers/sodium.js&#x27;);\nimportScripts(&#x27;https://cdnjs.cloudflare.com/ajax/libs/spark-md5/3.0.0/spark-md5.min.js&#x27;);\n\nfunction* chunks(arr, n) {\n for (let i &#x3D; 0; i &lt; arr.length; i +&#x3D; n) {\n yield arr.slice(i, i + n);\n }\n}\n\nfunction assert(c, message) {\n if (!c) {\n throw new Error(message);\n }\n}\n\nfunction encrypt(key) {\n let destroyed &#x3D; false;\n const {\n state,\n header\n } &#x3D; sodium.crypto_secretstream_xchacha20poly1305_init_push(key);\n\n const encrypt &#x3D; (tag, plaintext) &#x3D;&gt; {\n assert(destroyed &#x3D;&#x3D;&#x3D; false, \&quot;state already destroyed\&quot;);\n\n return sodium.crypto_secretstream_xchacha20poly1305_push(\n state,\n plaintext,\n null,\n tag\n );\n };\n\n function destroy() {\n assert(destroyed &#x3D;&#x3D;&#x3D; false, \&quot;state already destroyed\&quot;);\n destroyed &#x3D; true;\n }\n\n return {\n encrypt,\n destroy,\n header\n };\n}\n\nfunction decrypt(header, key) {\n assert(\n header.byteLength &gt;&#x3D;\n sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES,\n \&quot;header must be at least HEADERBYTES (\&quot; + sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES + \&quot;) long\&quot;\n );\n assert(\n key.byteLength &gt;&#x3D; sodium.crypto_secretstream_xchacha20poly1305_KEYBYTES,\n \&quot;key must be at least KEYBYTES (\&quot; + sodium.crypto_secretstream_xchacha20poly1305_KEYBYTES + \&quot;) long\&quot;\n );\n\n let destroyed &#x3D; false;\n const state &#x3D; sodium.crypto_secretstream_xchacha20poly1305_init_pull(\n header,\n key\n );\n\n const decrypt &#x3D; ciphertext &#x3D;&gt; {\n assert(destroyed &#x3D;&#x3D;&#x3D; false, \&quot;state already destroyed\&quot;);\n\n return sodium.crypto_secretstream_xchacha20poly1305_pull(state, ciphertext);\n };\n\n function destroy() {\n assert(destroyed &#x3D;&#x3D;&#x3D; false, \&quot;state already destroyed\&quot;);\n destroyed &#x3D; true;\n }\n\n return {\n decrypt,\n destroy\n };\n}\n\nconst CHUNK_SIZE &#x3D; 8192;\n\nasync function encryptSecretstream(key, data, progress) {\n const { encrypt: crypt, destroy, header } &#x3D; encrypt(key);\n const cryptedChunk &#x3D;\n CHUNK_SIZE + sodium.crypto_secretstream_xchacha20poly1305_ABYTES;\n const max &#x3D;\n Math.ceil(data.byteLength / CHUNK_SIZE) * cryptedChunk + header.byteLength;\n\n progress?.({\n percent: 0,\n total: max,\n current: 0\n });\n const final &#x3D; new Uint8Array(max);\n const sparkEncrypted &#x3D; new SparkMD5.ArrayBuffer();\n const spark &#x3D; new SparkMD5.ArrayBuffer();\n\n final.set(header);\n sparkEncrypted.append(header);\n let total &#x3D; header.byteLength;\n progress?.({\n percent: total / max,\n total: max,\n current: total\n });\n\n for (const chunk of chunks(data, CHUNK_SIZE)) {\n spark.append(chunk);\n const tag &#x3D;\n chunk.length &lt; CHUNK_SIZE\n ? sodium.crypto_secretstream_xchacha20poly1305_TAG_FINAL\n : sodium.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE;\n const crypted &#x3D; crypt(tag, chunk);\n sparkEncrypted.append(crypted);\n final.set(crypted, total);\n total +&#x3D; crypted.byteLength;\n progress?.({\n percent: total / max,\n total: max,\n current: total\n });\n }\n\n destroy();\n progress?.({\n percent: 1,\n total,\n current: total\n });\n return {\n data: final.slice(0, total),\n md5Encrypted: sparkEncrypted.end(),\n md5: spark.end()\n };\n}\n\nasync function decryptSecretstream(key, data, progress) {\n const header &#x3D; data.slice(\n 0,\n sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES\n );\n data &#x3D; data.slice(sodium.crypto_secretstream_xchacha20poly1305_HEADERBYTES);\n\n const { decrypt: decryptt, destroy } &#x3D; decrypt(header, key);\n const chunkSize &#x3D;\n CHUNK_SIZE + sodium.crypto_secretstream_xchacha20poly1305_ABYTES;\n const max &#x3D; Math.ceil(data.byteLength / chunkSize) * CHUNK_SIZE;\n\n progress?.({\n percent: 0,\n total: max,\n current: 0\n });\n const final &#x3D; new Uint8Array(max);\n let total &#x3D; 0;\n\n for (const chunk of chunks(data, chunkSize)) {\n const tmp &#x3D; decryptt(chunk);\n final.set(tmp.message, total);\n total +&#x3D; tmp.message.byteLength;\n progress?.({\n percent: total / max,\n total: max,\n current: total\n });\n }\n\n destroy();\n progress?.({\n percent: 1,\n total,\n current: total\n });\n return final.slice(0, total);\n}\n\nself.onmessage &#x3D; async ({ data }) &#x3D;&gt; {\n switch (data.event) {\n case \&quot;encrypt\&quot;: {\n postMessage({ event: \&quot;working\&quot; })\n postMessage({\n event: \&quot;encrypt-result\&quot;,\n data: await encryptSecretstream(data.key, data.data, progress &#x3D;&gt; postMessage({\n event: \&quot;encrypt-progress\&quot;,\n data: progress\n }))\n });\n postMessage({ event: \&quot;ready\&quot; })\n break;\n }\n case \&quot;decrypt\&quot;: {\n postMessage({ event: \&quot;working\&quot; })\n postMessage({\n event: \&quot;decrypt-result\&quot;,\n data: await decryptSecretstream(data.key, data.data, progress &#x3D;&gt; postMessage({\n event: \&quot;decrypt-progress\&quot;,\n data: progress\n }))\n });\n postMessage({ event: \&quot;ready\&quot; })\n break;\n }\n }\n}&quot;</span><span class="tsd-signature-symbol"> = ...</span></div>
98
- <aside class="tsd-sources">
99
- <ul>
100
- <li>Defined in src/worker/workerCodes.ts:1</li>
101
- </ul>
102
- </aside>
103
- </section>
104
- </section>
105
- </div>
106
- <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
107
- <nav class="tsd-navigation primary">
108
- <ul>
109
- <li class=" ">
110
- <a href="../modules.html">Modules</a>
111
- </li>
112
- <li class="current tsd-kind-module">
113
- <a href="worker_workerCodes.html">worker/worker<wbr>Codes</a>
114
- </li>
115
- </ul>
116
- </nav>
117
- <nav class="tsd-navigation secondary menu-sticky">
118
- <ul class="before-current">
119
- <li class=" tsd-kind-variable tsd-parent-kind-module">
120
- <a href="worker_workerCodes.html#workerMd5Script" class="tsd-kind-icon">worker<wbr>Md5<wbr>Script</a>
121
- </li>
122
- <li class=" tsd-kind-variable tsd-parent-kind-module">
123
- <a href="worker_workerCodes.html#workerSodiumScript" class="tsd-kind-icon">worker<wbr>Sodium<wbr>Script</a>
124
- </li>
125
- </ul>
126
- </nav>
127
- </div>
128
- </div>
129
- </div>
130
- <footer class="with-border-bottom">
131
- <div class="container">
132
- <h2>Legend</h2>
133
- <div class="tsd-legend-group">
134
- <ul class="tsd-legend">
135
- <li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
136
- <li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
137
- <li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
138
- <li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
139
- <li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
140
- </ul>
141
- <ul class="tsd-legend">
142
- <li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
143
- <li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
144
- </ul>
145
- <ul class="tsd-legend">
146
- <li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
147
- </ul>
148
- </div>
149
- </div>
150
- </footer>
151
- <div class="container tsd-generator">
152
- <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
153
- </div>
154
- <div class="overlay"></div>
155
- <script src="../assets/js/main.js"></script>
156
- </body>
157
- </html>