@shieldfive/crypto 1.0.0-alpha.6 → 1.0.0-alpha.7

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/CHANGELOG.md CHANGED
@@ -5,6 +5,31 @@ All notable changes to `@shieldfive/crypto` will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.0-alpha.7] — 2026-05
9
+
10
+ ### Dependencies
11
+
12
+ - Bump `@noble/post-quantum` from `^0.5.3` (resolved 0.5.4) to
13
+ `^0.6.0` (resolves to 0.6.1). The upstream maintainer self-audit
14
+ released alongside 0.6.1 (April 2026) covers the line ShieldFive
15
+ now ships; the 0.5.x line predates the self-audit. The pinned
16
+ `10_ml_kem_keypair_derivation` test vector in
17
+ `tests/vectors/vectors.json` is byte-identical under 0.6.1 and
18
+ 0.5.4 (both implement final FIPS 203 ML-KEM-1024), so no vector
19
+ refresh was required. Wire format and on-disk format are
20
+ byte-identical to prior alphas for the same plaintext, key, and
21
+ file_id inputs.
22
+
23
+ ### Documentation
24
+
25
+ - README dependency acknowledgement rewritten to accurately
26
+ describe the noble-post-quantum version (^0.6.0, resolving to
27
+ 0.6.1) and audit status (upstream self-audit April 2026; no
28
+ independent external audit of either the upstream library or
29
+ the ShieldFive PQ-hybrid construction on top of it). Closes the
30
+ audit punch-list item under `audit/launch/cho-deep-audit-2026-05-19`
31
+ § P0-7.
32
+
8
33
  ## [1.0.0-alpha.6] — 2026-05
9
34
 
10
35
  ### Added
@@ -53,7 +78,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
53
78
  principals" section enumerating share-link recipients, expanded
54
79
  metadata-leakage list, and a recovery-key-compromise paragraph
55
80
  under "Out of scope". See
56
- [crypto#4](https://github.com/shieldfive/crypto/pull/4) for the
81
+ [crypto#4](https://github.com/shieldfive/crypto/commit/bb967cb) for the
57
82
  detailed diff. Docs-only; no wire-format or code changes.
58
83
 
59
84
  ## [1.0.0-alpha.3] — 2026-05
@@ -140,4 +165,6 @@ The first public release.
140
165
  [1.0.0-alpha.3]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.2...v1.0.0-alpha.3
141
166
  [1.0.0-alpha.4]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.3...v1.0.0-alpha.4
142
167
  [1.0.0-alpha.5]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.4...v1.0.0-alpha.5
143
- [Unreleased]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.5...HEAD
168
+ [1.0.0-alpha.6]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.5...v1.0.0-alpha.6
169
+ [1.0.0-alpha.7]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.6...v1.0.0-alpha.7
170
+ [Unreleased]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.7...HEAD
package/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2026 ShieldFive Labs
189
+ Copyright 2026 ShieldFive
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > [ShieldFive](https://shieldfive.com), released as a standalone library.
6
6
 
7
7
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
8
- [![Tests](https://img.shields.io/badge/tests-126%2F126-brightgreen.svg)](tests/)
8
+ [![Tests](https://img.shields.io/badge/tests-155%2F155-brightgreen.svg)](tests/)
9
9
  [![Status](https://img.shields.io/badge/status-alpha-orange.svg)](#status)
10
10
 
11
11
  ## Status & honest scope
@@ -17,7 +17,7 @@ treat this library as a serious work-in-progress rather than a finished
17
17
  product.
18
18
 
19
19
  The design choices documented in [`spec/`](spec/) are deliberate and
20
- reviewable. The implementation is covered by 126 passing tests including
20
+ reviewable. The implementation is covered by 155 passing tests including
21
21
  truncation, reordering, splice, and tampering detection across all four
22
22
  suites. That is enough for internal dogfooding. It is **not** enough to
23
23
  claim "most secure crypto library" — that claim requires external review
@@ -32,7 +32,7 @@ spec section that documents the choice.
32
32
 
33
33
  | Property | This library | Proton OpenPGP.js | Internxt SDK | MEGA SDK |
34
34
  | ------------------------------------------ | :----------: | :---------------: | :----------: | :------: |
35
- | Post-quantum hybrid by default | ✅ | ❌ | ⚠️ | ❌ |
35
+ | Post-quantum hybrid by default | ✅ | ⚠️ | ⚠️ | ❌ |
36
36
  | ML-KEM-1024 (NIST PQC level 5) | ✅ | ❌ | ❌ (Kyber-512) | ❌ |
37
37
  | Self-describing on-disk file format | ✅ | ✅ | ⚠️ | ⚠️ |
38
38
  | Cipher-suite agile (one byte selects) | ✅ | ⚠️ | ❌ | ❌ |
@@ -43,7 +43,12 @@ spec section that documents the choice.
43
43
  | Apache 2.0 (patent grant) | ✅ | ⚠️ (LGPL) | ⚠️ | ⚠️ |
44
44
 
45
45
  ⚠️ = partial or feature-flagged. See [`spec/threat-model.md`](spec/threat-model.md)
46
- for the comparison methodology and source citations.
46
+ for the comparison methodology and source citations. Proton OpenPGP.js
47
+ added optional post-quantum (ML-KEM + ECC hybrid) support via OpenPGP v6
48
+ in May 2026 (proton.me/blog/introducing-post-quantum-encryption); it is
49
+ opt-in, not default — hence ⚠️ rather than ✅ in the table. Comparison
50
+ cells reflect publicly available specifications and audit reports as of
51
+ 2026-05-18 and will be updated as upstreams change.
47
52
 
48
53
  ## Quick start
49
54
 
@@ -134,6 +139,25 @@ const plaintext = await decryptV0({
134
139
 
135
140
  There is no `encryptV0`. New writes must use a v1 suite.
136
141
 
142
+ ### Decrypting an exported ShieldFive backup
143
+
144
+ A ShieldFive user can export their account at any time and
145
+ decrypt the resulting bundle offline using this library plus the
146
+ small Node script that ships at
147
+ [shieldfive.com/export](https://shieldfive.com/export). The
148
+ recipe walks the key hierarchy (master password → user key →
149
+ root key → folder keys → per-file content keys), re-derives the
150
+ ML-KEM-1024 secret for Suite 0x03 files deterministically from
151
+ the root key (per `spec/key-derivation.md`), and feeds each blob
152
+ into `autoDecryptBlob` here.
153
+
154
+ The recipe and the script live in the web repository so that the
155
+ documented version stays in lock-step with the API surface; this
156
+ library is the decryption primitive the script depends on. If
157
+ you want to reproduce the path from first principles (with no
158
+ ShieldFive code in the loop), `spec/format-v1.md` and
159
+ `spec/key-derivation.md` together describe everything needed.
160
+
137
161
  ## File format
138
162
 
139
163
  The complete v1 wire format is documented in
@@ -213,7 +237,7 @@ Requires Node 20+.
213
237
 
214
238
  **Alpha.** The wire format is frozen for the v1 release, but the public
215
239
  TypeScript API may make small adjustments before 1.0.0 stable. Test
216
- coverage is comprehensive (64 tests, all four suites, all architectural
240
+ coverage is comprehensive (155 tests, all four suites, all architectural
217
241
  guarantees verified). A formal third-party security audit is planned for
218
242
  the 1.0.0 stable milestone — until that audit lands, treat this library
219
243
  as a serious work-in-progress rather than a finished product.
@@ -233,9 +257,19 @@ in good faith are protected under the safe-harbor clause.
233
257
  ## Acknowledgements
234
258
 
235
259
  - [@noble/post-quantum](https://github.com/paulmillr/noble-post-quantum)
236
- by Paul Miller — clean, audited ML-KEM-1024 implementation.
260
+ by Paul Miller — clean, minimal ML-KEM-1024 (FIPS 203)
261
+ implementation. ShieldFive pins `^0.6.0`, which resolves to the 0.6.1
262
+ release. Upstream completed a maintainer self-audit at 0.6.1 in
263
+ April 2026 (see the
264
+ ["Security"](https://github.com/paulmillr/noble-post-quantum#security)
265
+ section of the upstream README) and has **not** been independently
266
+ audited by an external firm. ShieldFive's PQ-hybrid construction on
267
+ top of the library — the HKDF-SHA-256 combiner that mixes the
268
+ classical and ML-KEM shares — has also not received an independent
269
+ external audit. A third-party audit of the ShieldFive layer is
270
+ planned for the v1.0.0 stable milestone.
237
271
  - [libsodium](https://github.com/jedisct1/libsodium) — XChaCha20-Poly1305
238
272
  and XSalsa20-Poly1305 secretbox.
239
273
  - The NIST PQC competition and FIPS 203 authors.
240
274
 
241
- — *ShieldFive Labs*
275
+ — Cho Garcia, maintainer
package/SECURITY.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Security Policy
2
2
 
3
- ShieldFive Labs takes the security of `@shieldfive/crypto` seriously. This
3
+ ShieldFive takes the security of `@shieldfive/crypto` seriously. This
4
4
  document describes how to report a vulnerability, what we commit to, and
5
5
  the safe-harbor terms for security researchers.
6
6
 
@@ -10,8 +10,11 @@ the safe-harbor terms for security researchers.
10
10
  us directly:
11
11
 
12
12
  - **Email:** `security@shieldfive.com`
13
- - **PGP key fingerprint:** *(to be published at v1.0.0 stable release)*
14
- - **Public PGP key:** `https://shieldfive.com/.well-known/security/pgp-key.txt`
13
+ - **PGP key:** Not yet published. Encrypt with a temporary key on
14
+ request, or send in plaintext — we'd rather know about the issue
15
+ than have it sit in your inbox. The permanent PGP key fingerprint
16
+ will be published at v1.0.0 stable release alongside the URL
17
+ `https://shieldfive.com/.well-known/security/pgp-key.txt`.
15
18
 
16
19
  If you cannot encrypt the report, send it in plaintext anyway — we would
17
20
  rather hear about a vulnerability in plaintext than not at all. We will
@@ -120,4 +123,4 @@ with their consent.)
120
123
 
121
124
  ---
122
125
 
123
- Last updated: v1.0.0-alpha.1
126
+ Last updated: v1.0.0-alpha.7
@@ -33,6 +33,14 @@ export interface PqHybridV1EncryptStreamOptions {
33
33
  /**
34
34
  * Combined content key from `encapsulateForRecipient`. 32 bytes. Used
35
35
  * both for header MAC and for chunk AEAD.
36
+ *
37
+ * SECURITY: Possession of `combinedKey` grants permanent decryption
38
+ * capability for any file whose header was produced with it. Treat
39
+ * as cryptographic secret material: hold only in memory for the
40
+ * duration of the operation, do not persist to disk or storage, do
41
+ * not log, do not transmit. The only safe way to reproduce it on
42
+ * another machine is to re-encapsulate via the recipient's ML-KEM
43
+ * public key.
36
44
  */
37
45
  combinedKey: Uint8Array;
38
46
  /** 16-byte file_id used as HKDF salt in encapsulation and key derivation. */
@@ -47,7 +55,17 @@ export interface PqHybridV1EncryptStreamOptions {
47
55
  export interface PqHybridV1EncryptStreamResult {
48
56
  /** TransformStream<Uint8Array, Uint8Array> emitting the v1 wire format. */
49
57
  stream: TransformStream<Uint8Array, Uint8Array>;
50
- /** The combined key used (echoed back for caller convenience). */
58
+ /**
59
+ * SECURITY: Possession of `combinedKey` grants permanent decryption
60
+ * capability for any file whose header was produced with it. Treat
61
+ * as cryptographic secret material: hold only in memory for the
62
+ * duration of the operation, do not persist to disk or storage, do
63
+ * not log, do not transmit. The only safe way to reproduce it on
64
+ * another machine is to re-encapsulate via the recipient's ML-KEM
65
+ * public key.
66
+ *
67
+ * Echoed back for caller convenience.
68
+ */
51
69
  combinedKey: Uint8Array;
52
70
  /** The file_id used (echoed back for caller convenience). */
53
71
  fileId: Uint8Array;
@@ -93,6 +111,14 @@ export type PqHybridV1DecryptStreamOptions = {
93
111
  * verification + per-chunk AEAD. Header MAC validation still
94
112
  * cryptographically gates the rest of the stream, so a wrong K
95
113
  * fails fast.
114
+ *
115
+ * SECURITY: Possession of `combinedKey` grants permanent decryption
116
+ * capability for any file whose header was produced with it. Treat
117
+ * as cryptographic secret material: hold only in memory for the
118
+ * duration of the operation, do not persist to disk or storage, do
119
+ * not log, do not transmit. The only safe way to reproduce it on
120
+ * another machine is to re-encapsulate via the recipient's ML-KEM
121
+ * public key.
96
122
  */
97
123
  combinedKey: Uint8Array;
98
124
  recipientSecretKey?: undefined;
@@ -129,11 +155,22 @@ export interface EncryptStreamPqHybridV1Options {
129
155
  }
130
156
  /**
131
157
  * Pipe a ReadableStream<Uint8Array> through the PQ-hybrid-v1 encrypt
132
- * transform and return the resulting ReadableStream + the materials the
133
- * caller will need to store alongside the file (file_id) or share back
134
- * to the sender's records (combined key, suite payload).
158
+ * transform and return the resulting ReadableStream alongside the
159
+ * derived material the caller will need: the 16-byte file_id (safe
160
+ * to persist with the ciphertext), the suite payload (safe to
161
+ * persist with the ciphertext; required for later decapsulation),
162
+ * and the 32-byte combined key.
163
+ *
164
+ * SECURITY: The returned `combinedKey` grants permanent decryption
165
+ * capability for any file whose header was produced with it. Treat
166
+ * as cryptographic secret material: hold only in memory for the
167
+ * duration of the operation, do not persist to disk or storage, do
168
+ * not log, do not transmit. The only safe way to reproduce it on
169
+ * another machine is to re-encapsulate via the recipient's ML-KEM
170
+ * public key.
135
171
  *
136
- * This helper is async because PQ encapsulation requires libsodium init.
172
+ * This helper is async because PQ encapsulation requires libsodium
173
+ * init.
137
174
  */
138
175
  export declare function encryptStreamPqHybridV1(source: ReadableStream<Uint8Array>, options: EncryptStreamPqHybridV1Options): Promise<{
139
176
  ciphertext: ReadableStream<Uint8Array>;
@@ -1 +1 @@
1
- {"version":3,"file":"pq-hybrid-v1.d.ts","sourceRoot":"","sources":["../../src/streams/pq-hybrid-v1.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AA+BH,MAAM,WAAW,8BAA8B;IAC7C,0EAA0E;IAC1E,aAAa,EAAE,MAAM,CAAA;IACrB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,WAAW,EAAE,UAAU,CAAA;IACvB,6EAA6E;IAC7E,MAAM,EAAE,UAAU,CAAA;IAClB;;;;OAIG;IACH,YAAY,EAAE,UAAU,CAAA;CACzB;AAED,MAAM,WAAW,6BAA6B;IAC5C,2EAA2E;IAC3E,MAAM,EAAE,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IAC/C,kEAAkE;IAClE,WAAW,EAAE,UAAU,CAAA;IACvB,6DAA6D;IAC7D,MAAM,EAAE,UAAU,CAAA;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,8BAA8B,GACtC,6BAA6B,CAuI/B;AAMD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,8BAA8B,GACtC;IACE,uDAAuD;IACvD,kBAA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,MAAM,CAAA;IAClB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,UAAU,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAClC,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC;IACT,UAAU,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;IACtC,WAAW,EAAE,UAAU,CAAA;IACvB,MAAM,EAAE,UAAU,CAAA;IAClB,YAAY,EAAE,UAAU,CAAA;CACzB,CAAC,CA8BD;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAClC,OAAO,EAAE,8BAA8B,GACtC,cAAc,CAAC,UAAU,CAAC,CAE5B"}
@@ -351,11 +351,22 @@ export function createPqHybridV1DecryptStream(options) {
351
351
  }
352
352
  /**
353
353
  * Pipe a ReadableStream<Uint8Array> through the PQ-hybrid-v1 encrypt
354
- * transform and return the resulting ReadableStream + the materials the
355
- * caller will need to store alongside the file (file_id) or share back
356
- * to the sender's records (combined key, suite payload).
354
+ * transform and return the resulting ReadableStream alongside the
355
+ * derived material the caller will need: the 16-byte file_id (safe
356
+ * to persist with the ciphertext), the suite payload (safe to
357
+ * persist with the ciphertext; required for later decapsulation),
358
+ * and the 32-byte combined key.
357
359
  *
358
- * This helper is async because PQ encapsulation requires libsodium init.
360
+ * SECURITY: The returned `combinedKey` grants permanent decryption
361
+ * capability for any file whose header was produced with it. Treat
362
+ * as cryptographic secret material: hold only in memory for the
363
+ * duration of the operation, do not persist to disk or storage, do
364
+ * not log, do not transmit. The only safe way to reproduce it on
365
+ * another machine is to re-encapsulate via the recipient's ML-KEM
366
+ * public key.
367
+ *
368
+ * This helper is async because PQ encapsulation requires libsodium
369
+ * init.
359
370
  */
360
371
  export async function encryptStreamPqHybridV1(source, options) {
361
372
  const { recipientPublicKey, envelopeKey } = options;
@@ -1 +1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AAC,CAAA;IAEF,MAAM,aAAa,GAAmC;QACpD,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,WAAW;QACX,MAAM;QACN,YAAY;KACb,CAAA;IACD,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QACpC,aAAa,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;IAC7C,CAAC;IACD,MAAM,EAAE,MAAM,EAAE,GAAG,6BAA6B,CAAC,aAAa,CAAC,CAAA;IAE/D,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;QACtC,WAAW;QACX,MAAM;QACN,YAAY;KACb,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAkC,EAClC,OAAuC;IAEvC,OAAO,MAAM,CAAC,WAAW,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC,CAAA;AACnE,CAAC"}
@@ -22,6 +22,19 @@ export interface PqHybridEncryptOptions {
22
22
  chunkSize?: number;
23
23
  onProgress?: ProgressCallback;
24
24
  }
25
+ /**
26
+ * Encrypt a Blob under suite 0x03 (PQ-hybrid XChaCha20-Poly1305 +
27
+ * ML-KEM-1024). Returns the encrypted file alongside the combined
28
+ * content key used to produce it.
29
+ *
30
+ * SECURITY: The returned `combinedKey` grants permanent decryption
31
+ * capability for any file whose header was produced with it. Treat
32
+ * as cryptographic secret material: hold only in memory for the
33
+ * duration of the operation, do not persist to disk or storage, do
34
+ * not log, do not transmit. The only safe way to reproduce it on
35
+ * another machine is to re-encapsulate via the recipient's ML-KEM
36
+ * public key.
37
+ */
25
38
  export declare function encryptBlob(options: PqHybridEncryptOptions): Promise<EncryptedFile & {
26
39
  combinedKey: Uint8Array;
27
40
  }>;
@@ -34,6 +47,19 @@ export interface PqHybridDecryptOptions {
34
47
  onProgress?: ProgressCallback;
35
48
  }
36
49
  export declare function decryptBlob(options: PqHybridDecryptOptions): Promise<Blob>;
50
+ /**
51
+ * Encrypt a Uint8Array under suite 0x03 (PQ-hybrid XChaCha20-Poly1305 +
52
+ * ML-KEM-1024). Returns the encrypted file alongside the combined
53
+ * content key used to produce it.
54
+ *
55
+ * SECURITY: The returned `combinedKey` grants permanent decryption
56
+ * capability for any file whose header was produced with it. Treat
57
+ * as cryptographic secret material: hold only in memory for the
58
+ * duration of the operation, do not persist to disk or storage, do
59
+ * not log, do not transmit. The only safe way to reproduce it on
60
+ * another machine is to re-encapsulate via the recipient's ML-KEM
61
+ * public key.
62
+ */
37
63
  export declare function encryptBytes(bytes: Uint8Array, options: Omit<PqHybridEncryptOptions, 'blob'>): Promise<EncryptedFile & {
38
64
  combinedKey: Uint8Array;
39
65
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/suites/pq-hybrid-v1/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAiBH,OAAO,EAEL,KAAK,aAAa,EAGlB,KAAK,gBAAgB,EAEtB,MAAM,yBAAyB,CAAA;AAchC,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,YAAY,CAAA;AAInB,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,IAAI,CAAA;IACV,sDAAsD;IACtD,kBAAkB,EAAE,UAAU,CAAA;IAC9B,wEAAwE;IACxE,WAAW,EAAE,UAAU,CAAA;IACvB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAC9B;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,aAAa,GAAG;IAAE,WAAW,EAAE,UAAU,CAAA;CAAE,CAAC,CAsEtD;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,IAAI,CAAA;IACV,sDAAsD;IACtD,kBAAkB,EAAE,UAAU,CAAA;IAC9B,6BAA6B;IA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C7B,WAAW,EAAE,UAAU,CAAA;IACvB,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAC9B;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAsGf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,GAC5C,OAAO,CAAC,aAAa,GAAG;IAAE,WAAW,EAAE,UAAU,CAAA;CAAE,CAAC,CAGtD;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,CAGrB"}
@@ -23,6 +23,19 @@ import { randomBytes } from '../../internal/runtime.js';
23
23
  // ML-KEM secrets).
24
24
  export { decapsulateFromHeader, encapsulateForRecipient, PQ_HYBRID_V1_SUITE_PAYLOAD_LENGTH, } from './index.js';
25
25
  const LENGTH_PREFIX_BYTES = 4;
26
+ /**
27
+ * Encrypt a Blob under suite 0x03 (PQ-hybrid XChaCha20-Poly1305 +
28
+ * ML-KEM-1024). Returns the encrypted file alongside the combined
29
+ * content key used to produce it.
30
+ *
31
+ * SECURITY: The returned `combinedKey` grants permanent decryption
32
+ * capability for any file whose header was produced with it. Treat
33
+ * as cryptographic secret material: hold only in memory for the
34
+ * duration of the operation, do not persist to disk or storage, do
35
+ * not log, do not transmit. The only safe way to reproduce it on
36
+ * another machine is to re-encapsulate via the recipient's ML-KEM
37
+ * public key.
38
+ */
26
39
  export async function encryptBlob(options) {
27
40
  const { blob, recipientPublicKey, envelopeKey, onProgress } = options;
28
41
  if (!(blob instanceof Blob)) {
@@ -153,6 +166,19 @@ export async function decryptBlob(options) {
153
166
  onProgress?.(1);
154
167
  return new Blob(plaintextParts, { type: 'application/octet-stream' });
155
168
  }
169
+ /**
170
+ * Encrypt a Uint8Array under suite 0x03 (PQ-hybrid XChaCha20-Poly1305 +
171
+ * ML-KEM-1024). Returns the encrypted file alongside the combined
172
+ * content key used to produce it.
173
+ *
174
+ * SECURITY: The returned `combinedKey` grants permanent decryption
175
+ * capability for any file whose header was produced with it. Treat
176
+ * as cryptographic secret material: hold only in memory for the
177
+ * duration of the operation, do not persist to disk or storage, do
178
+ * not log, do not transmit. The only safe way to reproduce it on
179
+ * another machine is to re-encapsulate via the recipient's ML-KEM
180
+ * public key.
181
+ */
156
182
  export async function encryptBytes(bytes, options) {
157
183
  const blob = new Blob([asBlobPart(bytes)]);
158
184
  return encryptBlob({ blob, ...options });
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/suites/pq-hybrid-v1/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,wBAAwB,EACxB,WAAW,EACX,eAAe,EACf,WAAW,GACZ,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,iCAAiC,EACjC,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,uBAAuB,EACvB,YAAY,GACb,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,kBAAkB,EAElB,YAAY,EACZ,gBAAgB,EAEhB,KAAK,GACN,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,UAAU,EACV,YAAY,EACZ,QAAQ,GACT,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAEvD,wEAAwE;AACxE,oEAAoE;AACpE,kEAAkE;AAClE,uEAAuE;AACvE,sEAAsE;AACtE,mBAAmB;AACnB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,YAAY,CAAA;AAEnB,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAa7B,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAA+B;IAE/B,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,GA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.0.0-alpha.7",
4
4
  "description": "Open, audited-ready, post-quantum-hybrid client-side encryption for cloud storage. The cryptographic core of ShieldFive.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -25,7 +25,7 @@
25
25
  "webcrypto",
26
26
  "cloud-storage"
27
27
  ],
28
- "author": "ShieldFive Labs <security@shieldfive.com>",
28
+ "author": "Cho Garcia <security@shieldfive.com>",
29
29
  "exports": {
30
30
  ".": {
31
31
  "types": "./dist/index.d.ts",
@@ -105,7 +105,7 @@
105
105
  }
106
106
  },
107
107
  "dependencies": {
108
- "@noble/post-quantum": "^0.5.3"
108
+ "@noble/post-quantum": "^0.6.0"
109
109
  },
110
110
  "devDependencies": {
111
111
  "@types/node": "^22.10.0",
@@ -50,7 +50,7 @@ A2 cannot:
50
50
  [`format-v1.md` § "Suite payloads"](./format-v1.md#suite-payloads)
51
51
  for each suite's derivations. file_id is NOT in chunk AAD; the
52
52
  binding is structural — see
53
- [crypto PR #1](https://github.com/shieldfive/crypto/pull/1) for the
53
+ [crypto PR #1](https://github.com/shieldfive/crypto/commit/f3f52ba) for the
54
54
  test vector pinning this behavior).
55
55
 
56
56
  #### Legacy v0 data
@@ -183,17 +183,21 @@ backup obtains the same access as the user.
183
183
 
184
184
  | Product | File AEAD | PQ | Truncation detection | Format self-describing |
185
185
  | -------------------------------- | ------------------------------------------- | ----------------------------- | ----------------------------------------------- | ---------------------- |
186
- | Proton Drive | AES-256-GCM (chunked) | None (as of audit dates) | Application layer only | No (DB-side metadata) |
186
+ | Proton Drive | AES-256-GCM (chunked) | Proton Mail (sibling product) added optional PQ via OpenPGP v6 in May 2026; Proton Drive's on-disk format had not adopted PQ as of 2026-05-18 | Application layer only | No (DB-side metadata) |
187
187
  | Internxt | AES-256-CTR + Kyber-512 hybrid | Kyber-512 (≈AES-128 PQ) | N/A (CTR is unauthenticated; integrity layered) | Partial |
188
188
  | MEGA | AES-128-CCM, Ed25519 sigs | None | Application layer | Partial |
189
189
  | Tresorit | AES-256-GCM, ECC | None (as of public docs) | Application layer | Proprietary |
190
190
  | **ShieldFive (v1, suite 0x03)†** | **XChaCha20-Poly1305 + ML-KEM-1024 hybrid** | **ML-KEM-1024 (≈AES-256 PQ)** | **AEAD-bound** | **Yes** |
191
191
 
192
192
  This table reflects publicly available specifications and audit reports as
193
- of the v1 specification date. It is updated when those specifications
194
- change. This is not a security claim about which product is "best" — each
195
- makes different tradeoffs — but it documents the design positions ShieldFive
196
- v1 takes deliberately.
193
+ of 2026-05-18 (last access date). It is updated when those specifications
194
+ change — for example, Proton Mail (sibling product to Proton Drive)
195
+ launched optional post-quantum encryption via OpenPGP v6 in May 2026
196
+ (proton.me/blog/introducing-post-quantum-encryption); the Proton Drive
197
+ on-disk wire format had not adopted PQ as of the access date. This is not
198
+ a security claim about which product is "best" — each makes different
199
+ tradeoffs — but it documents the design positions ShieldFive v1 takes
200
+ deliberately.
197
201
 
198
202
  † Suite `0x03` is available in the crypto library (1.0.0-alpha.3) and
199
203
  is the format-v1 spec default; the production web client has not yet
@@ -63,6 +63,14 @@ export interface PqHybridV1EncryptStreamOptions {
63
63
  /**
64
64
  * Combined content key from `encapsulateForRecipient`. 32 bytes. Used
65
65
  * both for header MAC and for chunk AEAD.
66
+ *
67
+ * SECURITY: Possession of `combinedKey` grants permanent decryption
68
+ * capability for any file whose header was produced with it. Treat
69
+ * as cryptographic secret material: hold only in memory for the
70
+ * duration of the operation, do not persist to disk or storage, do
71
+ * not log, do not transmit. The only safe way to reproduce it on
72
+ * another machine is to re-encapsulate via the recipient's ML-KEM
73
+ * public key.
66
74
  */
67
75
  combinedKey: Uint8Array
68
76
  /** 16-byte file_id used as HKDF salt in encapsulation and key derivation. */
@@ -78,7 +86,17 @@ export interface PqHybridV1EncryptStreamOptions {
78
86
  export interface PqHybridV1EncryptStreamResult {
79
87
  /** TransformStream<Uint8Array, Uint8Array> emitting the v1 wire format. */
80
88
  stream: TransformStream<Uint8Array, Uint8Array>
81
- /** The combined key used (echoed back for caller convenience). */
89
+ /**
90
+ * SECURITY: Possession of `combinedKey` grants permanent decryption
91
+ * capability for any file whose header was produced with it. Treat
92
+ * as cryptographic secret material: hold only in memory for the
93
+ * duration of the operation, do not persist to disk or storage, do
94
+ * not log, do not transmit. The only safe way to reproduce it on
95
+ * another machine is to re-encapsulate via the recipient's ML-KEM
96
+ * public key.
97
+ *
98
+ * Echoed back for caller convenience.
99
+ */
82
100
  combinedKey: Uint8Array
83
101
  /** The file_id used (echoed back for caller convenience). */
84
102
  fileId: Uint8Array
@@ -269,6 +287,14 @@ export type PqHybridV1DecryptStreamOptions =
269
287
  * verification + per-chunk AEAD. Header MAC validation still
270
288
  * cryptographically gates the rest of the stream, so a wrong K
271
289
  * fails fast.
290
+ *
291
+ * SECURITY: Possession of `combinedKey` grants permanent decryption
292
+ * capability for any file whose header was produced with it. Treat
293
+ * as cryptographic secret material: hold only in memory for the
294
+ * duration of the operation, do not persist to disk or storage, do
295
+ * not log, do not transmit. The only safe way to reproduce it on
296
+ * another machine is to re-encapsulate via the recipient's ML-KEM
297
+ * public key.
272
298
  */
273
299
  combinedKey: Uint8Array
274
300
  recipientSecretKey?: undefined
@@ -515,11 +541,22 @@ export interface EncryptStreamPqHybridV1Options {
515
541
 
516
542
  /**
517
543
  * Pipe a ReadableStream<Uint8Array> through the PQ-hybrid-v1 encrypt
518
- * transform and return the resulting ReadableStream + the materials the
519
- * caller will need to store alongside the file (file_id) or share back
520
- * to the sender's records (combined key, suite payload).
544
+ * transform and return the resulting ReadableStream alongside the
545
+ * derived material the caller will need: the 16-byte file_id (safe
546
+ * to persist with the ciphertext), the suite payload (safe to
547
+ * persist with the ciphertext; required for later decapsulation),
548
+ * and the 32-byte combined key.
549
+ *
550
+ * SECURITY: The returned `combinedKey` grants permanent decryption
551
+ * capability for any file whose header was produced with it. Treat
552
+ * as cryptographic secret material: hold only in memory for the
553
+ * duration of the operation, do not persist to disk or storage, do
554
+ * not log, do not transmit. The only safe way to reproduce it on
555
+ * another machine is to re-encapsulate via the recipient's ML-KEM
556
+ * public key.
521
557
  *
522
- * This helper is async because PQ encapsulation requires libsodium init.
558
+ * This helper is async because PQ encapsulation requires libsodium
559
+ * init.
523
560
  */
524
561
  export async function encryptStreamPqHybridV1(
525
562
  source: ReadableStream<Uint8Array>,
@@ -66,6 +66,19 @@ export interface PqHybridEncryptOptions {
66
66
  onProgress?: ProgressCallback
67
67
  }
68
68
 
69
+ /**
70
+ * Encrypt a Blob under suite 0x03 (PQ-hybrid XChaCha20-Poly1305 +
71
+ * ML-KEM-1024). Returns the encrypted file alongside the combined
72
+ * content key used to produce it.
73
+ *
74
+ * SECURITY: The returned `combinedKey` grants permanent decryption
75
+ * capability for any file whose header was produced with it. Treat
76
+ * as cryptographic secret material: hold only in memory for the
77
+ * duration of the operation, do not persist to disk or storage, do
78
+ * not log, do not transmit. The only safe way to reproduce it on
79
+ * another machine is to re-encapsulate via the recipient's ML-KEM
80
+ * public key.
81
+ */
69
82
  export async function encryptBlob(
70
83
  options: PqHybridEncryptOptions,
71
84
  ): Promise<EncryptedFile & { combinedKey: Uint8Array }> {
@@ -255,6 +268,19 @@ export async function decryptBlob(
255
268
  return new Blob(plaintextParts, { type: 'application/octet-stream' })
256
269
  }
257
270
 
271
+ /**
272
+ * Encrypt a Uint8Array under suite 0x03 (PQ-hybrid XChaCha20-Poly1305 +
273
+ * ML-KEM-1024). Returns the encrypted file alongside the combined
274
+ * content key used to produce it.
275
+ *
276
+ * SECURITY: The returned `combinedKey` grants permanent decryption
277
+ * capability for any file whose header was produced with it. Treat
278
+ * as cryptographic secret material: hold only in memory for the
279
+ * duration of the operation, do not persist to disk or storage, do
280
+ * not log, do not transmit. The only safe way to reproduce it on
281
+ * another machine is to re-encapsulate via the recipient's ML-KEM
282
+ * public key.
283
+ */
258
284
  export async function encryptBytes(
259
285
  bytes: Uint8Array,
260
286
  options: Omit<PqHybridEncryptOptions, 'blob'>,