sealnet 3.1.1 → 3.2.1

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.
package/README.md CHANGED
@@ -12,6 +12,11 @@ npm install sealnet
12
12
 
13
13
  Works in modern browsers and Node.js ≥ 20.
14
14
 
15
+ The crypto core is `seal_crypto.wasm`, shipped in the package's `dist`. Node
16
+ reads it next to the SDK's code; an app that bundles `sealnet` keeps the file
17
+ where its build puts it and names that place before the first key operation:
18
+ `configureWasm({ path })`, or `configureWasm({ module })` in a Worker.
19
+
15
20
  ### No build step? Use the script tag
16
21
 
17
22
  The npm package leaves its two dependencies external, so it needs a bundler.
@@ -20,8 +25,8 @@ and the SDK arrives as one global.
20
25
 
21
26
  ```html
22
27
  <script
23
- src="https://seal.net/sdk/v3.1.1/seal.js"
24
- integrity="sha384-4pS2jav0xvLH34aYt9AP/qDFunAYLF/U3j/CxEAn1L0LBBq3rPDaFRFcPxfaFYz3"
28
+ src="https://seal.net/sdk/v3.2.1/seal.js"
29
+ integrity="sha384-ATE9Q23AuTZ5Nf4e30SSgMm7jyQZ1AE1VrjfTyQgKraiHeQZluYqEyyAnFc6Pilj"
25
30
  crossorigin="anonymous"
26
31
  ></script>
27
32
  <script>
@@ -44,6 +49,13 @@ Load it from `seal.net` only. Serving it from a third-party CDN would make
44
49
  the end-to-end guarantee depend on that CDN's account security rather than
45
50
  on SEAL's.
46
51
 
52
+ **A page with a Content-Security-Policy** lets the script work with
53
+ `script-src https://seal.net 'wasm-unsafe-eval'` (the script, and its crypto
54
+ core compiled from WebAssembly) and `connect-src https://seal.net
55
+ https://api.seal.net https://*.r2.cloudflarestorage.com` (the core's file next
56
+ to the script, the SEAL API, and the storage the API signs each upload and
57
+ download to).
58
+
47
59
  ## Sending
48
60
 
49
61
  ```typescript
@@ -127,8 +139,18 @@ sender's name. Memory stays flat whatever the size.
127
139
  ```typescript
128
140
  const saved = await seal.open(link, { to: './downloads' })
129
141
  saved.files // [{ name, mime, secret, path, sizeBytes, sha256 }]
142
+ saved.message // the sender's note, or null
143
+ saved.refused // the files that did not come, each { name, error }; absent when every one came
130
144
  ```
131
145
 
146
+ One refused file does not stop the others. A refusal of the file's own (its
147
+ sender took it back, its downloads are spent, it did not check) names it in
148
+ `refused`, and the next file is read. A refusal of the whole seal (revoked,
149
+ expired) ends the reading and names every file not asked. A busy server is
150
+ asked once more. `open` throws only when nothing was written. The files that
151
+ came may have taken the seal's open, so read `refused` before you let the link
152
+ go.
153
+
132
154
  Without `to`, each file downloads when you read it, as a stream. The stream
133
155
  fails if the file was changed or cut: keep nothing you wrote from a stream
134
156
  that errored.
@@ -173,6 +195,9 @@ answer.files[0].path // the value stays in the file
173
195
 
174
196
  A link addressed to your address opens with `open(link, { keyPair: keys })`.
175
197
 
198
+ Pass `ask.url` on whole. The part after `#` is your address: it never reaches
199
+ the server, and the page seals the answer to that address alone.
200
+
176
201
  The eight words name your address to the person (`fingerprint_words.json`):
177
202
  the same address gives the same words in every SEAL client.
178
203
 
@@ -194,7 +219,8 @@ const inbox = await seal.inbox({ keyPair: keys, wait: 60 }) // waits up to 60 s
194
219
  for (const item of inbox.items) {
195
220
  // item: { id, fromWords (eight words of the sender, or null), label, receivedAt, expiresAt }
196
221
  const saved = await seal.open(item, { keyPair: keys, to: './downloads' })
197
- await seal.dismiss(item, { keyPair: keys })
222
+ // An item whose files did not all come stays: it is the way back to them.
223
+ if (!saved.refused) await seal.dismiss(item, { keyPair: keys })
198
224
  }
199
225
  ```
200
226
 
@@ -204,20 +230,23 @@ to wait for the next change instead of the next item.
204
230
  ## A person's SEAL inbox
205
231
 
206
232
  A person keeps their own inbox at box.seal.net. Connect your address to it once:
207
- they open the page, compare the eight words and connect. From then on pass
208
- their address as `owner` and every seal you send also lands in their inbox,
209
- where they manage and revoke it; pass it as `to` to `request` and the request
210
- waits there as a card.
233
+ they open the page, compare the eight words and connect. Then show them the
234
+ eight words of the inbox that answered: anyone who saw the link could answer
235
+ it first, and only the person can tell their inbox's words from another's. Once
236
+ they say the words match the ones their inbox shows, pass its address as
237
+ `owner` and every seal you send also lands in their inbox, where they manage and
238
+ revoke it; pass it as `to` to `request` and the request waits there as a card.
211
239
 
212
240
  ```typescript
213
241
  const pairing = await seal.pair({ keyPair: keys, name: 'Report bot' })
214
242
  show(pairing.url, pairing.words) // the page shows the same eight words
215
- const inbox = await pairing.wait() // { address, name }
243
+ const inbox = await pairing.wait() // { address, name, words }
244
+ await confirm(inbox.words) // the person's inbox shows the same eight words
216
245
 
217
246
  const sent = await seal.send({ file, filename: 'report.pdf', ttl: '1d', owner: inbox.address, keyPair: keys })
218
247
  sent.ownerCopy // true: it is in their inbox (false if the inbox has no published key or refused; the seal is sent anyway)
219
248
 
220
- await seal.request({ what: 'Brave API key', recipientBundle: keys.bundle, to: inbox.address })
249
+ await seal.request({ what: 'Brave API key', recipientBundle: keys.bundle, to: inbox.address }) // only their inbox answers it
221
250
  ```
222
251
 
223
252
  ## Error handling
@@ -1,4 +1,4 @@
1
- sealnet 3.1.1 — third-party notices
1
+ sealnet 3.2.1 — third-party notices
2
2
 
3
3
  The standalone browser build (dist/seal.global.js, also published at
4
4
  https://seal.net/sdk/v<version>/seal.js) bundles the software below.