@shieldfive/crypto 1.0.0-beta.4 → 1.0.0-rc.2

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 (38) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +73 -20
  3. package/SECURITY.md +11 -21
  4. package/dist/identity/inbound.d.ts +72 -0
  5. package/dist/identity/inbound.d.ts.map +1 -0
  6. package/dist/identity/inbound.js +120 -0
  7. package/dist/identity/inbound.js.map +1 -0
  8. package/dist/index.d.ts +4 -2
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +2 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/internal/types.d.ts +2 -0
  13. package/dist/internal/types.d.ts.map +1 -1
  14. package/dist/internal/types.js +9 -0
  15. package/dist/internal/types.js.map +1 -1
  16. package/dist/suites/aes-gcm-v0/api.d.ts +2 -1
  17. package/dist/suites/aes-gcm-v0/api.d.ts.map +1 -1
  18. package/dist/suites/aes-gcm-v0/api.js +1 -0
  19. package/dist/suites/aes-gcm-v0/api.js.map +1 -1
  20. package/dist/suites/aes-gcm-v2/api.d.ts +15 -2
  21. package/dist/suites/aes-gcm-v2/api.d.ts.map +1 -1
  22. package/dist/suites/aes-gcm-v2/api.js.map +1 -1
  23. package/dist/suites/pq-hybrid-v1/api.d.ts +6 -6
  24. package/dist/suites/pq-hybrid-v1/api.d.ts.map +1 -1
  25. package/dist/suites/pq-hybrid-v1/api.js +2 -1
  26. package/dist/suites/pq-hybrid-v1/api.js.map +1 -1
  27. package/dist/suites/xchacha-v1/api.d.ts +6 -6
  28. package/dist/suites/xchacha-v1/api.d.ts.map +1 -1
  29. package/dist/suites/xchacha-v1/api.js +2 -1
  30. package/dist/suites/xchacha-v1/api.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/identity/inbound.ts +173 -0
  33. package/src/index.ts +4 -3
  34. package/src/internal/types.ts +9 -0
  35. package/src/suites/aes-gcm-v0/api.ts +2 -1
  36. package/src/suites/aes-gcm-v2/api.ts +15 -2
  37. package/src/suites/pq-hybrid-v1/api.ts +10 -8
  38. package/src/suites/xchacha-v1/api.ts +10 -8
package/CHANGELOG.md CHANGED
@@ -5,6 +5,62 @@ 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-rc.2 — 2026-08-02
9
+
10
+ No wire-format changes; every file written by a `1.0.0-*` release still decrypts
11
+ identically, and suite `0x03` is untouched. Adds a zero-knowledge inbound-intake
12
+ key exchange for the "Request documents" feature.
13
+
14
+ ### Added
15
+
16
+ - **Zero-knowledge inbound intake** (`inbound` module). An account-less sender
17
+ can encrypt a file to a recipient's published keys with no recipient secret,
18
+ and only the recipient can decrypt. The recipient publishes a static X25519
19
+ public key next to its ML-KEM-1024 key; the sender derives the suite-`0x03`
20
+ classical envelope key from an ephemeral-static X25519 ECDH, so the classical
21
+ share stays confidential under X25519 and the PQ share under ML-KEM — an
22
+ attacker must break both. Adds `deriveInboundStaticKeypair`,
23
+ `sealInboundEnvelopeKey`, and `openInboundEnvelopeKey`, plus two dedicated
24
+ HKDF labels. Integration tests cover the sender-to-recipient round trip and
25
+ that breaking either primitive alone fails closed.
26
+
27
+ ## 1.0.0-rc.1 — 2026-07-14
28
+
29
+ Release candidate for `1.0.0`. The v1 wire format and the public TypeScript API
30
+ are frozen; `1.0.0` follows once the RC has soaked. Not externally audited (see
31
+ README "Status"); an internal multi-agent review shipped and its findings are
32
+ fixed. No wire-format changes — every file written by a `1.0.0-*` release
33
+ decrypts identically.
34
+
35
+ ### Added
36
+
37
+ - Published **negative / adversarial test vectors**
38
+ (`tests/vectors/adversarial-vectors.json`): tampered v1 files that a conforming
39
+ decoder MUST reject — bad magic, unknown/confused suite, reserved flags,
40
+ header-field and header-MAC tampering, chunk ciphertext/tag/framing tampering,
41
+ reordering, truncation, and cross-file splice — across all four suites, each
42
+ with a valid control. Generated and self-checked by
43
+ `tests/vectors/generate-adversarial.ts` and enforced by
44
+ `tests/vectors/adversarial-vectors.test.ts`. Companion to the existing positive
45
+ known-answer vectors; lets independent implementations verify the format's
46
+ misuse-resistance guarantees, not just its happy path.
47
+
48
+ ### Changed (non-breaking API consistency)
49
+
50
+ - Suite option types now use one convention: `xchacha-v1` and `pq-hybrid-v1`
51
+ export `EncryptOptions` / `DecryptOptions` (previously `XChaCha*` / `PqHybrid*`
52
+ prefixed), matching `aes-gcm-v1` / `aes-gcm-v2`. No consumer referenced the old
53
+ prefixed type names.
54
+ - `encryptBytes` now accepts `Uint8Array | ArrayBuffer` in every suite
55
+ (previously `xchacha-v1` / `pq-hybrid-v1` accepted only `Uint8Array`).
56
+ Widening only — existing calls are unaffected.
57
+ - Progress callbacks use the exported `ProgressCallback` type consistently
58
+ across `autoDecryptBlob` and the legacy-v0 reader (type-identical).
59
+
60
+ The public umbrella surface — including `parseHeader`, the header builders,
61
+ `identity`, and `migrationV0` — is intentionally unchanged; those remain stable
62
+ top-level exports that downstream consumers depend on.
63
+
8
64
  ## 1.0.0-beta.4 — 2026-07-13
9
65
 
10
66
  ### Security
package/README.md CHANGED
@@ -4,24 +4,38 @@
4
4
  > cipher-suite-agile on-disk format. The cryptographic core of
5
5
  > [ShieldFive](https://shieldfive.com), released as a standalone library.
6
6
 
7
+ [![npm](https://img.shields.io/npm/v/@shieldfive/crypto?logo=npm&color=cb3837)](https://www.npmjs.com/package/@shieldfive/crypto)
7
8
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
8
- [![Tests](https://img.shields.io/badge/tests-188%2F188-brightgreen.svg)](tests/)
9
- [![Status](https://img.shields.io/badge/status-beta-yellow.svg)](#status)
9
+ [![Tests](https://img.shields.io/badge/tests-259%2F259-brightgreen.svg)](tests/)
10
+ [![npm provenance](https://img.shields.io/badge/npm-provenance-blue?logo=npm)](https://www.npmjs.com/package/@shieldfive/crypto)
11
+ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/shieldfive/crypto/badge)](https://securityscorecards.dev/viewer/?uri=github.com/shieldfive/crypto)
12
+ [![Status](https://img.shields.io/badge/status-1.0.0--rc.1-blue.svg)](#status)
13
+ <!-- Once registered at https://www.bestpractices.dev, add the earned badge:
14
+ [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/<ID>/badge)](https://www.bestpractices.dev/projects/<ID>) -->
15
+
10
16
 
11
17
  ## Status & honest scope
12
18
 
13
- This library is **beta**. The wire format is frozen for the v1 release;
14
- the public TypeScript API may make minor adjustments before v1.0.0 stable.
15
- It has **not** undergone external cryptographic audit. Until it does,
16
- treat this library as a serious work-in-progress rather than a finished
17
- product.
19
+ This library is a **release candidate** (`1.0.0-rc.1`). The v1 **wire format
20
+ is frozen** — files written today will decrypt on every future v1 release —
21
+ and the public TypeScript API is now stable; `1.0.0` follows once the RC has
22
+ soaked. `1.0.0` means the API is stable under semantic versioning, **not**
23
+ that the code has been audited. Those are two separate axes and we track them
24
+ separately (see [Status](#status)).
25
+
26
+ **Audit status:** this library has **not** received a paid third-party
27
+ cryptographic audit, and `1.0.0` will not claim one. It has had an internal
28
+ multi-agent review (findings fixed) and publishes reproducible positive and
29
+ adversarial test vectors; an external audit is on the roadmap (we are pursuing
30
+ grant-funded options). [Status](#status) states exactly what has and has not
31
+ been reviewed, and what you can verify yourself without trusting us.
18
32
 
19
33
  The design choices documented in [`spec/`](spec/) are deliberate and
20
- reviewable. The implementation is covered by 188 passing tests including
34
+ reviewable. The implementation is covered by 259 passing tests including
21
35
  truncation, reordering, splice, and tampering detection across all four
22
- suites. That is enough for internal dogfooding. It is **not** enough to
23
- claim "most secure crypto library" — that claim requires external review
24
- this library has not yet received.
36
+ suites. That is enough for internal dogfooding and for building on with
37
+ eyes open. It is **not** enough to claim "most secure crypto library" —
38
+ that claim requires external review this library has not yet received.
25
39
 
26
40
  When this library says it avoids a parallel cryptographic implementation,
27
41
  that scope is the file-content cipher suites. The keyring/envelope layer
@@ -99,8 +113,12 @@ const plaintext = await decryptBlob({
99
113
 
100
114
  ### Encrypt with the WebCrypto-only suite (no WASM dependency)
101
115
 
116
+ Use `aes-gcm-v2` — the current AES-GCM **write** path (also WASM-free). The
117
+ `aes-gcm-v1` subpath is decrypt-only for files written before `v2` existed;
118
+ don't write new files with it.
119
+
102
120
  ```ts
103
- import { encryptBlob, decryptBlob } from '@shieldfive/crypto/aes-gcm-v1'
121
+ import { encryptBlob, decryptBlob } from '@shieldfive/crypto/aes-gcm-v2'
104
122
 
105
123
  const result = await encryptBlob({ blob: file })
106
124
  // result.contentKey is your 32-byte fresh per-file key — store it wrapped
@@ -251,12 +269,46 @@ Requires Node 20+.
251
269
 
252
270
  ## Status
253
271
 
254
- **Beta.** The wire format is frozen for the v1 release, but the public
255
- TypeScript API may make small adjustments before 1.0.0 stable. Test
256
- coverage is comprehensive (188 tests, all four suites, all architectural
257
- guarantees verified). A formal third-party security audit is planned for
258
- the 1.0.0 stable milestone — until that audit lands, treat this library
259
- as a serious work-in-progress rather than a finished product.
272
+ **Release candidate (`1.0.0-rc.1`) — API frozen, format frozen.** This
273
+ section tracks two independent axes; please don't conflate them.
274
+
275
+ **API stability.** The v1 wire format is frozen — files written today
276
+ decrypt on every future v1 release. The public TypeScript API is frozen for
277
+ `1.0.0`; breaking changes will require a major-version bump. `1.0.0` means
278
+ the API is stable under semantic versioning. It does **not** mean "audited."
279
+
280
+ **Audit status (scoped to `v1.0.0-rc.1`).** `@shieldfive/crypto` has
281
+ **not** had a paid third-party security audit. The novel part of the
282
+ design — the post-quantum-hybrid KEM combiner
283
+ `K = HKDF-SHA-256(classical_share ‖ ml_kem_share, salt = file_id)`
284
+ (see [`spec/key-derivation.md`](spec/key-derivation.md)) — uses the same
285
+ concatenation-KDF hybrid pattern as X-Wing and HPKE, but has not yet
286
+ received external cryptographic review. An external audit is on the
287
+ roadmap (grant-funded options are being pursued) and is **not** a
288
+ prerequisite for the `1.0.0` release. When an audit lands it will be cited here
289
+ with the firm, the date, and the exact commit/version reviewed — and this
290
+ notice stays in place for any version that predates that review.
291
+
292
+ **What you can verify without trusting us:**
293
+
294
+ ```bash
295
+ npm audit signatures # npm provenance: tarball ↔ this source commit + CI run
296
+ npm test # 259 tests incl. deterministic KATs + adversarial vectors
297
+ ```
298
+
299
+ The [`tests/vectors/`](tests/vectors/) directory publishes reproducible vectors
300
+ any independent implementation can check against: **positive** known-answer
301
+ vectors ([`vectors.json`](tests/vectors/vectors.json)) that a conforming
302
+ implementation must reproduce bit-for-bit, and **negative / adversarial** vectors
303
+ ([`adversarial-vectors.json`](tests/vectors/adversarial-vectors.json)) — tampered
304
+ files a conforming decoder MUST reject (bad magic, suite confusion, header/chunk
305
+ tampering, reordering, truncation, cross-file splice), each self-checked against
306
+ this implementation at generation time.
307
+
308
+ Plus a published [threat model](spec/threat-model.md) with explicit
309
+ non-goals, a complete [wire-format spec](spec/format-v1.md), and
310
+ reproducible [test vectors](tests/vectors/vectors.json) any independent
311
+ implementation can check against.
260
312
 
261
313
  ## License
262
314
 
@@ -283,8 +335,9 @@ in good faith are protected under the safe-harbor clause.
283
335
  audited by an external firm. ShieldFive's PQ-hybrid construction on
284
336
  top of the library — the HKDF-SHA-256 combiner that mixes the
285
337
  classical and ML-KEM shares — has also not received an independent
286
- external audit. A third-party audit of the ShieldFive layer is
287
- planned for the v1.0.0 stable milestone.
338
+ external audit. A third-party audit of the ShieldFive layer is on the
339
+ roadmap (see [Status](#status)); it is tracked separately from, and is
340
+ not a prerequisite for, the `1.0.0` API-stability milestone.
288
341
  - [libsodium](https://github.com/jedisct1/libsodium) — XChaCha20-Poly1305
289
342
  and XSalsa20-Poly1305 secretbox.
290
343
  - The NIST PQC competition and FIPS 203 authors.
package/SECURITY.md CHANGED
@@ -31,11 +31,8 @@ follow up over an encrypted channel.
31
31
 
32
32
  ## Our commitments
33
33
 
34
- These windows match the public program at
35
- <https://shieldfive.com/security/bug-bounty>, which is the canonical
36
- source; if the two ever differ, the public program governs. They reflect
37
- the realistic capacity of a small team, not aspiration; we will explain
38
- any slippage in writing.
34
+ These windows reflect the realistic capacity of a small team, not
35
+ aspiration; we will explain any slippage in writing.
39
36
 
40
37
  | Step | Commitment |
41
38
  | --------------------- | --------------- |
@@ -67,7 +64,7 @@ We will *not*:
67
64
 
68
65
  - Take legal action against researchers acting in good faith (see
69
66
  Safe Harbor below).
70
- - Demand silence as a condition of bounty or credit.
67
+ - Demand silence as a condition of credit.
71
68
 
72
69
  ## Safe Harbor
73
70
 
@@ -90,21 +87,14 @@ and we will not initiate legal action against you. If a third party
90
87
  initiates legal action against you for activities conducted under this
91
88
  policy, we will make this authorization clear.
92
89
 
93
- ## Bug bounty
90
+ ## Recognition
94
91
 
95
- ShieldFive operates a paid bug bounty program covering this
96
- open-source crypto library. Reward tiers:
97
-
98
- - Critical: up to €1000
99
- - High: up to €500
100
- - Medium: up to €250
101
-
102
- Lower-impact findings receive public credit (CVE, release notes,
103
- dedicated thank-you page) and product credits.
104
-
105
- For current scope, rules of engagement, submission instructions,
106
- and the safe-harbor statement, see
107
- https://shieldfive.com/security/bug-bounty.
92
+ `@shieldfive/crypto` does **not** currently operate a paid bug-bounty
93
+ program. We still want to hear about vulnerabilities, and we recognize
94
+ valid reports with public credit — a CVE where appropriate, attribution in
95
+ the release notes, and a place in the acknowledgements below — with your
96
+ consent, or anonymously if you prefer. Coordinated disclosure and the
97
+ safe-harbor terms above apply to every report.
108
98
 
109
99
  ## Out of scope
110
100
 
@@ -151,4 +141,4 @@ With thanks to the researchers who have reported findings in good faith
151
141
 
152
142
  ---
153
143
 
154
- Last updated: 2026-07-05
144
+ Last updated: 2026-07-14
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Zero-knowledge inbound intake.
3
+ *
4
+ * The PQ-hybrid suite (0x03) derives a file's content key from BOTH an ML-KEM
5
+ * encapsulated share AND a classical share that is secret-box-wrapped under a
6
+ * caller-supplied 32-byte `envelopeKey`. To decrypt, a recipient needs the
7
+ * ML-KEM secret key AND that envelope key — the KEM does not deliver the
8
+ * envelope key.
9
+ *
10
+ * For OUTBOUND files the owner is the recipient and already holds the envelope
11
+ * key (it is the file's own content key). An INBOUND, account-less sender has
12
+ * no firm secret, so it cannot produce an envelope key the firm can later
13
+ * recover. Using a public constant would make the classical share public and
14
+ * collapse the scheme to ML-KEM-only.
15
+ *
16
+ * This module closes that gap WITHOUT touching the frozen suite: the firm
17
+ * publishes a static X25519 public key alongside its ML-KEM public key, and the
18
+ * sender derives the envelope key from an ephemeral↔static X25519 ECDH. The
19
+ * classical share is then confidential under X25519 while the PQ share is
20
+ * confidential under ML-KEM, so an attacker must break BOTH primitives — a
21
+ * genuine hybrid, with the bulk file still produced by the existing
22
+ * `encryptStreamPqHybridV1` / `encryptBlob` path.
23
+ *
24
+ * Trust note: the recipient's published keys are only as trustworthy as the
25
+ * channel that serves them. Browser-delivered code "trusts the served code each
26
+ * load"; pair this with an out-of-band key fingerprint for the strong claim.
27
+ * This module does the cryptography; it does not establish key authenticity.
28
+ */
29
+ /** X25519 public key length (Curve25519 u-coordinate). */
30
+ export declare const X25519_PUBLIC_KEY_LENGTH = 32;
31
+ /** X25519 secret scalar length. */
32
+ export declare const X25519_SECRET_KEY_LENGTH = 32;
33
+ export interface InboundStaticKeypair {
34
+ /** Static X25519 public key (32 bytes) — publish next to the ML-KEM public key. */
35
+ x25519PublicKey: Uint8Array;
36
+ /** Static X25519 secret scalar (32 bytes) — treat as highly sensitive. */
37
+ x25519SecretKey: Uint8Array;
38
+ }
39
+ /**
40
+ * Deterministically derive the firm's static X25519 keypair from its master
41
+ * secret, mirroring how the ML-KEM keypair is derived. The same master secret
42
+ * always yields the same keypair across devices, so losing a device does not
43
+ * orphan received files (as long as the master secret is recoverable).
44
+ */
45
+ export declare function deriveInboundStaticKeypair(masterSecret: Uint8Array): Promise<InboundStaticKeypair>;
46
+ /**
47
+ * Sender side (account-less, in the browser). Given the firm's published static
48
+ * X25519 public key and the file_id used for the upload, produce the classical
49
+ * `envelopeKey` to pass to `encryptStreamPqHybridV1` / `encryptBlob`, plus the
50
+ * ephemeral public key to store alongside the ciphertext so the firm can
51
+ * recover the same envelope key. No firm secret is required.
52
+ */
53
+ export declare function sealInboundEnvelopeKey(options: {
54
+ recipientX25519PublicKey: Uint8Array;
55
+ fileId: Uint8Array;
56
+ }): Promise<{
57
+ envelopeKey: Uint8Array;
58
+ ephemeralPublicKey: Uint8Array;
59
+ }>;
60
+ /**
61
+ * Recipient side (the firm). Recover the same `envelopeKey` from its static
62
+ * X25519 secret key and the sender's ephemeral public key, then feed it (with
63
+ * the ML-KEM secret key) to the standard KEM-mode decrypt path.
64
+ */
65
+ export declare function openInboundEnvelopeKey(options: {
66
+ x25519SecretKey: Uint8Array;
67
+ ephemeralPublicKey: Uint8Array;
68
+ fileId: Uint8Array;
69
+ }): Promise<{
70
+ envelopeKey: Uint8Array;
71
+ }>;
72
+ //# sourceMappingURL=inbound.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound.d.ts","sourceRoot":"","sources":["../../src/identity/inbound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AASH,0DAA0D;AAC1D,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAC1C,mCAAmC;AACnC,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAI1C,MAAM,WAAW,oBAAoB;IACnC,mFAAmF;IACnF,eAAe,EAAE,UAAU,CAAA;IAC3B,0EAA0E;IAC1E,eAAe,EAAE,UAAU,CAAA;CAC5B;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,UAAU,GACvB,OAAO,CAAC,oBAAoB,CAAC,CAa/B;AA0BD;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE;IACpD,wBAAwB,EAAE,UAAU,CAAA;IACpC,MAAM,EAAE,UAAU,CAAA;CACnB,GAAG,OAAO,CAAC;IAAE,WAAW,EAAE,UAAU,CAAC;IAAC,kBAAkB,EAAE,UAAU,CAAA;CAAE,CAAC,CA0BvE;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE;IACpD,eAAe,EAAE,UAAU,CAAA;IAC3B,kBAAkB,EAAE,UAAU,CAAA;IAC9B,MAAM,EAAE,UAAU,CAAA;CACnB,GAAG,OAAO,CAAC;IAAE,WAAW,EAAE,UAAU,CAAA;CAAE,CAAC,CA4BvC"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Zero-knowledge inbound intake.
3
+ *
4
+ * The PQ-hybrid suite (0x03) derives a file's content key from BOTH an ML-KEM
5
+ * encapsulated share AND a classical share that is secret-box-wrapped under a
6
+ * caller-supplied 32-byte `envelopeKey`. To decrypt, a recipient needs the
7
+ * ML-KEM secret key AND that envelope key — the KEM does not deliver the
8
+ * envelope key.
9
+ *
10
+ * For OUTBOUND files the owner is the recipient and already holds the envelope
11
+ * key (it is the file's own content key). An INBOUND, account-less sender has
12
+ * no firm secret, so it cannot produce an envelope key the firm can later
13
+ * recover. Using a public constant would make the classical share public and
14
+ * collapse the scheme to ML-KEM-only.
15
+ *
16
+ * This module closes that gap WITHOUT touching the frozen suite: the firm
17
+ * publishes a static X25519 public key alongside its ML-KEM public key, and the
18
+ * sender derives the envelope key from an ephemeral↔static X25519 ECDH. The
19
+ * classical share is then confidential under X25519 while the PQ share is
20
+ * confidential under ML-KEM, so an attacker must break BOTH primitives — a
21
+ * genuine hybrid, with the bulk file still produced by the existing
22
+ * `encryptStreamPqHybridV1` / `encryptBlob` path.
23
+ *
24
+ * Trust note: the recipient's published keys are only as trustworthy as the
25
+ * channel that serves them. Browser-delivered code "trusts the served code each
26
+ * load"; pair this with an out-of-band key fingerprint for the strong claim.
27
+ * This module does the cryptography; it does not establish key authenticity.
28
+ */
29
+ import { x25519 } from '@noble/curves/ed25519.js';
30
+ import { concatBytes } from '../internal/encoding.js';
31
+ import { hkdfSha256 } from '../internal/hkdf.js';
32
+ import { randomBytes } from '../internal/runtime.js';
33
+ import { HEADER_SIZES, HKDF_INFO } from '../internal/types.js';
34
+ /** X25519 public key length (Curve25519 u-coordinate). */
35
+ export const X25519_PUBLIC_KEY_LENGTH = 32;
36
+ /** X25519 secret scalar length. */
37
+ export const X25519_SECRET_KEY_LENGTH = 32;
38
+ const INBOUND_ENVELOPE_KEY_BYTES = 32;
39
+ /**
40
+ * Deterministically derive the firm's static X25519 keypair from its master
41
+ * secret, mirroring how the ML-KEM keypair is derived. The same master secret
42
+ * always yields the same keypair across devices, so losing a device does not
43
+ * orphan received files (as long as the master secret is recoverable).
44
+ */
45
+ export async function deriveInboundStaticKeypair(masterSecret) {
46
+ if (masterSecret.length < 16) {
47
+ throw new RangeError('deriveInboundStaticKeypair: masterSecret must be at least 16 bytes');
48
+ }
49
+ const seed = await hkdfSha256({
50
+ ikm: masterSecret,
51
+ info: HKDF_INFO.INBOUND_X25519_STATIC_SEED,
52
+ length: X25519_SECRET_KEY_LENGTH,
53
+ });
54
+ const x25519PublicKey = x25519.getPublicKey(seed);
55
+ return { x25519PublicKey, x25519SecretKey: seed };
56
+ }
57
+ /**
58
+ * Derive the per-file envelope key from a shared secret. The full ECDH
59
+ * transcript (shared secret, ephemeral public key, recipient static public key)
60
+ * is bound into the HKDF input and the file_id into the salt, so a captured
61
+ * ephemeral key cannot be replayed against a different recipient or file.
62
+ */
63
+ async function deriveEnvelopeKey(sharedSecret, ephemeralPublicKey, recipientStaticPublicKey, fileId) {
64
+ return hkdfSha256({
65
+ ikm: concatBytes([
66
+ sharedSecret,
67
+ ephemeralPublicKey,
68
+ recipientStaticPublicKey,
69
+ ]),
70
+ salt: fileId,
71
+ info: HKDF_INFO.INBOUND_ENVELOPE,
72
+ length: INBOUND_ENVELOPE_KEY_BYTES,
73
+ });
74
+ }
75
+ /**
76
+ * Sender side (account-less, in the browser). Given the firm's published static
77
+ * X25519 public key and the file_id used for the upload, produce the classical
78
+ * `envelopeKey` to pass to `encryptStreamPqHybridV1` / `encryptBlob`, plus the
79
+ * ephemeral public key to store alongside the ciphertext so the firm can
80
+ * recover the same envelope key. No firm secret is required.
81
+ */
82
+ export async function sealInboundEnvelopeKey(options) {
83
+ const { recipientX25519PublicKey, fileId } = options;
84
+ if (recipientX25519PublicKey.length !== X25519_PUBLIC_KEY_LENGTH) {
85
+ throw new RangeError(`sealInboundEnvelopeKey: recipientX25519PublicKey must be ${X25519_PUBLIC_KEY_LENGTH} bytes`);
86
+ }
87
+ if (fileId.length !== HEADER_SIZES.FILE_ID) {
88
+ throw new RangeError(`sealInboundEnvelopeKey: fileId must be ${HEADER_SIZES.FILE_ID} bytes`);
89
+ }
90
+ const ephemeralSecret = randomBytes(X25519_SECRET_KEY_LENGTH);
91
+ const ephemeralPublicKey = x25519.getPublicKey(ephemeralSecret);
92
+ // Throws on a low-order / all-zero shared secret (contributory behaviour).
93
+ const sharedSecret = x25519.getSharedSecret(ephemeralSecret, recipientX25519PublicKey);
94
+ const envelopeKey = await deriveEnvelopeKey(sharedSecret, ephemeralPublicKey, recipientX25519PublicKey, fileId);
95
+ return { envelopeKey, ephemeralPublicKey };
96
+ }
97
+ /**
98
+ * Recipient side (the firm). Recover the same `envelopeKey` from its static
99
+ * X25519 secret key and the sender's ephemeral public key, then feed it (with
100
+ * the ML-KEM secret key) to the standard KEM-mode decrypt path.
101
+ */
102
+ export async function openInboundEnvelopeKey(options) {
103
+ const { x25519SecretKey, ephemeralPublicKey, fileId } = options;
104
+ if (x25519SecretKey.length !== X25519_SECRET_KEY_LENGTH) {
105
+ throw new RangeError(`openInboundEnvelopeKey: x25519SecretKey must be ${X25519_SECRET_KEY_LENGTH} bytes`);
106
+ }
107
+ if (ephemeralPublicKey.length !== X25519_PUBLIC_KEY_LENGTH) {
108
+ throw new RangeError(`openInboundEnvelopeKey: ephemeralPublicKey must be ${X25519_PUBLIC_KEY_LENGTH} bytes`);
109
+ }
110
+ if (fileId.length !== HEADER_SIZES.FILE_ID) {
111
+ throw new RangeError(`openInboundEnvelopeKey: fileId must be ${HEADER_SIZES.FILE_ID} bytes`);
112
+ }
113
+ // Recompute the static public key from the secret so the transcript binding
114
+ // matches the sender's byte-for-byte.
115
+ const recipientStaticPublicKey = x25519.getPublicKey(x25519SecretKey);
116
+ const sharedSecret = x25519.getSharedSecret(x25519SecretKey, ephemeralPublicKey);
117
+ const envelopeKey = await deriveEnvelopeKey(sharedSecret, ephemeralPublicKey, recipientStaticPublicKey, fileId);
118
+ return { envelopeKey };
119
+ }
120
+ //# sourceMappingURL=inbound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound.js","sourceRoot":"","sources":["../../src/identity/inbound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAE9D,0DAA0D;AAC1D,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAC1C,mCAAmC;AACnC,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAE1C,MAAM,0BAA0B,GAAG,EAAE,CAAA;AASrC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,YAAwB;IAExB,IAAI,YAAY,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QAC7B,MAAM,IAAI,UAAU,CAClB,oEAAoE,CACrE,CAAA;IACH,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC;QAC5B,GAAG,EAAE,YAAY;QACjB,IAAI,EAAE,SAAS,CAAC,0BAA0B;QAC1C,MAAM,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;IACD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAA;AAC5C,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,OAI5C;IACC,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;IAC/D,IAAI,eAAe,CAAC,MAAM,KAAK,wBAAwB,EAAE,CAAC;QACxD,MAAM,IAAI,UAAU,CAClB,mDAAmD,wBAAwB,QAAQ,CACpF,CAAA;IACH,CAAC;IACD,IAAI,kBAAkB,CAAC,MAAM,KAAK,wBAAwB,EAAE,CAAC;QAC3D,MAAM,IAAI,UAAU,CAClB,sDAAsD,wBAAwB,QAAQ,CACvF,CAAA;IACH,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,YAAY,CAAC,OAAO,EAAE,CAAC;QAC3C,MAAM,IAAI,UAAU,CAClB,0CAA0C,YAAY,CAAC,OAAO,QAAQ,CACvE,CAAA;IACH,CAAC;IACD,4EAA4E;IAC5E,sCAAsC;IACtC,MAAM,wBAAwB,GAAG,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAA;IACrE,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAA;IAChF,MAAM,WAAW,GAAG,MAAM,iBAAiB,CACzC,YAAY,EACZ,kBAAkB,EAClB,wBAAwB,EACxB,MAAM,CACP,CAAA;IACD,OAAO,EAAE,WAAW,EAAE,CAAA;AACxB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -32,7 +32,9 @@ export * as legacyV0 from './suites/aes-gcm-v0/api.js';
32
32
  export * as streamsAesGcmV1 from './streams/aes-gcm-v1.js';
33
33
  export * as kdfArgon2id from './kdf/argon2id.js';
34
34
  export * as identity from './identity/index.js';
35
+ export * as inbound from './identity/inbound.js';
35
36
  export * as migrationV0 from './migration/v0-bridge.js';
37
+ import { type ProgressCallback } from './internal/types.js';
36
38
  export interface AutoDecryptOptions {
37
39
  blob: Blob;
38
40
  /** Used for AES-GCM-v1/v2 and XChaCha-v1 (32-byte raw content key) */
@@ -42,7 +44,7 @@ export interface AutoDecryptOptions {
42
44
  /** Required for PQ-hybrid: classical 32-byte envelope key */
43
45
  envelopeKey?: Uint8Array;
44
46
  /** Optional progress callback (0..1) */
45
- onProgress?: (progress: number) => void;
47
+ onProgress?: ProgressCallback;
46
48
  }
47
49
  /**
48
50
  * Decrypt a v1-format blob, automatically dispatching to the correct suite
@@ -52,7 +54,7 @@ export interface AutoDecryptOptions {
52
54
  */
53
55
  export declare function autoDecryptBlob(options: AutoDecryptOptions): Promise<Blob>;
54
56
  /** Library version, also written into format documentation. */
55
- export declare const SHIELDFIVE_CRYPTO_VERSION = "1.0.0-beta.3";
57
+ export declare const SHIELDFIVE_CRYPTO_VERSION = "1.0.0-rc.2";
56
58
  /** Default cipher suite for new files when not specified by the caller. */
57
59
  export declare const DEFAULT_SUITE: 3;
58
60
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,0BAA0B,EAC1B,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,eAAe,GAChB,MAAM,oBAAoB,CAAA;AAK3B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAC1B,YAAY,EACZ,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,KAAK,EACL,WAAW,GACZ,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,SAAS,GACV,MAAM,qBAAqB,CAAA;AAK5B,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,UAAU,EACV,WAAW,G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tE,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,kEAAkE;IAClE,kBAAkB,CAAC,EAAE,UAAU,CAAA;IAC/B,6DAA6D;IAC7D,WAAW,CAAC,EAAE,UAAU,CAAA;IACxB,wCAAwC;IACxC,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAC9B;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAsFf;AAED,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,eAAe,CAAA;AAErD,2EAA2E;AAC3E,eAAO,MAAM,aAAa,GAAuC,CAAA"}
package/dist/index.js CHANGED
@@ -51,6 +51,7 @@ export * as legacyV0 from './suites/aes-gcm-v0/api.js';
51
51
  export * as streamsAesGcmV1 from './streams/aes-gcm-v1.js';
52
52
  export * as kdfArgon2id from './kdf/argon2id.js';
53
53
  export * as identity from './identity/index.js';
54
+ export * as inbound from './identity/inbound.js';
54
55
  export * as migrationV0 from './migration/v0-bridge.js';
55
56
  // ──────────────────────────────────────────────────────────────────────
56
57
  // Auto-routing decryptor
@@ -140,7 +141,7 @@ export async function autoDecryptBlob(options) {
140
141
  }
141
142
  }
142
143
  /** Library version, also written into format documentation. */
143
- export const SHIELDFIVE_CRYPTO_VERSION = '1.0.0-beta.3';
144
+ export const SHIELDFIVE_CRYPTO_VERSION = '1.0.0-rc.2';
144
145
  /** Default cipher suite for new files when not specified by the caller. */
145
146
  export const DEFAULT_SUITE = SUITE.PQ_HYBRID_XCHACHA_MLKEM1024_V1;
146
147
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,yEAAyE;AACzE,oBAAoB;AACpB,yEAAyE;AACzE,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,0BAA0B,EAC1B,kBAAk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CAAC,UAAU;gBAC9B,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAClE,CAAC,CAAA;QACJ,CAAC;QACD,KAAK,KAAK,CAAC,8BAA8B,CAAC,CAAC,CAAC;YAC1C,IAAI,CAAC,OAAO,CAAC,kBAAkB,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;gBACxD,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAA;YACH,CAAC;YACD,OAAO,QAAQ,CAAC,WAAW,CAAC;gBAC1B,IAAI;gBACJ,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;gBAC9C,WAAW,EAAE,OAAO,CAAC,WAAW;gBAChC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAClE,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,IAAI,WAAW,CACnB,oCAAqC,KAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CACrE,CAAA;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED,+DAA+D;AAC/D,MAAM,CAAC,MAAM,yBAAyB,GAAG,YAAY,CAAA;AAErD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,8BAA8B,CAAA"}
@@ -56,6 +56,8 @@ export declare const HKDF_INFO: Readonly<{
56
56
  PQ_HYBRID_COMBINE: "shieldfive/v1/pq-hybrid/combine";
57
57
  ML_KEM_1024_SEED: "shieldfive/v1/pq-hybrid/ml-kem-1024-seed";
58
58
  SHARE_TRANSPORT: "shieldfive/v1/share-transport";
59
+ INBOUND_X25519_STATIC_SEED: "shieldfive/v1/inbound/x25519-static-seed";
60
+ INBOUND_ENVELOPE: "shieldfive/v1/inbound/envelope-key";
59
61
  ARGON2ID_SALT_COMPRESSION: "shieldfive/v1/argon2id/salt-compression";
60
62
  }>;
61
63
  /** AAD domain string mixed into every chunk's authenticator */
@@ -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,KAAK,EAAE,CAAC,GAAG,CAAC,CAAA;CACxD,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAA;AAElD;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;CAKR,CAAA;AAEV,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,KAAK,CAAC,CAAA;AAExD,MAAM,MAAM,SAAS,GACjB,gBAAgB,GAChB,uBAAuB,GACvB,gCAAgC,GAChC,gBAAgB,CAAA;AAEpB,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS,CAKlD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,UAEzB,CAAA;AAEF,eAAO,MAAM,mBAAmB,IAAI,CAAA;AAEpC,iDAAiD;AACjD,eAAO,MAAM,YAAY;;;;;;;;;;EAUvB,CAAA;AAEF,8DAA8D;AAC9D,eAAO,MAAM,0BAA0B,QAQP,CAAA;AAEhC,gEAAgE;AAChE,eAAO,MAAM,kBAAkB,QAAkB,CAAA;AAEjD,8DAA8D;AAC9D,eAAO,MAAM,cAAc,aAAc,CAAA;AAEzC,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,aAAgB,CAAA;AAE7C,gFAAgF;AAChF,eAAO,MAAM,SAAS;;;;;;;;;;;EAepB,CAAA;AAEF,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,wBAAwB,CAAA;AACrD,e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
68
68
  // combined key for the same (recipient, envelope, file_id).
69
69
  SHARE_TRANSPORT: 'shieldfive/v1/share-transport',
70
+ // Zero-knowledge inbound intake. An account-less sender derives the classical
71
+ // envelope key (the 32-byte input suite 0x03 already expects) from an
72
+ // ephemeral↔static X25519 ECDH against the recipient's published static key,
73
+ // so the classical share stays confidential under X25519 while the PQ share
74
+ // stays confidential under ML-KEM — a genuine break-both hybrid with no change
75
+ // to the frozen suite. These two labels are dedicated to that path and reused
76
+ // nowhere else.
77
+ INBOUND_X25519_STATIC_SEED: 'shieldfive/v1/inbound/x25519-static-seed',
78
+ INBOUND_ENVELOPE: 'shieldfive/v1/inbound/envelope-key',
70
79
  ARGON2ID_SALT_COMPRESSION: 'shieldfive/v1/argon2id/salt-compression',
71
80
  });
72
81
  /** AAD domain string mixed into every chunk's authenticator */
@@ -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;IACpC,cAAc,EAAE,IAAI;CACZ,CAAA;AAUV,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;IACxE,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,gBAAgB;CACzC,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,iD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out of band (from the application database).
15
15
  */
16
+ import { type ProgressCallback } from '../../internal/types.js';
16
17
  export declare const V0_TAG_BYTES = 16;
17
18
  export declare const V0_IV_BYTES = 12;
18
19
  export declare const V0_KEY_BYTES = 32;
@@ -27,7 +28,7 @@ export interface V0DecryptOptions {
27
28
  /** Plaintext bytes per chunk (5 MiB or 8 MiB in production) */
28
29
  chunkSize: number;
29
30
  /** Optional progress callback (0..1) */
30
- onProgress?: (progress: number) => void;
31
+ onProgress?: ProgressCallback;
31
32
  }
32
33
  /**
33
34
  * Decrypt a v0 file. Throws if any chunk fails to authenticate, if the
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/suites/aes-gcm-v0/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,eAAO,MAAM,YAAY,KAAK,CAAA;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAA;AAC7B,eAAO,MAAM,YAAY,KAAK,CAAA;AAC9B,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,IAAI,EAAE,IAAI,CAAA;IACV,uEAAuE;IACvE,UAAU,EAAE,UAAU,CAAA;IACtB,4DAA4D;IAC5D,WAAW,EAAE,UAAU,CAAA;IACvB,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAA;IACjB,wCAAwC;IACxC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC;AASD;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6ExE;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,CAAC,CAGrB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAW9D"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/suites/aes-gcm-v0/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,eAAO,MAAM,YAAY,KAAK,CAAA;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAA;AAC7B,eAAO,MAAM,YAAY,KAAK,CAAA;AAC9B,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,IAAI,EAAE,IAAI,CAAA;IACV,uEAAuE;IACvE,UAAU,EAAE,UAAU,CAAA;IACtB,4DAA4D;IAC5D,WAAW,EAAE,UAAU,CAAA;IACvB,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAA;IACjB,wCAAwC;IACxC,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAC9B;AASD;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6ExE;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,UAAU,CAAC,CAGrB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAW9D"}
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { uint64BE } from '../../internal/encoding.js';
17
17
  import { getSubtle } from '../../internal/runtime.js';
18
+ import {} from '../../internal/types.js';
18
19
  export const V0_TAG_BYTES = 16;
19
20
  export const V0_IV_BYTES = 12;
20
21
  export const V0_KEY_BYTES = 32;