@shieldfive/crypto 1.0.0-rc.1 → 1.0.0-rc.3

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,43 @@ 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.3 — 2026-08-03
9
+
10
+ No wire-format changes; suite `0x03` and the identity bundle are untouched. Adds
11
+ firm key-bundle signing for the inbound-intake "Request documents" feature.
12
+
13
+ ### Added
14
+
15
+ - **Firm key-bundle signing** in the `inbound` module. `deriveInboundSigningKeypair`
16
+ derives a deterministic Ed25519 identity keypair from the master secret;
17
+ `signInboundKeyBundle` signs the domain-separated, length-framed
18
+ `(ml_kem || x25519)` public-key bundle, and `verifyInboundKeyBundle` checks it.
19
+ This lets a guest detect a swapped firm key (the signature must verify against
20
+ the firm's out-of-band-trusted signing key) — it does not defeat a server that
21
+ also serves malicious verifying code (the honest-claim ceiling). Reuses the
22
+ audited Ed25519 primitives from `sign.ts`. Integration tests cover the
23
+ round trip and detection of a swapped ml_kem/x25519 key, a wrong signer, and a
24
+ tampered signature.
25
+
26
+ ## 1.0.0-rc.2 — 2026-08-02
27
+
28
+ No wire-format changes; every file written by a `1.0.0-*` release still decrypts
29
+ identically, and suite `0x03` is untouched. Adds a zero-knowledge inbound-intake
30
+ key exchange for the "Request documents" feature.
31
+
32
+ ### Added
33
+
34
+ - **Zero-knowledge inbound intake** (`inbound` module). An account-less sender
35
+ can encrypt a file to a recipient's published keys with no recipient secret,
36
+ and only the recipient can decrypt. The recipient publishes a static X25519
37
+ public key next to its ML-KEM-1024 key; the sender derives the suite-`0x03`
38
+ classical envelope key from an ephemeral-static X25519 ECDH, so the classical
39
+ share stays confidential under X25519 and the PQ share under ML-KEM — an
40
+ attacker must break both. Adds `deriveInboundStaticKeypair`,
41
+ `sealInboundEnvelopeKey`, and `openInboundEnvelopeKey`, plus two dedicated
42
+ HKDF labels. Integration tests cover the sender-to-recipient round trip and
43
+ that breaking either primitive alone fails closed.
44
+
8
45
  ## 1.0.0-rc.1 — 2026-07-14
9
46
 
10
47
  Release candidate for `1.0.0`. The v1 wire format and the public TypeScript API
@@ -0,0 +1,107 @@
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
+ /** Ed25519 signing public key length (bytes). */
73
+ export declare const INBOUND_SIGNING_PUBLIC_KEY_LENGTH = 32;
74
+ /** Ed25519 key-bundle signature length (bytes). */
75
+ export declare const INBOUND_KEY_BUNDLE_SIGNATURE_LENGTH = 64;
76
+ export interface InboundSigningKeypair {
77
+ /** Ed25519 public key (32 bytes) — publish so guests can verify the bundle. */
78
+ ed25519PublicKey: Uint8Array;
79
+ /** Ed25519 secret seed (32 bytes) — treat as highly sensitive. */
80
+ ed25519SecretKey: Uint8Array;
81
+ }
82
+ /**
83
+ * Deterministically derive the firm's Ed25519 signing keypair from its master
84
+ * secret, mirroring the ML-KEM / X25519 derivations. Stable across devices.
85
+ */
86
+ export declare function deriveInboundSigningKeypair(masterSecret: Uint8Array): Promise<InboundSigningKeypair>;
87
+ /**
88
+ * Sign the firm's published (ml_kem || x25519) bundle with its Ed25519 signing
89
+ * secret. Returns a raw 64-byte signature to store next to the keys.
90
+ */
91
+ export declare function signInboundKeyBundle(options: {
92
+ ed25519SecretKey: Uint8Array;
93
+ mlKemPublicKey: Uint8Array;
94
+ x25519PublicKey: Uint8Array;
95
+ }): Uint8Array;
96
+ /**
97
+ * Guest side: verify a firm key-bundle signature. Returns false on any failure
98
+ * (never throws). The guest must additionally trust the signing public key via
99
+ * an out-of-band fingerprint.
100
+ */
101
+ export declare function verifyInboundKeyBundle(options: {
102
+ ed25519PublicKey: Uint8Array;
103
+ mlKemPublicKey: Uint8Array;
104
+ x25519PublicKey: Uint8Array;
105
+ signature: Uint8Array;
106
+ }): boolean;
107
+ //# 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;AAkBH,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;AA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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 { sha256 } from '@noble/hashes/sha2.js';
31
+ import { deriveEd25519PublicKey, ED25519_PUBLIC_KEY_LENGTH, ED25519_SECRET_KEY_LENGTH, ED25519_SIGNATURE_LENGTH, signSenderTranscript, verifySenderTranscript, } from './sign.js';
32
+ import { concatBytes, uint32BE } from '../internal/encoding.js';
33
+ import { hkdfSha256 } from '../internal/hkdf.js';
34
+ import { randomBytes } from '../internal/runtime.js';
35
+ import { HEADER_SIZES, HKDF_INFO } from '../internal/types.js';
36
+ /** X25519 public key length (Curve25519 u-coordinate). */
37
+ export const X25519_PUBLIC_KEY_LENGTH = 32;
38
+ /** X25519 secret scalar length. */
39
+ export const X25519_SECRET_KEY_LENGTH = 32;
40
+ const INBOUND_ENVELOPE_KEY_BYTES = 32;
41
+ /**
42
+ * Deterministically derive the firm's static X25519 keypair from its master
43
+ * secret, mirroring how the ML-KEM keypair is derived. The same master secret
44
+ * always yields the same keypair across devices, so losing a device does not
45
+ * orphan received files (as long as the master secret is recoverable).
46
+ */
47
+ export async function deriveInboundStaticKeypair(masterSecret) {
48
+ if (masterSecret.length < 16) {
49
+ throw new RangeError('deriveInboundStaticKeypair: masterSecret must be at least 16 bytes');
50
+ }
51
+ const seed = await hkdfSha256({
52
+ ikm: masterSecret,
53
+ info: HKDF_INFO.INBOUND_X25519_STATIC_SEED,
54
+ length: X25519_SECRET_KEY_LENGTH,
55
+ });
56
+ const x25519PublicKey = x25519.getPublicKey(seed);
57
+ return { x25519PublicKey, x25519SecretKey: seed };
58
+ }
59
+ /**
60
+ * Derive the per-file envelope key from a shared secret. The full ECDH
61
+ * transcript (shared secret, ephemeral public key, recipient static public key)
62
+ * is bound into the HKDF input and the file_id into the salt, so a captured
63
+ * ephemeral key cannot be replayed against a different recipient or file.
64
+ */
65
+ async function deriveEnvelopeKey(sharedSecret, ephemeralPublicKey, recipientStaticPublicKey, fileId) {
66
+ return hkdfSha256({
67
+ ikm: concatBytes([
68
+ sharedSecret,
69
+ ephemeralPublicKey,
70
+ recipientStaticPublicKey,
71
+ ]),
72
+ salt: fileId,
73
+ info: HKDF_INFO.INBOUND_ENVELOPE,
74
+ length: INBOUND_ENVELOPE_KEY_BYTES,
75
+ });
76
+ }
77
+ /**
78
+ * Sender side (account-less, in the browser). Given the firm's published static
79
+ * X25519 public key and the file_id used for the upload, produce the classical
80
+ * `envelopeKey` to pass to `encryptStreamPqHybridV1` / `encryptBlob`, plus the
81
+ * ephemeral public key to store alongside the ciphertext so the firm can
82
+ * recover the same envelope key. No firm secret is required.
83
+ */
84
+ export async function sealInboundEnvelopeKey(options) {
85
+ const { recipientX25519PublicKey, fileId } = options;
86
+ if (recipientX25519PublicKey.length !== X25519_PUBLIC_KEY_LENGTH) {
87
+ throw new RangeError(`sealInboundEnvelopeKey: recipientX25519PublicKey must be ${X25519_PUBLIC_KEY_LENGTH} bytes`);
88
+ }
89
+ if (fileId.length !== HEADER_SIZES.FILE_ID) {
90
+ throw new RangeError(`sealInboundEnvelopeKey: fileId must be ${HEADER_SIZES.FILE_ID} bytes`);
91
+ }
92
+ const ephemeralSecret = randomBytes(X25519_SECRET_KEY_LENGTH);
93
+ const ephemeralPublicKey = x25519.getPublicKey(ephemeralSecret);
94
+ // Throws on a low-order / all-zero shared secret (contributory behaviour).
95
+ const sharedSecret = x25519.getSharedSecret(ephemeralSecret, recipientX25519PublicKey);
96
+ const envelopeKey = await deriveEnvelopeKey(sharedSecret, ephemeralPublicKey, recipientX25519PublicKey, fileId);
97
+ return { envelopeKey, ephemeralPublicKey };
98
+ }
99
+ /**
100
+ * Recipient side (the firm). Recover the same `envelopeKey` from its static
101
+ * X25519 secret key and the sender's ephemeral public key, then feed it (with
102
+ * the ML-KEM secret key) to the standard KEM-mode decrypt path.
103
+ */
104
+ export async function openInboundEnvelopeKey(options) {
105
+ const { x25519SecretKey, ephemeralPublicKey, fileId } = options;
106
+ if (x25519SecretKey.length !== X25519_SECRET_KEY_LENGTH) {
107
+ throw new RangeError(`openInboundEnvelopeKey: x25519SecretKey must be ${X25519_SECRET_KEY_LENGTH} bytes`);
108
+ }
109
+ if (ephemeralPublicKey.length !== X25519_PUBLIC_KEY_LENGTH) {
110
+ throw new RangeError(`openInboundEnvelopeKey: ephemeralPublicKey must be ${X25519_PUBLIC_KEY_LENGTH} bytes`);
111
+ }
112
+ if (fileId.length !== HEADER_SIZES.FILE_ID) {
113
+ throw new RangeError(`openInboundEnvelopeKey: fileId must be ${HEADER_SIZES.FILE_ID} bytes`);
114
+ }
115
+ // Recompute the static public key from the secret so the transcript binding
116
+ // matches the sender's byte-for-byte.
117
+ const recipientStaticPublicKey = x25519.getPublicKey(x25519SecretKey);
118
+ const sharedSecret = x25519.getSharedSecret(x25519SecretKey, ephemeralPublicKey);
119
+ const envelopeKey = await deriveEnvelopeKey(sharedSecret, ephemeralPublicKey, recipientStaticPublicKey, fileId);
120
+ return { envelopeKey };
121
+ }
122
+ // ── Firm key-bundle signing ──────────────────────────────────────────────────
123
+ //
124
+ // The guest fetches the firm's ml_kem + x25519 public keys from a server it does
125
+ // not trust. To detect a swapped key, the firm signs its published key bundle
126
+ // with a long-lived Ed25519 identity key derived from the same master secret,
127
+ // and the guest verifies the signature against the firm's published signing key
128
+ // (whose fingerprint the firm communicates out of band). This raises the bar to
129
+ // a firm-key forgery; it does not defeat a server that also serves malicious
130
+ // verifying code (the honest-claim ceiling).
131
+ /** Ed25519 signing public key length (bytes). */
132
+ export const INBOUND_SIGNING_PUBLIC_KEY_LENGTH = ED25519_PUBLIC_KEY_LENGTH;
133
+ /** Ed25519 key-bundle signature length (bytes). */
134
+ export const INBOUND_KEY_BUNDLE_SIGNATURE_LENGTH = ED25519_SIGNATURE_LENGTH;
135
+ const INBOUND_KEY_BUNDLE_DOMAIN = new TextEncoder().encode('shieldfive/v1/inbound/key-bundle');
136
+ /**
137
+ * Deterministically derive the firm's Ed25519 signing keypair from its master
138
+ * secret, mirroring the ML-KEM / X25519 derivations. Stable across devices.
139
+ */
140
+ export async function deriveInboundSigningKeypair(masterSecret) {
141
+ if (masterSecret.length < 16) {
142
+ throw new RangeError('deriveInboundSigningKeypair: masterSecret must be at least 16 bytes');
143
+ }
144
+ const seed = await hkdfSha256({
145
+ ikm: masterSecret,
146
+ info: HKDF_INFO.INBOUND_SIGNING_SEED,
147
+ length: ED25519_SECRET_KEY_LENGTH,
148
+ });
149
+ const ed25519PublicKey = deriveEd25519PublicKey(seed);
150
+ return { ed25519PublicKey, ed25519SecretKey: seed };
151
+ }
152
+ /**
153
+ * Domain-separated, length-framed digest over the published key bundle. Framing
154
+ * the lengths prevents a (ml_kem, x25519) split from colliding with a different
155
+ * pairing.
156
+ */
157
+ function inboundKeyBundleDigest(mlKemPublicKey, x25519PublicKey) {
158
+ return sha256(concatBytes([
159
+ INBOUND_KEY_BUNDLE_DOMAIN,
160
+ uint32BE(mlKemPublicKey.length),
161
+ mlKemPublicKey,
162
+ uint32BE(x25519PublicKey.length),
163
+ x25519PublicKey,
164
+ ]));
165
+ }
166
+ /**
167
+ * Sign the firm's published (ml_kem || x25519) bundle with its Ed25519 signing
168
+ * secret. Returns a raw 64-byte signature to store next to the keys.
169
+ */
170
+ export function signInboundKeyBundle(options) {
171
+ const digest = inboundKeyBundleDigest(options.mlKemPublicKey, options.x25519PublicKey);
172
+ return signSenderTranscript({
173
+ ed25519SecretKey: options.ed25519SecretKey,
174
+ transcriptDigest: digest,
175
+ });
176
+ }
177
+ /**
178
+ * Guest side: verify a firm key-bundle signature. Returns false on any failure
179
+ * (never throws). The guest must additionally trust the signing public key via
180
+ * an out-of-band fingerprint.
181
+ */
182
+ export function verifyInboundKeyBundle(options) {
183
+ const digest = inboundKeyBundleDigest(options.mlKemPublicKey, options.x25519PublicKey);
184
+ return verifySenderTranscript({
185
+ ed25519PublicKey: options.ed25519PublicKey,
186
+ transcriptDigest: digest,
187
+ signature: options.signature,
188
+ });
189
+ }
190
+ //# 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;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE9C,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;A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AyB;QACzB,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC;QAC/B,cAAc;QACd,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC;QAChC,eAAe;KAChB,CAAC,CACH,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAIpC;IACC,MAAM,MAAM,GAAG,sBAAsB,CACnC,OAAO,CAAC,cAAc,EACtB,OAAO,CAAC,eAAe,CACxB,CAAA;IACD,OAAO,oBAAoB,CAAC;QAC1B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,gBAAgB,EAAE,MAAM;KACzB,CAAC,CAAA;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAKtC;IACC,MAAM,MAAM,GAAG,sBAAsB,CACnC,OAAO,CAAC,cAAc,EACtB,OAAO,CAAC,eAAe,CACxB,CAAA;IACD,OAAO,sBAAsB,CAAC;QAC5B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,gBAAgB,EAAE,MAAM;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC,CAAA;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -32,6 +32,7 @@ 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';
36
37
  import { type ProgressCallback } from './internal/types.js';
37
38
  export interface AutoDecryptOptions {
@@ -53,7 +54,7 @@ export interface AutoDecryptOptions {
53
54
  */
54
55
  export declare function autoDecryptBlob(options: AutoDecryptOptions): Promise<Blob>;
55
56
  /** Library version, also written into format documentation. */
56
- export declare const SHIELDFIVE_CRYPTO_VERSION = "1.0.0-rc.1";
57
+ export declare const SHIELDFIVE_CRYPTO_VERSION = "1.0.0-rc.3";
57
58
  /** Default cipher suite for new files when not specified by the caller. */
58
59
  export declare const DEFAULT_SUITE: 3;
59
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,GACZ,MAAM,wBAAwB,CAAA;AAK/B,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,OAAO,GACR,MAAM,uBAAuB,CAAA;AAU9B,OAAO,EACL,WAAW,IAAI,mBAAmB,EAClC,cAAc,IAAI,sBAAsB,EACzC,MAAM,4BAA4B,CAAA;AACnC,eAAO,MAAM,QAAQ;;;CAGpB,CAAA;AACD,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAA;AACtD,OAAO,KAAK,SAAS,MAAM,4BAA4B,CAAA;AACvD,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAA;AAC1D,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAA;AACtD,OAAO,KAAK,eAAe,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,QAAQ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mV1 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-rc.1';
144
+ export const SHIELDFIVE_CRYPTO_VERSION = '1.0.0-rc.3';
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,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,eAAe,GAChB,MAAM,oBAAoB,CAAA;AAE3B,yEAAyE;AACzE,iCAAiC;AACjC,yEAAyE;AACzE,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;AAS5B,yEAAyE;AACzE,gDAAgD;AAChD,yEAAyE;AACzE,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,UAAU,EACV,WAAW,GACZ,MAAM,wBAAwB,CAAA;AAE/B,yEAAyE;AACzE,kBAAkB;AAClB,yEAAyE;AACzE,OAAO,EAC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ChC,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,9 @@ 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";
61
+ INBOUND_SIGNING_SEED: "shieldfive/v1/inbound/ed25519-signing-seed";
59
62
  ARGON2ID_SALT_COMPRESSION: "shieldfive/v1/argon2id/salt-compression";
60
63
  }>;
61
64
  /** 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,eA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BpB,CAAA;AAEF,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,wBAAwB,CAAA;AACrD,eAAO,MAAM,gBAAgB,QAAsC,CAAA;AAEnE;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,UAAU,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,UAAU,CAAA;IACxB,kEAAkE;IAClE,YAAY,EAAE,MAAM,CAAA;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,UAAU,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA"}
@@ -67,6 +67,18 @@ export const HKDF_INFO = Object.freeze({
67
67
  // label above, so a share transport key is never equal to a file's
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',
79
+ // Ed25519 identity signing key for inbound intake. The firm signs its
80
+ // published (ml_kem || x25519) bundle so a guest can detect a key swap.
81
+ INBOUND_SIGNING_SEED: 'shieldfive/v1/inbound/ed25519-signing-seed',
70
82
  ARGON2ID_SALT_COMPRESSION: 'shieldfive/v1/argon2id/salt-compression',
71
83
  });
72
84
  /** 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,iDAAiD;AACjD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,EAAE;IACX,UAAU,EAAE,CAAC;IACb,YAAY,EAAE,CAAC;IACf,cAAc,EAAE,CAAC;IACjB,iBAAiB,EAAE,CAAC;IACpB,UAAU,EAAE,EAAE;CACf,CAAC,CAAA;AAEF,8DAA8D;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WAAW,CAAA;AAEzC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAA;AAE7C,gFAAgF;AAChF,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,UAAU,EAAE,0BAA0B;IACtC,iBAAiB,EAAE,iCAAiC;IACpD,oBAAoB,EAAE,oCAAoC;IAC1D,uBAAuB,EAAE,uCAAuC;IAChE,iBAAiB,EAAE,iCAAiC;IACpD,oBAAoB,EAAE,oCAAoC;IAC1D,iBAAiB,EAAE,iCAAiC;IACpD,gBAAgB,EAAE,0CAA0C;IAC5D,4EAA4E;IAC5E,yEAAyE;IACzE,mEAAmE;IACnE,4DAA4D;IAC5D,eAAe,EAAE,+BAA+B;IAChD,8EAA8E;IAC9E,sEAAsE;IACtE,6EAA6E;IAC7E,4EAA4E;IAC5E,+EAA+E;IAC/E,8EAA8E;IAC9E,gBAAgB;IAChB,0BAA0B,EAAE,0CAA0C;IACtE,gBAAgB,EAAE,oCAAoC;IACtD,sEAAsE;IACtE,wEAAwE;IACxE,oBAAoB,EAAE,4CAA4C;IAClE,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shieldfive/crypto",
3
- "version": "1.0.0-rc.1",
3
+ "version": "1.0.0-rc.3",
4
4
  "description": "Client-side post-quantum hybrid encryption for cloud storage. The cryptographic core of ShieldFive.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -0,0 +1,290 @@
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
+
30
+ import { x25519 } from '@noble/curves/ed25519.js'
31
+ import { sha256 } from '@noble/hashes/sha2.js'
32
+
33
+ import {
34
+ deriveEd25519PublicKey,
35
+ ED25519_PUBLIC_KEY_LENGTH,
36
+ ED25519_SECRET_KEY_LENGTH,
37
+ ED25519_SIGNATURE_LENGTH,
38
+ signSenderTranscript,
39
+ verifySenderTranscript,
40
+ } from './sign.js'
41
+ import { concatBytes, uint32BE } from '../internal/encoding.js'
42
+ import { hkdfSha256 } from '../internal/hkdf.js'
43
+ import { randomBytes } from '../internal/runtime.js'
44
+ import { HEADER_SIZES, HKDF_INFO } from '../internal/types.js'
45
+
46
+ /** X25519 public key length (Curve25519 u-coordinate). */
47
+ export const X25519_PUBLIC_KEY_LENGTH = 32
48
+ /** X25519 secret scalar length. */
49
+ export const X25519_SECRET_KEY_LENGTH = 32
50
+
51
+ const INBOUND_ENVELOPE_KEY_BYTES = 32
52
+
53
+ export interface InboundStaticKeypair {
54
+ /** Static X25519 public key (32 bytes) — publish next to the ML-KEM public key. */
55
+ x25519PublicKey: Uint8Array
56
+ /** Static X25519 secret scalar (32 bytes) — treat as highly sensitive. */
57
+ x25519SecretKey: Uint8Array
58
+ }
59
+
60
+ /**
61
+ * Deterministically derive the firm's static X25519 keypair from its master
62
+ * secret, mirroring how the ML-KEM keypair is derived. The same master secret
63
+ * always yields the same keypair across devices, so losing a device does not
64
+ * orphan received files (as long as the master secret is recoverable).
65
+ */
66
+ export async function deriveInboundStaticKeypair(
67
+ masterSecret: Uint8Array,
68
+ ): Promise<InboundStaticKeypair> {
69
+ if (masterSecret.length < 16) {
70
+ throw new RangeError(
71
+ 'deriveInboundStaticKeypair: masterSecret must be at least 16 bytes',
72
+ )
73
+ }
74
+ const seed = await hkdfSha256({
75
+ ikm: masterSecret,
76
+ info: HKDF_INFO.INBOUND_X25519_STATIC_SEED,
77
+ length: X25519_SECRET_KEY_LENGTH,
78
+ })
79
+ const x25519PublicKey = x25519.getPublicKey(seed)
80
+ return { x25519PublicKey, x25519SecretKey: seed }
81
+ }
82
+
83
+ /**
84
+ * Derive the per-file envelope key from a shared secret. The full ECDH
85
+ * transcript (shared secret, ephemeral public key, recipient static public key)
86
+ * is bound into the HKDF input and the file_id into the salt, so a captured
87
+ * ephemeral key cannot be replayed against a different recipient or file.
88
+ */
89
+ async function deriveEnvelopeKey(
90
+ sharedSecret: Uint8Array,
91
+ ephemeralPublicKey: Uint8Array,
92
+ recipientStaticPublicKey: Uint8Array,
93
+ fileId: Uint8Array,
94
+ ): Promise<Uint8Array> {
95
+ return hkdfSha256({
96
+ ikm: concatBytes([
97
+ sharedSecret,
98
+ ephemeralPublicKey,
99
+ recipientStaticPublicKey,
100
+ ]),
101
+ salt: fileId,
102
+ info: HKDF_INFO.INBOUND_ENVELOPE,
103
+ length: INBOUND_ENVELOPE_KEY_BYTES,
104
+ })
105
+ }
106
+
107
+ /**
108
+ * Sender side (account-less, in the browser). Given the firm's published static
109
+ * X25519 public key and the file_id used for the upload, produce the classical
110
+ * `envelopeKey` to pass to `encryptStreamPqHybridV1` / `encryptBlob`, plus the
111
+ * ephemeral public key to store alongside the ciphertext so the firm can
112
+ * recover the same envelope key. No firm secret is required.
113
+ */
114
+ export async function sealInboundEnvelopeKey(options: {
115
+ recipientX25519PublicKey: Uint8Array
116
+ fileId: Uint8Array
117
+ }): Promise<{ envelopeKey: Uint8Array; ephemeralPublicKey: Uint8Array }> {
118
+ const { recipientX25519PublicKey, fileId } = options
119
+ if (recipientX25519PublicKey.length !== X25519_PUBLIC_KEY_LENGTH) {
120
+ throw new RangeError(
121
+ `sealInboundEnvelopeKey: recipientX25519PublicKey must be ${X25519_PUBLIC_KEY_LENGTH} bytes`,
122
+ )
123
+ }
124
+ if (fileId.length !== HEADER_SIZES.FILE_ID) {
125
+ throw new RangeError(
126
+ `sealInboundEnvelopeKey: fileId must be ${HEADER_SIZES.FILE_ID} bytes`,
127
+ )
128
+ }
129
+ const ephemeralSecret = randomBytes(X25519_SECRET_KEY_LENGTH)
130
+ const ephemeralPublicKey = x25519.getPublicKey(ephemeralSecret)
131
+ // Throws on a low-order / all-zero shared secret (contributory behaviour).
132
+ const sharedSecret = x25519.getSharedSecret(
133
+ ephemeralSecret,
134
+ recipientX25519PublicKey,
135
+ )
136
+ const envelopeKey = await deriveEnvelopeKey(
137
+ sharedSecret,
138
+ ephemeralPublicKey,
139
+ recipientX25519PublicKey,
140
+ fileId,
141
+ )
142
+ return { envelopeKey, ephemeralPublicKey }
143
+ }
144
+
145
+ /**
146
+ * Recipient side (the firm). Recover the same `envelopeKey` from its static
147
+ * X25519 secret key and the sender's ephemeral public key, then feed it (with
148
+ * the ML-KEM secret key) to the standard KEM-mode decrypt path.
149
+ */
150
+ export async function openInboundEnvelopeKey(options: {
151
+ x25519SecretKey: Uint8Array
152
+ ephemeralPublicKey: Uint8Array
153
+ fileId: Uint8Array
154
+ }): Promise<{ envelopeKey: Uint8Array }> {
155
+ const { x25519SecretKey, ephemeralPublicKey, fileId } = options
156
+ if (x25519SecretKey.length !== X25519_SECRET_KEY_LENGTH) {
157
+ throw new RangeError(
158
+ `openInboundEnvelopeKey: x25519SecretKey must be ${X25519_SECRET_KEY_LENGTH} bytes`,
159
+ )
160
+ }
161
+ if (ephemeralPublicKey.length !== X25519_PUBLIC_KEY_LENGTH) {
162
+ throw new RangeError(
163
+ `openInboundEnvelopeKey: ephemeralPublicKey must be ${X25519_PUBLIC_KEY_LENGTH} bytes`,
164
+ )
165
+ }
166
+ if (fileId.length !== HEADER_SIZES.FILE_ID) {
167
+ throw new RangeError(
168
+ `openInboundEnvelopeKey: fileId must be ${HEADER_SIZES.FILE_ID} bytes`,
169
+ )
170
+ }
171
+ // Recompute the static public key from the secret so the transcript binding
172
+ // matches the sender's byte-for-byte.
173
+ const recipientStaticPublicKey = x25519.getPublicKey(x25519SecretKey)
174
+ const sharedSecret = x25519.getSharedSecret(x25519SecretKey, ephemeralPublicKey)
175
+ const envelopeKey = await deriveEnvelopeKey(
176
+ sharedSecret,
177
+ ephemeralPublicKey,
178
+ recipientStaticPublicKey,
179
+ fileId,
180
+ )
181
+ return { envelopeKey }
182
+ }
183
+
184
+ // ── Firm key-bundle signing ──────────────────────────────────────────────────
185
+ //
186
+ // The guest fetches the firm's ml_kem + x25519 public keys from a server it does
187
+ // not trust. To detect a swapped key, the firm signs its published key bundle
188
+ // with a long-lived Ed25519 identity key derived from the same master secret,
189
+ // and the guest verifies the signature against the firm's published signing key
190
+ // (whose fingerprint the firm communicates out of band). This raises the bar to
191
+ // a firm-key forgery; it does not defeat a server that also serves malicious
192
+ // verifying code (the honest-claim ceiling).
193
+
194
+ /** Ed25519 signing public key length (bytes). */
195
+ export const INBOUND_SIGNING_PUBLIC_KEY_LENGTH = ED25519_PUBLIC_KEY_LENGTH
196
+ /** Ed25519 key-bundle signature length (bytes). */
197
+ export const INBOUND_KEY_BUNDLE_SIGNATURE_LENGTH = ED25519_SIGNATURE_LENGTH
198
+
199
+ const INBOUND_KEY_BUNDLE_DOMAIN = new TextEncoder().encode(
200
+ 'shieldfive/v1/inbound/key-bundle',
201
+ )
202
+
203
+ export interface InboundSigningKeypair {
204
+ /** Ed25519 public key (32 bytes) — publish so guests can verify the bundle. */
205
+ ed25519PublicKey: Uint8Array
206
+ /** Ed25519 secret seed (32 bytes) — treat as highly sensitive. */
207
+ ed25519SecretKey: Uint8Array
208
+ }
209
+
210
+ /**
211
+ * Deterministically derive the firm's Ed25519 signing keypair from its master
212
+ * secret, mirroring the ML-KEM / X25519 derivations. Stable across devices.
213
+ */
214
+ export async function deriveInboundSigningKeypair(
215
+ masterSecret: Uint8Array,
216
+ ): Promise<InboundSigningKeypair> {
217
+ if (masterSecret.length < 16) {
218
+ throw new RangeError(
219
+ 'deriveInboundSigningKeypair: masterSecret must be at least 16 bytes',
220
+ )
221
+ }
222
+ const seed = await hkdfSha256({
223
+ ikm: masterSecret,
224
+ info: HKDF_INFO.INBOUND_SIGNING_SEED,
225
+ length: ED25519_SECRET_KEY_LENGTH,
226
+ })
227
+ const ed25519PublicKey = deriveEd25519PublicKey(seed)
228
+ return { ed25519PublicKey, ed25519SecretKey: seed }
229
+ }
230
+
231
+ /**
232
+ * Domain-separated, length-framed digest over the published key bundle. Framing
233
+ * the lengths prevents a (ml_kem, x25519) split from colliding with a different
234
+ * pairing.
235
+ */
236
+ function inboundKeyBundleDigest(
237
+ mlKemPublicKey: Uint8Array,
238
+ x25519PublicKey: Uint8Array,
239
+ ): Uint8Array {
240
+ return sha256(
241
+ concatBytes([
242
+ INBOUND_KEY_BUNDLE_DOMAIN,
243
+ uint32BE(mlKemPublicKey.length),
244
+ mlKemPublicKey,
245
+ uint32BE(x25519PublicKey.length),
246
+ x25519PublicKey,
247
+ ]),
248
+ )
249
+ }
250
+
251
+ /**
252
+ * Sign the firm's published (ml_kem || x25519) bundle with its Ed25519 signing
253
+ * secret. Returns a raw 64-byte signature to store next to the keys.
254
+ */
255
+ export function signInboundKeyBundle(options: {
256
+ ed25519SecretKey: Uint8Array
257
+ mlKemPublicKey: Uint8Array
258
+ x25519PublicKey: Uint8Array
259
+ }): Uint8Array {
260
+ const digest = inboundKeyBundleDigest(
261
+ options.mlKemPublicKey,
262
+ options.x25519PublicKey,
263
+ )
264
+ return signSenderTranscript({
265
+ ed25519SecretKey: options.ed25519SecretKey,
266
+ transcriptDigest: digest,
267
+ })
268
+ }
269
+
270
+ /**
271
+ * Guest side: verify a firm key-bundle signature. Returns false on any failure
272
+ * (never throws). The guest must additionally trust the signing public key via
273
+ * an out-of-band fingerprint.
274
+ */
275
+ export function verifyInboundKeyBundle(options: {
276
+ ed25519PublicKey: Uint8Array
277
+ mlKemPublicKey: Uint8Array
278
+ x25519PublicKey: Uint8Array
279
+ signature: Uint8Array
280
+ }): boolean {
281
+ const digest = inboundKeyBundleDigest(
282
+ options.mlKemPublicKey,
283
+ options.x25519PublicKey,
284
+ )
285
+ return verifySenderTranscript({
286
+ ed25519PublicKey: options.ed25519PublicKey,
287
+ transcriptDigest: digest,
288
+ signature: options.signature,
289
+ })
290
+ }
package/src/index.ts CHANGED
@@ -97,6 +97,7 @@ export * as legacyV0 from './suites/aes-gcm-v0/api.js'
97
97
  export * as streamsAesGcmV1 from './streams/aes-gcm-v1.js'
98
98
  export * as kdfArgon2id from './kdf/argon2id.js'
99
99
  export * as identity from './identity/index.js'
100
+ export * as inbound from './identity/inbound.js'
100
101
  export * as migrationV0 from './migration/v0-bridge.js'
101
102
 
102
103
  // ──────────────────────────────────────────────────────────────────────
@@ -218,7 +219,7 @@ export async function autoDecryptBlob(
218
219
  }
219
220
 
220
221
  /** Library version, also written into format documentation. */
221
- export const SHIELDFIVE_CRYPTO_VERSION = '1.0.0-rc.1'
222
+ export const SHIELDFIVE_CRYPTO_VERSION = '1.0.0-rc.3'
222
223
 
223
224
  /** Default cipher suite for new files when not specified by the caller. */
224
225
  export const DEFAULT_SUITE = SUITE.PQ_HYBRID_XCHACHA_MLKEM1024_V1
@@ -93,6 +93,18 @@ export const HKDF_INFO = Object.freeze({
93
93
  // label above, so a share transport key is never equal to a file's
94
94
  // combined key for the same (recipient, envelope, file_id).
95
95
  SHARE_TRANSPORT: 'shieldfive/v1/share-transport',
96
+ // Zero-knowledge inbound intake. An account-less sender derives the classical
97
+ // envelope key (the 32-byte input suite 0x03 already expects) from an
98
+ // ephemeral↔static X25519 ECDH against the recipient's published static key,
99
+ // so the classical share stays confidential under X25519 while the PQ share
100
+ // stays confidential under ML-KEM — a genuine break-both hybrid with no change
101
+ // to the frozen suite. These two labels are dedicated to that path and reused
102
+ // nowhere else.
103
+ INBOUND_X25519_STATIC_SEED: 'shieldfive/v1/inbound/x25519-static-seed',
104
+ INBOUND_ENVELOPE: 'shieldfive/v1/inbound/envelope-key',
105
+ // Ed25519 identity signing key for inbound intake. The firm signs its
106
+ // published (ml_kem || x25519) bundle so a guest can detect a key swap.
107
+ INBOUND_SIGNING_SEED: 'shieldfive/v1/inbound/ed25519-signing-seed',
96
108
  ARGON2ID_SALT_COMPRESSION: 'shieldfive/v1/argon2id/salt-compression',
97
109
  })
98
110