@shieldfive/crypto 1.0.0-alpha.3 → 1.0.0-alpha.6
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 +56 -2
- package/dist/format/header.d.ts +13 -0
- package/dist/format/header.d.ts.map +1 -1
- package/dist/format/header.js +38 -11
- package/dist/format/header.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/types.d.ts +2 -0
- package/dist/internal/types.d.ts.map +1 -1
- package/dist/internal/types.js +2 -0
- package/dist/internal/types.js.map +1 -1
- package/dist/kdf/argon2id.d.ts.map +1 -1
- package/dist/kdf/argon2id.js +2 -1
- package/dist/kdf/argon2id.js.map +1 -1
- package/dist/streams/pq-hybrid-v1.d.ts +151 -0
- package/dist/streams/pq-hybrid-v1.d.ts.map +1 -0
- package/dist/streams/pq-hybrid-v1.js +397 -0
- package/dist/streams/pq-hybrid-v1.js.map +1 -0
- package/dist/suites/aes-gcm-v1/api.d.ts.map +1 -1
- package/dist/suites/aes-gcm-v1/api.js +4 -2
- package/dist/suites/aes-gcm-v1/api.js.map +1 -1
- package/dist/suites/pq-hybrid-v1/api.d.ts +1 -0
- package/dist/suites/pq-hybrid-v1/api.d.ts.map +1 -1
- package/dist/suites/pq-hybrid-v1/api.js +7 -0
- package/dist/suites/pq-hybrid-v1/api.js.map +1 -1
- package/dist/suites/pq-hybrid-v1/index.js +1 -1
- package/dist/suites/pq-hybrid-v1/index.js.map +1 -1
- package/dist/suites/xchacha-v1/api.d.ts.map +1 -1
- package/dist/suites/xchacha-v1/api.js +4 -1
- package/dist/suites/xchacha-v1/api.js.map +1 -1
- package/package.json +5 -1
- package/spec/format-v1.md +102 -13
- package/spec/key-derivation.md +49 -4
- package/spec/threat-model.md +99 -13
- package/src/format/header.ts +43 -11
- package/src/index.ts +1 -1
- package/src/internal/types.ts +2 -0
- package/src/kdf/argon2id.ts +2 -1
- package/src/streams/pq-hybrid-v1.ts +575 -0
- package/src/suites/aes-gcm-v1/api.ts +5 -3
- package/src/suites/pq-hybrid-v1/api.ts +12 -0
- package/src/suites/pq-hybrid-v1/index.ts +1 -1
- package/src/suites/xchacha-v1/api.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,9 +5,61 @@ 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.6] — 2026-05
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `./streams/pq-hybrid-v1` — `createPqHybridV1DecryptStream` now accepts
|
|
13
|
+
a pre-derived 32-byte combined key K via a new `combinedKey` option,
|
|
14
|
+
in lieu of the `recipientSecretKey` + `envelopeKey` pair. When present,
|
|
15
|
+
the stream skips ML-KEM decapsulation and uses K directly for header
|
|
16
|
+
MAC verification and per-chunk AEAD. The header MAC check still
|
|
17
|
+
cryptographically gates the rest of the stream, so a wrong K fails
|
|
18
|
+
fast. Unblocks Suite 0x03 share-link recipients: they unwrap K under
|
|
19
|
+
the share-link password and never touch ML-KEM material. The
|
|
20
|
+
`PqHybridV1DecryptStreamOptions` type is now a discriminated union
|
|
21
|
+
over the two key-input modes; existing callers that pass
|
|
22
|
+
`recipientSecretKey` + `envelopeKey` are unaffected.
|
|
23
|
+
- `./pq-hybrid-v1` (and `pqHybridV1` namespace on the umbrella entry) —
|
|
24
|
+
`decapsulateFromHeader`, `encapsulateForRecipient`, and the
|
|
25
|
+
`PQ_HYBRID_V1_SUITE_PAYLOAD_LENGTH` constant are now publicly
|
|
26
|
+
re-exported from the suite's public surface (`api.ts`). The previous
|
|
27
|
+
release exposed them only on the internal `index.js` path. Lets
|
|
28
|
+
callers that hold the parsed `suite_payload` + KEM material (e.g.,
|
|
29
|
+
share-link generators that need to derive K out-of-band) reach the
|
|
30
|
+
primitives without importing from a deep internal path.
|
|
31
|
+
|
|
32
|
+
## [1.0.0-alpha.5] — 2026-05
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- `./streams/pq-hybrid-v1` — TransformStream factory for streaming
|
|
37
|
+
encrypt/decrypt under Suite 0x03 (ML-KEM-1024 + XChaCha20-Poly1305).
|
|
38
|
+
Same shape as `./streams/aes-gcm-v1`, suite primitive swapped. Unblocks
|
|
39
|
+
the web app's Phase 3 implementation (Step 14) per the design doc at
|
|
40
|
+
`web/docs/phase3-design.md`.
|
|
41
|
+
|
|
42
|
+
## [1.0.0-alpha.4] — 2026-05
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- Threat model (`spec/threat-model.md`) expanded to cover gaps surfaced
|
|
47
|
+
by internal review Task 3: explicit TLS-termination boundary in A2,
|
|
48
|
+
HKDF-structural splice-resistance prose (replacing the incorrect
|
|
49
|
+
"file_id AAD" wording that paralleled Task 1 Finding 1.1),
|
|
50
|
+
legacy-v0 AEAD-invariant carve-out under A2, A3
|
|
51
|
+
current-deployment-status subsection + comparison-table footnote
|
|
52
|
+
(suite `0x03` not yet wired into the web client), new "Trust
|
|
53
|
+
principals" section enumerating share-link recipients, expanded
|
|
54
|
+
metadata-leakage list, and a recovery-key-compromise paragraph
|
|
55
|
+
under "Out of scope". See
|
|
56
|
+
[crypto#4](https://github.com/shieldfive/crypto/pull/4) for the
|
|
57
|
+
detailed diff. Docs-only; no wire-format or code changes.
|
|
58
|
+
|
|
8
59
|
## [1.0.0-alpha.3] — 2026-05
|
|
9
60
|
|
|
10
61
|
### Fixed
|
|
62
|
+
|
|
11
63
|
- Repository URLs in `package.json`, README, and CHANGELOG now correctly
|
|
12
64
|
point at github.com/shieldfive/crypto. The previous metadata referenced
|
|
13
65
|
github.com/shieldfive-labs, which was never actually created.
|
|
@@ -68,7 +120,7 @@ The first public release.
|
|
|
68
120
|
successful header MAC verification proves the right content key was
|
|
69
121
|
supplied before any chunk is processed.
|
|
70
122
|
- Post-quantum hybrid construction: an adversary must break both
|
|
71
|
-
ML-KEM-1024
|
|
123
|
+
ML-KEM-1024 _and_ the classical wrap to compromise a file. ML-KEM-1024
|
|
72
124
|
is FIPS 203 (NIST PQC standard, security category 5).
|
|
73
125
|
|
|
74
126
|
### Known limitations
|
|
@@ -86,4 +138,6 @@ The first public release.
|
|
|
86
138
|
[1.0.0-alpha.1]: https://github.com/shieldfive/crypto/releases/tag/v1.0.0-alpha.1
|
|
87
139
|
[1.0.0-alpha.2]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.1...v1.0.0-alpha.2
|
|
88
140
|
[1.0.0-alpha.3]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.2...v1.0.0-alpha.3
|
|
89
|
-
[
|
|
141
|
+
[1.0.0-alpha.4]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.3...v1.0.0-alpha.4
|
|
142
|
+
[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
|
package/dist/format/header.d.ts
CHANGED
|
@@ -38,6 +38,19 @@ export declare function buildAuthenticatedHeader(input: HeaderInputs, contentKey
|
|
|
38
38
|
*
|
|
39
39
|
* Two-phase parse-then-verify keeps the parser usable for tooling that
|
|
40
40
|
* inspects encrypted files without holding the key.
|
|
41
|
+
*
|
|
42
|
+
* parseHeader does not verify the header MAC. For non-KEM suites
|
|
43
|
+
* (0x01 aes-gcm-v1, 0x02 xchacha-v1), callers MUST call
|
|
44
|
+
* verifyHeaderMac BEFORE doing anything with parsed.suitePayload,
|
|
45
|
+
* including length checks, field extraction, or downstream parsing.
|
|
46
|
+
* KEM suites (0x03 pq-hybrid-v1) cannot follow this rule by
|
|
47
|
+
* construction; see spec/format-v1.md § "0x03 — pq-hybrid" for the
|
|
48
|
+
* required ordering and security argument.
|
|
49
|
+
*
|
|
50
|
+
* Cross-field consistency (totalChunks / chunkSize / plaintextSize) is
|
|
51
|
+
* enforced here via `assertHeaderConsistency`. The same helper runs in
|
|
52
|
+
* `validateHeaderInputs` so encode and decode share one source of
|
|
53
|
+
* truth; both paths MUST stay in sync.
|
|
41
54
|
*/
|
|
42
55
|
export declare function parseHeader(input: Uint8Array): ParsedHeader & {
|
|
43
56
|
unauthenticatedBytes: Uint8Array;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/format/header.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAUL,KAAK,YAAY,EAEjB,KAAK,OAAO,EACb,MAAM,sBAAsB,CAAA;AAkB7B,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,UAAU,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,UAAU,CAAA;CACzB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,CAa1E;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,UAAU,CAAC,CAOrB;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,UAAU,CAAC,CAKrB;AAED
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/format/header.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAUL,KAAK,YAAY,EAEjB,KAAK,OAAO,EACb,MAAM,sBAAsB,CAAA;AAkB7B,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,UAAU,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,UAAU,CAAA;CACzB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,CAa1E;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,UAAU,CAAC,CAOrB;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,UAAU,CAAC,CAKrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,GAAG;IAC7D,oBAAoB,EAAE,UAAU,CAAA;IAChC,GAAG,EAAE,UAAU,CAAA;CAChB,CA0EA;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,EACtC,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CAUf;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,GACf,UAAU,CAaZ;AAqED,gFAAgF;AAChF,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBACT,IAAI,EAAE,MAAM;CAKzB"}
|
package/dist/format/header.js
CHANGED
|
@@ -61,6 +61,19 @@ export async function buildAuthenticatedHeader(input, contentKey) {
|
|
|
61
61
|
*
|
|
62
62
|
* Two-phase parse-then-verify keeps the parser usable for tooling that
|
|
63
63
|
* inspects encrypted files without holding the key.
|
|
64
|
+
*
|
|
65
|
+
* parseHeader does not verify the header MAC. For non-KEM suites
|
|
66
|
+
* (0x01 aes-gcm-v1, 0x02 xchacha-v1), callers MUST call
|
|
67
|
+
* verifyHeaderMac BEFORE doing anything with parsed.suitePayload,
|
|
68
|
+
* including length checks, field extraction, or downstream parsing.
|
|
69
|
+
* KEM suites (0x03 pq-hybrid-v1) cannot follow this rule by
|
|
70
|
+
* construction; see spec/format-v1.md § "0x03 — pq-hybrid" for the
|
|
71
|
+
* required ordering and security argument.
|
|
72
|
+
*
|
|
73
|
+
* Cross-field consistency (totalChunks / chunkSize / plaintextSize) is
|
|
74
|
+
* enforced here via `assertHeaderConsistency`. The same helper runs in
|
|
75
|
+
* `validateHeaderInputs` so encode and decode share one source of
|
|
76
|
+
* truth; both paths MUST stay in sync.
|
|
64
77
|
*/
|
|
65
78
|
export function parseHeader(input) {
|
|
66
79
|
if (input.length < HEADER_FIXED_PREFIX_LENGTH + HEADER_SIZES.HEADER_MAC) {
|
|
@@ -97,17 +110,7 @@ export function parseHeader(input) {
|
|
|
97
110
|
}
|
|
98
111
|
const plaintextSize = readUint64BE(input, offset);
|
|
99
112
|
offset += HEADER_SIZES.PLAINTEXT_SIZE;
|
|
100
|
-
|
|
101
|
-
if (totalChunks === 0 && plaintextSize !== 0) {
|
|
102
|
-
throw new HeaderError('total_chunks_zero_with_plaintext');
|
|
103
|
-
}
|
|
104
|
-
if (totalChunks > 0) {
|
|
105
|
-
const minPlaintext = (totalChunks - 1) * chunkSize + 1;
|
|
106
|
-
const maxPlaintext = totalChunks * chunkSize;
|
|
107
|
-
if (plaintextSize < minPlaintext || plaintextSize > maxPlaintext) {
|
|
108
|
-
throw new HeaderError('plaintext_size_inconsistent');
|
|
109
|
-
}
|
|
110
|
-
}
|
|
113
|
+
assertHeaderConsistency({ chunkSize, totalChunks, plaintextSize });
|
|
111
114
|
const suitePayloadLen = readUint16BE(input, offset);
|
|
112
115
|
offset += HEADER_SIZES.SUITE_PAYLOAD_LEN;
|
|
113
116
|
if (offset + suitePayloadLen + HEADER_SIZES.HEADER_MAC > input.length) {
|
|
@@ -190,6 +193,30 @@ function validateHeaderInputs(input) {
|
|
|
190
193
|
if (input.suitePayload.length > 0xffff) {
|
|
191
194
|
throw new HeaderError('suite_payload_too_large');
|
|
192
195
|
}
|
|
196
|
+
assertHeaderConsistency({
|
|
197
|
+
chunkSize: input.chunkSize,
|
|
198
|
+
totalChunks: input.totalChunks,
|
|
199
|
+
plaintextSize: input.plaintextSize,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Assert the cross-field invariant tying total_chunks, chunk_size, and
|
|
204
|
+
* plaintext_size together. Shared by `parseHeader` (decode path) and
|
|
205
|
+
* `validateHeaderInputs` (encode path) so both layers reject the same
|
|
206
|
+
* malformed combinations with the same error codes.
|
|
207
|
+
*/
|
|
208
|
+
function assertHeaderConsistency(fields) {
|
|
209
|
+
const { chunkSize, totalChunks, plaintextSize } = fields;
|
|
210
|
+
if (totalChunks === 0 && plaintextSize !== 0) {
|
|
211
|
+
throw new HeaderError('total_chunks_zero_with_plaintext');
|
|
212
|
+
}
|
|
213
|
+
if (totalChunks > 0) {
|
|
214
|
+
const minPlaintext = (totalChunks - 1) * chunkSize + 1;
|
|
215
|
+
const maxPlaintext = totalChunks * chunkSize;
|
|
216
|
+
if (plaintextSize < minPlaintext || plaintextSize > maxPlaintext) {
|
|
217
|
+
throw new HeaderError('plaintext_size_inconsistent');
|
|
218
|
+
}
|
|
219
|
+
}
|
|
193
220
|
}
|
|
194
221
|
/** Recognizable error class so callers can catch parse failures specifically */
|
|
195
222
|
export class HeaderError extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/format/header.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAC1B,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,uBAAuB,CAAC;QACtB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,aAAa,EAAE,KAAK,CAAC,aAAa;KACnC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,uBAAuB,CAAC,MAIhC;IACC,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,MAAM,CAAA;IACxD,IAAI,WAAW,KAAK,CAAC,IAAI,aAAa,KAAK,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,WAAW,CAAC,kCAAkC,CAAC,CAAA;IAC3D,CAAC;IACD,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,YAAY,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC,CAAA;QACtD,MAAM,YAAY,GAAG,WAAW,GAAG,SAAS,CAAA;QAC5C,IAAI,aAAa,GAAG,YAAY,IAAI,aAAa,GAAG,YAAY,EAAE,CAAC;YACjE,MAAM,IAAI,WAAW,CAAC,6BAA6B,CAAC,CAAA;QACtD,CAAC;IACH,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,IAAI,CAAQ;IACrB,YAAY,IAAY;QACtB,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;QACjD,IAAI,CAAC,IAAI,GAAG,aAAa,CAAA;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export interface AutoDecryptOptions {
|
|
|
46
46
|
*/
|
|
47
47
|
export declare function autoDecryptBlob(options: AutoDecryptOptions): Promise<Blob>;
|
|
48
48
|
/** Library version, also written into format documentation. */
|
|
49
|
-
export declare const SHIELDFIVE_CRYPTO_VERSION = "1.0.0-alpha.
|
|
49
|
+
export declare const SHIELDFIVE_CRYPTO_VERSION = "1.0.0-alpha.6";
|
|
50
50
|
/** Default cipher suite for new files when not specified by the caller. */
|
|
51
51
|
export declare const DEFAULT_SUITE: 3;
|
|
52
52
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -118,7 +118,7 @@ export async function autoDecryptBlob(options) {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
/** Library version, also written into format documentation. */
|
|
121
|
-
export const SHIELDFIVE_CRYPTO_VERSION = '1.0.0-alpha.
|
|
121
|
+
export const SHIELDFIVE_CRYPTO_VERSION = '1.0.0-alpha.6';
|
|
122
122
|
/** Default cipher suite for new files when not specified by the caller. */
|
|
123
123
|
export const DEFAULT_SUITE = SUITE.PQ_HYBRID_XCHACHA_MLKEM1024_V1;
|
|
124
124
|
//# sourceMappingURL=index.js.map
|
package/dist/internal/types.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ export declare const HKDF_INFO: Readonly<{
|
|
|
52
52
|
XCHACHA_CHUNK_KEY: "shieldfive/v1/xchacha/chunk-key";
|
|
53
53
|
XCHACHA_NONCE_PREFIX: "shieldfive/v1/xchacha/nonce-prefix";
|
|
54
54
|
PQ_HYBRID_COMBINE: "shieldfive/v1/pq-hybrid/combine";
|
|
55
|
+
ML_KEM_1024_SEED: "shieldfive/v1/pq-hybrid/ml-kem-1024-seed";
|
|
56
|
+
ARGON2ID_SALT_COMPRESSION: "shieldfive/v1/argon2id/salt-compression";
|
|
55
57
|
}>;
|
|
56
58
|
/** AAD domain string mixed into every chunk's authenticator */
|
|
57
59
|
export declare const CHUNK_AAD_DOMAIN = "shieldfive/v1/chunk";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,MAAM,GAAG;IACnB,MAAM,EAAE,YAAY,CAAA;IACpB,eAAe,CAAC,CAAC,SAAS,eAAe,EAAE,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AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA"}
|
package/dist/internal/types.js
CHANGED
|
@@ -58,6 +58,8 @@ export const HKDF_INFO = Object.freeze({
|
|
|
58
58
|
XCHACHA_CHUNK_KEY: 'shieldfive/v1/xchacha/chunk-key',
|
|
59
59
|
XCHACHA_NONCE_PREFIX: 'shieldfive/v1/xchacha/nonce-prefix',
|
|
60
60
|
PQ_HYBRID_COMBINE: 'shieldfive/v1/pq-hybrid/combine',
|
|
61
|
+
ML_KEM_1024_SEED: 'shieldfive/v1/pq-hybrid/ml-kem-1024-seed',
|
|
62
|
+
ARGON2ID_SALT_COMPRESSION: 'shieldfive/v1/argon2id/salt-compression',
|
|
61
63
|
});
|
|
62
64
|
/** AAD domain string mixed into every chunk's authenticator */
|
|
63
65
|
export const CHUNK_AAD_DOMAIN = 'shieldfive/v1/chunk';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,cAAc,EAAE,IAAI;IACpB,qBAAqB,EAAE,IAAI;IAC3B,8BAA8B,EAAE,IAAI;CAC5B,CAAA;AASV,MAAM,CAAC,MAAM,WAAW,GAA+B;IACrD,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,gBAAgB;IACxC,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,uBAAuB;IACtD,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE,gCAAgC;CACzE,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAe,IAAI,UAAU,CAAC;IACrD,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;CAC7B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAEpC,iDAAi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GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,UAAU,EAAE,0BAA0B;IACtC,iBAAiB,EAAE,iCAAiC;IACpD,oBAAoB,EAAE,oCAAoC;IAC1D,iBAAiB,EAAE,iCAAiC;IACpD,oBAAoB,EAAE,oCAAoC;IAC1D,iBAAiB,EAAE,iCAAiC;IACpD,gBAAgB,EAAE,0CAA0C;IAC5D,yBAAyB,EAAE,yCAAyC;CACrE,CAAC,CAAA;AAEF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAA;AACrD,MAAM,CAAC,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argon2id.d.ts","sourceRoot":"","sources":["../../src/kdf/argon2id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"argon2id.d.ts","sourceRoot":"","sources":["../../src/kdf/argon2id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,WAAW,CAAA;AAErD,eAAO,MAAM,mBAAmB,KAAK,CAAA;AACrC,eAAO,MAAM,mBAAmB,KAAK,CAAA;AA4BrC,MAAM,WAAW,uBAAuB;IACtC,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,qDAAqD;IACrD,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC,8EAA8E;IAC9E,YAAY,EAAE,UAAU,CAAA;IACxB,8DAA8D;IAC9D,IAAI,EAAE,UAAU,CAAA;IAChB,4EAA4E;IAC5E,MAAM,EAAE,cAAc,CAAA;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,wBAAwB,CAAC,CA2CnC;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IAChD,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,EAAE,cAAc,CAAA;CACvB,GAAG,OAAO,CAAC,UAAU,CAAC,CAGtB;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE;IAC5C,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,EAAE,cAAc,CAAA;IACtB,oBAAoB,EAAE,UAAU,CAAA;CACjC,GAAG,OAAO,CAAC,OAAO,CAAC,CAQnB"}
|
package/dist/kdf/argon2id.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import { getSodium } from '../internal/sodium.js';
|
|
13
13
|
import { hkdfSha256 } from '../internal/hkdf.js';
|
|
14
14
|
import { randomBytes } from '../internal/runtime.js';
|
|
15
|
+
import { HKDF_INFO } from '../internal/types.js';
|
|
15
16
|
export const ARGON2ID_SALT_BYTES = 16;
|
|
16
17
|
export const MASTER_SECRET_BYTES = 32;
|
|
17
18
|
/** Resolve a preset name to (opslimit, memlimit) using libsodium constants. */
|
|
@@ -56,7 +57,7 @@ export async function deriveMasterSecret(input) {
|
|
|
56
57
|
if (salt.length > ARGON2ID_SALT_BYTES) {
|
|
57
58
|
usableSalt = await hkdfSha256({
|
|
58
59
|
ikm: salt,
|
|
59
|
-
info:
|
|
60
|
+
info: HKDF_INFO.ARGON2ID_SALT_COMPRESSION,
|
|
60
61
|
length: ARGON2ID_SALT_BYTES,
|
|
61
62
|
});
|
|
62
63
|
}
|
package/dist/kdf/argon2id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argon2id.js","sourceRoot":"","sources":["../../src/kdf/argon2id.ts"],"names":[],"mappings":"AAAA;;;;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,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,KAAK,CAAC,CAAA;IAC9C,OAAO,MAAM,CAAC,YAAY,CAAA;AAC5B,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAKtC;IACC,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,KAAK,CAAC,CAAA;IAClD,IAAI,QAAQ,CAAC,MAAM,KAAK,KAAK,CAAC,oBAAoB,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IACvE,IAAI,IAAI,GAAG,CAAC,CAAA;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAE,GAAG,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAE,CAAA;IACvD,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,CAAA;AACnB,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Streaming encrypt/decrypt for the v1 wire format under suite 0x03
|
|
3
|
+
* (PQ-hybrid XChaCha20-Poly1305 + ML-KEM-1024).
|
|
4
|
+
*
|
|
5
|
+
* The whole-blob APIs in `suites/<name>/api.ts` materialize entire files in
|
|
6
|
+
* memory. That's fine for small files; for multi-gigabyte files on a
|
|
7
|
+
* mobile device it isn't.
|
|
8
|
+
*
|
|
9
|
+
* This module exposes a WHATWG TransformStream factory that ingests
|
|
10
|
+
* plaintext (or ciphertext) chunks from any ReadableStream and emits the
|
|
11
|
+
* other side, without ever holding more than one chunk-plus-header in
|
|
12
|
+
* memory at once.
|
|
13
|
+
*
|
|
14
|
+
* Currently implemented:
|
|
15
|
+
* - Suite 0x03 (pq-hybrid-xchacha-mlkem1024-v1) encrypt
|
|
16
|
+
* - Suite 0x03 (pq-hybrid-xchacha-mlkem1024-v1) decrypt
|
|
17
|
+
*
|
|
18
|
+
* Differences from the AES-GCM-v1 streaming module: the encrypt factory
|
|
19
|
+
* requires the caller to pre-run `encapsulateForRecipient` and pass the
|
|
20
|
+
* resulting `{combinedKey, suitePayload, fileId}` — the PQ suite cannot
|
|
21
|
+
* fabricate its own content material the way AES can, because it depends
|
|
22
|
+
* on the recipient's ML-KEM public key. The async helper
|
|
23
|
+
* `encryptStreamPqHybridV1` bundles encapsulation + stream construction.
|
|
24
|
+
* On the decrypt side, the stream itself performs PQ decapsulation as
|
|
25
|
+
* soon as the header has been parsed, then proceeds identically to the
|
|
26
|
+
* AES path.
|
|
27
|
+
*/
|
|
28
|
+
export interface PqHybridV1EncryptStreamOptions {
|
|
29
|
+
/** Total plaintext byte count. Required because the header carries it. */
|
|
30
|
+
plaintextSize: number;
|
|
31
|
+
/** Plaintext bytes per chunk. Default 4 MiB. */
|
|
32
|
+
chunkSize?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Combined content key from `encapsulateForRecipient`. 32 bytes. Used
|
|
35
|
+
* both for header MAC and for chunk AEAD.
|
|
36
|
+
*/
|
|
37
|
+
combinedKey: Uint8Array;
|
|
38
|
+
/** 16-byte file_id used as HKDF salt in encapsulation and key derivation. */
|
|
39
|
+
fileId: Uint8Array;
|
|
40
|
+
/**
|
|
41
|
+
* Suite payload produced by `encapsulateForRecipient` (1664 bytes —
|
|
42
|
+
* 1568-byte ML-KEM ciphertext + 72-byte wrapped classical share + 24-byte
|
|
43
|
+
* classical nonce).
|
|
44
|
+
*/
|
|
45
|
+
suitePayload: Uint8Array;
|
|
46
|
+
}
|
|
47
|
+
export interface PqHybridV1EncryptStreamResult {
|
|
48
|
+
/** TransformStream<Uint8Array, Uint8Array> emitting the v1 wire format. */
|
|
49
|
+
stream: TransformStream<Uint8Array, Uint8Array>;
|
|
50
|
+
/** The combined key used (echoed back for caller convenience). */
|
|
51
|
+
combinedKey: Uint8Array;
|
|
52
|
+
/** The file_id used (echoed back for caller convenience). */
|
|
53
|
+
fileId: Uint8Array;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Build a TransformStream that encrypts plaintext into v1 wire-format
|
|
57
|
+
* ciphertext on the fly under suite 0x03. The stream emits the header
|
|
58
|
+
* first, then each chunk as it arrives.
|
|
59
|
+
*
|
|
60
|
+
* The caller MUST pass `plaintextSize` because the header records it.
|
|
61
|
+
* If the caller doesn't know the size up front, they must accumulate
|
|
62
|
+
* the plaintext into a buffer first — there is no way to write a
|
|
63
|
+
* self-describing header otherwise.
|
|
64
|
+
*
|
|
65
|
+
* Unlike the AES-GCM-v1 factory, the PQ-hybrid factory cannot manufacture
|
|
66
|
+
* its own key material — the combined key, file_id, and suite payload
|
|
67
|
+
* are all outputs of `encapsulateForRecipient`. Use the
|
|
68
|
+
* `encryptStreamPqHybridV1` helper when you'd rather pass a recipient
|
|
69
|
+
* public key directly.
|
|
70
|
+
*/
|
|
71
|
+
export declare function createPqHybridV1EncryptStream(options: PqHybridV1EncryptStreamOptions): PqHybridV1EncryptStreamResult;
|
|
72
|
+
/**
|
|
73
|
+
* Inputs for {@link createPqHybridV1DecryptStream}. Either provide the
|
|
74
|
+
* KEM material (`recipientSecretKey` + `envelopeKey`) so the stream can
|
|
75
|
+
* derive the combined key itself, OR provide the already-derived
|
|
76
|
+
* `combinedKey` directly. The latter is what share-link recipients use:
|
|
77
|
+
* they hold a 32-byte K (wrapped under the share-link password) and
|
|
78
|
+
* never see the ML-KEM secret key.
|
|
79
|
+
*
|
|
80
|
+
* Mixing both modes is not supported — `combinedKey` always wins. The
|
|
81
|
+
* caller is responsible for picking one path.
|
|
82
|
+
*/
|
|
83
|
+
export type PqHybridV1DecryptStreamOptions = {
|
|
84
|
+
/** Recipient's ML-KEM-1024 secret key (3168 bytes). */
|
|
85
|
+
recipientSecretKey: Uint8Array;
|
|
86
|
+
/** Classical envelope key (32 bytes). */
|
|
87
|
+
envelopeKey: Uint8Array;
|
|
88
|
+
combinedKey?: undefined;
|
|
89
|
+
} | {
|
|
90
|
+
/**
|
|
91
|
+
* Pre-derived 32-byte combined key K. When provided, the stream
|
|
92
|
+
* skips ML-KEM decapsulation entirely and uses K for header MAC
|
|
93
|
+
* verification + per-chunk AEAD. Header MAC validation still
|
|
94
|
+
* cryptographically gates the rest of the stream, so a wrong K
|
|
95
|
+
* fails fast.
|
|
96
|
+
*/
|
|
97
|
+
combinedKey: Uint8Array;
|
|
98
|
+
recipientSecretKey?: undefined;
|
|
99
|
+
envelopeKey?: undefined;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Build a TransformStream that decrypts a v1 ciphertext stream produced
|
|
103
|
+
* under suite 0x03 into plaintext. Unlike the whole-blob decryptor, this
|
|
104
|
+
* version processes input incrementally — useful for very large files or
|
|
105
|
+
* when ciphertext arrives chunked over the network.
|
|
106
|
+
*
|
|
107
|
+
* Two key-input modes:
|
|
108
|
+
* - KEM mode (`recipientSecretKey` + `envelopeKey`): the stream runs
|
|
109
|
+
* ML-KEM decapsulation once, the moment the header has been
|
|
110
|
+
* buffered, then proceeds identically to the AES-GCM-v1 decrypt
|
|
111
|
+
* stream.
|
|
112
|
+
* - Combined-key mode (`combinedKey`): skips decapsulation entirely
|
|
113
|
+
* and uses the supplied K for header MAC verification + chunk AEAD.
|
|
114
|
+
* Intended for share-link recipients who hold a wrapped K but no
|
|
115
|
+
* ML-KEM secret.
|
|
116
|
+
*/
|
|
117
|
+
export declare function createPqHybridV1DecryptStream(options: PqHybridV1DecryptStreamOptions): TransformStream<Uint8Array, Uint8Array>;
|
|
118
|
+
export interface EncryptStreamPqHybridV1Options {
|
|
119
|
+
/** Recipient's ML-KEM-1024 public key (1568 bytes) */
|
|
120
|
+
recipientPublicKey: Uint8Array;
|
|
121
|
+
/** Classical envelope key (32 bytes) */
|
|
122
|
+
envelopeKey: Uint8Array;
|
|
123
|
+
/** Total plaintext byte count. Required because the header carries it. */
|
|
124
|
+
plaintextSize: number;
|
|
125
|
+
/** Plaintext bytes per chunk. Default 4 MiB. */
|
|
126
|
+
chunkSize?: number;
|
|
127
|
+
/** Pre-existing 16-byte file_id, or generated if omitted. */
|
|
128
|
+
fileId?: Uint8Array;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 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).
|
|
135
|
+
*
|
|
136
|
+
* This helper is async because PQ encapsulation requires libsodium init.
|
|
137
|
+
*/
|
|
138
|
+
export declare function encryptStreamPqHybridV1(source: ReadableStream<Uint8Array>, options: EncryptStreamPqHybridV1Options): Promise<{
|
|
139
|
+
ciphertext: ReadableStream<Uint8Array>;
|
|
140
|
+
combinedKey: Uint8Array;
|
|
141
|
+
fileId: Uint8Array;
|
|
142
|
+
suitePayload: Uint8Array;
|
|
143
|
+
}>;
|
|
144
|
+
/**
|
|
145
|
+
* Pipe a ReadableStream<Uint8Array> through the PQ-hybrid-v1 decrypt
|
|
146
|
+
* transform and return the resulting plaintext ReadableStream. See
|
|
147
|
+
* {@link PqHybridV1DecryptStreamOptions} for the two key-input modes
|
|
148
|
+
* (KEM secret + envelope vs. pre-derived combined key K).
|
|
149
|
+
*/
|
|
150
|
+
export declare function decryptStreamPqHybridV1(source: ReadableStream<Uint8Array>, options: PqHybridV1DecryptStreamOptions): ReadableStream<Uint8Array>;
|
|
151
|
+
//# sourceMappingURL=pq-hybrid-v1.d.ts.map
|
|
@@ -0,0 +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,EA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