@omnituum/pqc-shared 0.4.1 → 0.6.0

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 (39) hide show
  1. package/dist/crypto/index.cjs +81 -54
  2. package/dist/crypto/index.d.cts +33 -11
  3. package/dist/crypto/index.d.ts +33 -11
  4. package/dist/crypto/index.js +81 -54
  5. package/dist/{decrypt-eSHlbh1j.d.cts → decrypt-O1iqFIDL.d.cts} +80 -6
  6. package/dist/{decrypt-eSHlbh1j.d.ts → decrypt-O1iqFIDL.d.ts} +80 -6
  7. package/dist/fs/index.cjs +286 -147
  8. package/dist/fs/index.d.cts +28 -7
  9. package/dist/fs/index.d.ts +28 -7
  10. package/dist/fs/index.js +277 -147
  11. package/dist/index.cjs +358 -229
  12. package/dist/index.d.cts +4 -4
  13. package/dist/index.d.ts +4 -4
  14. package/dist/index.js +357 -230
  15. package/dist/{integrity-BenoFsmP.d.cts → integrity-BkBDrHA-.d.cts} +12 -4
  16. package/dist/{integrity-D9J98Bty.d.ts → integrity-DsFJv5c-.d.ts} +12 -4
  17. package/dist/{types-CRka8PC7.d.cts → types-DmnVueAY.d.cts} +14 -4
  18. package/dist/{types-CRka8PC7.d.ts → types-DmnVueAY.d.ts} +14 -4
  19. package/dist/utils/index.cjs +7 -10
  20. package/dist/utils/index.d.cts +2 -2
  21. package/dist/utils/index.d.ts +2 -2
  22. package/dist/utils/index.js +7 -10
  23. package/dist/vault/index.cjs +8 -11
  24. package/dist/vault/index.d.cts +2 -2
  25. package/dist/vault/index.d.ts +2 -2
  26. package/dist/vault/index.js +8 -11
  27. package/package.json +7 -7
  28. package/src/crypto/dilithium.ts +4 -4
  29. package/src/crypto/hybrid.ts +182 -80
  30. package/src/crypto/index.ts +2 -0
  31. package/src/fs/decrypt.ts +145 -68
  32. package/src/fs/encrypt.ts +161 -112
  33. package/src/fs/format.ts +110 -15
  34. package/src/fs/index.ts +4 -0
  35. package/src/fs/types.ts +77 -6
  36. package/src/index.ts +4 -0
  37. package/src/utils/integrity.ts +16 -15
  38. package/src/vault/manager.ts +1 -1
  39. package/src/version.ts +29 -7
@@ -1,5 +1,5 @@
1
- import { A as Argon2idParams, f as OQEHeader, H as HybridKeyMaterial, P as PasswordKeyMaterial, g as OQEMetadata, h as AlgorithmSuiteId, O as OQEEncryptResult, c as OQEDecryptResult } from '../decrypt-eSHlbh1j.cjs';
2
- export { w as ALGORITHM_SUITES, i as DEFAULT_ARGON2ID_PARAMS, D as DecryptOptions, E as EncryptOptions, F as FileInput, p as HybridDecryptOptions, n as HybridEncryptOptions, M as MIN_ARGON2ID_PARAMS, t as OQEError, r as OQEErrorCode, m as OQEMode, v as OQE_FORMAT_VERSION, x as OQE_HEADER_SIZE, u as OQE_MAGIC, q as PasswordDecryptOptions, o as PasswordEncryptOptions, s as ProgressCallback, d as decryptFile, k as decryptFileForSelf, b as decryptFileWithPassword, e as encryptFile, j as encryptFileForSelf, a as encryptFileWithPassword, l as inspectOQEFile, y as toUint8Array } from '../decrypt-eSHlbh1j.cjs';
1
+ import { A as Argon2idParams, f as OQEHeader, H as HybridKeyMaterial, g as HybridKeyMaterialV2, P as PasswordKeyMaterial, h as OQEMetadata, i as AlgorithmSuiteId, O as OQEEncryptResult, c as OQEDecryptResult } from '../decrypt-O1iqFIDL.cjs';
2
+ export { B as ALGORITHM_SUITES, j as DEFAULT_ARGON2ID_PARAMS, D as DecryptOptions, E as EncryptOptions, F as FileInput, r as HybridDecryptOptions, p as HybridEncryptOptions, M as MIN_ARGON2ID_PARAMS, v as OQEError, t as OQEErrorCode, o as OQEMode, z as OQE_FORMAT_VERSION, x as OQE_FORMAT_VERSION_V1, y as OQE_FORMAT_VERSION_V2, I as OQE_HEADER_SIZE, C as OQE_HEADER_SIZE_V1, G as OQE_HEADER_SIZE_V2, w as OQE_MAGIC, s as PasswordDecryptOptions, q as PasswordEncryptOptions, u as ProgressCallback, S as SUPPORTED_OQE_VERSIONS, l as combinedFileKekV2, d as decryptFile, m as decryptFileForSelf, b as decryptFileWithPassword, e as encryptFile, k as encryptFileForSelf, a as encryptFileWithPassword, n as inspectOQEFile, J as toUint8Array } from '../decrypt-O1iqFIDL.cjs';
3
3
 
4
4
  /**
5
5
  * Omnituum FS - Argon2id Key Derivation
@@ -168,17 +168,24 @@ declare function aesDecryptStreaming(encrypted: Uint8Array, key: CryptoKey | Uin
168
168
  * Implements a documented, stable binary format for encrypted files.
169
169
  */
170
170
 
171
+ /** Byte length of a section's fixed header for the given format version. */
172
+ declare function oqeHeaderSize(version: number): number;
171
173
  /**
172
- * Write an OQE file header.
174
+ * Write an OQE file header. Layout depends on `header.version`: v2 appends a
175
+ * second 12-byte IV (the content IV) after the metadata IV.
176
+ *
177
+ * The returned bytes are also used verbatim as the AES-GCM associated data for
178
+ * both sections (v2), so every field here — version, suite, flags, lengths and
179
+ * both IVs — is authenticated and cannot be tampered with undetected.
173
180
  *
174
181
  * @param header - Header data
175
- * @returns 30-byte header buffer
182
+ * @returns Header buffer (30 bytes for v1, 42 bytes for v2)
176
183
  */
177
184
  declare function writeOQEHeader(header: OQEHeader): Uint8Array;
178
185
  /**
179
- * Parse an OQE file header.
186
+ * Parse an OQE file header (v1 or v2).
180
187
  *
181
- * @param data - File data (at least 30 bytes)
188
+ * @param data - File data
182
189
  * @returns Parsed header
183
190
  * @throws OQEError if header is invalid
184
191
  */
@@ -202,6 +209,20 @@ declare function serializeHybridKeyMaterial(km: HybridKeyMaterial): Uint8Array;
202
209
  * Parse hybrid mode key material.
203
210
  */
204
211
  declare function parseHybridKeyMaterial(data: Uint8Array): HybridKeyMaterial;
212
+ /**
213
+ * Serialize v2 hybrid key material (single AND-combined wrap).
214
+ *
215
+ * Format:
216
+ * - X25519 ephemeral PK (32 bytes)
217
+ * - Kyber ciphertext length (2 bytes) + Kyber ciphertext (variable)
218
+ * - Content-key wrap nonce (24 bytes)
219
+ * - Wrapped content key length (2 bytes) + wrapped content key (variable)
220
+ */
221
+ declare function serializeHybridKeyMaterialV2(km: HybridKeyMaterialV2): Uint8Array;
222
+ /**
223
+ * Parse v2 hybrid key material (single AND-combined wrap).
224
+ */
225
+ declare function parseHybridKeyMaterialV2(data: Uint8Array): HybridKeyMaterialV2;
205
226
  /**
206
227
  * Serialize password mode key material.
207
228
  *
@@ -397,4 +418,4 @@ declare function isFileAPIAvailable(): boolean;
397
418
  */
398
419
  declare function isDragDropSupported(): boolean;
399
420
 
400
- export { AES_GCM_IV_SIZE, AES_GCM_TAG_SIZE, AES_KEY_SIZE, AlgorithmSuiteId, Argon2idParams, HybridKeyMaterial, OQEDecryptResult, OQEEncryptResult, OQEHeader, OQEMetadata, OQE_EXTENSION, OQE_MIME_TYPE, PasswordKeyMaterial, STREAM_CHUNK_SIZE, addOQEExtension, aesDecrypt, aesDecryptCombined, aesDecryptStreaming, aesEncrypt, aesEncryptCombined, aesEncryptStreaming, assembleOQEFile, benchmarkArgon2, bytesToDataURL, copyToClipboard, createDropZone, createObjectURL, decryptResultToBlob, deriveKeyFromPassword, downloadBlob, downloadBytes, downloadDecryptedFile, downloadEncryptedFile, encryptResultToBlob, estimateArgon2Params, exportAesKey, formatFileSize, generateAesKey, generateArgon2Salt, getAlgorithmName, getFileInfo, importAesKey, isArgon2Available, isBrowser, isDragDropSupported, isFileAPIAvailable, isOQEFile, isWebCryptoAvailable, openFilePicker, openFileToEncrypt, openOQEFilePicker, parseHybridKeyMaterial, parseMetadata, parseOQEFile, parseOQEHeader, parsePasswordKeyMaterial, readFile, readFileAsDataURL, readFileAsText, removeOQEExtension, serializeHybridKeyMaterial, serializeMetadata, serializePasswordKeyMaterial, verifyPassword, writeOQEHeader };
421
+ export { AES_GCM_IV_SIZE, AES_GCM_TAG_SIZE, AES_KEY_SIZE, AlgorithmSuiteId, Argon2idParams, HybridKeyMaterial, HybridKeyMaterialV2, OQEDecryptResult, OQEEncryptResult, OQEHeader, OQEMetadata, OQE_EXTENSION, OQE_MIME_TYPE, PasswordKeyMaterial, STREAM_CHUNK_SIZE, addOQEExtension, aesDecrypt, aesDecryptCombined, aesDecryptStreaming, aesEncrypt, aesEncryptCombined, aesEncryptStreaming, assembleOQEFile, benchmarkArgon2, bytesToDataURL, copyToClipboard, createDropZone, createObjectURL, decryptResultToBlob, deriveKeyFromPassword, downloadBlob, downloadBytes, downloadDecryptedFile, downloadEncryptedFile, encryptResultToBlob, estimateArgon2Params, exportAesKey, formatFileSize, generateAesKey, generateArgon2Salt, getAlgorithmName, getFileInfo, importAesKey, isArgon2Available, isBrowser, isDragDropSupported, isFileAPIAvailable, isOQEFile, isWebCryptoAvailable, openFilePicker, openFileToEncrypt, openOQEFilePicker, oqeHeaderSize, parseHybridKeyMaterial, parseHybridKeyMaterialV2, parseMetadata, parseOQEFile, parseOQEHeader, parsePasswordKeyMaterial, readFile, readFileAsDataURL, readFileAsText, removeOQEExtension, serializeHybridKeyMaterial, serializeHybridKeyMaterialV2, serializeMetadata, serializePasswordKeyMaterial, verifyPassword, writeOQEHeader };
@@ -1,5 +1,5 @@
1
- import { A as Argon2idParams, f as OQEHeader, H as HybridKeyMaterial, P as PasswordKeyMaterial, g as OQEMetadata, h as AlgorithmSuiteId, O as OQEEncryptResult, c as OQEDecryptResult } from '../decrypt-eSHlbh1j.js';
2
- export { w as ALGORITHM_SUITES, i as DEFAULT_ARGON2ID_PARAMS, D as DecryptOptions, E as EncryptOptions, F as FileInput, p as HybridDecryptOptions, n as HybridEncryptOptions, M as MIN_ARGON2ID_PARAMS, t as OQEError, r as OQEErrorCode, m as OQEMode, v as OQE_FORMAT_VERSION, x as OQE_HEADER_SIZE, u as OQE_MAGIC, q as PasswordDecryptOptions, o as PasswordEncryptOptions, s as ProgressCallback, d as decryptFile, k as decryptFileForSelf, b as decryptFileWithPassword, e as encryptFile, j as encryptFileForSelf, a as encryptFileWithPassword, l as inspectOQEFile, y as toUint8Array } from '../decrypt-eSHlbh1j.js';
1
+ import { A as Argon2idParams, f as OQEHeader, H as HybridKeyMaterial, g as HybridKeyMaterialV2, P as PasswordKeyMaterial, h as OQEMetadata, i as AlgorithmSuiteId, O as OQEEncryptResult, c as OQEDecryptResult } from '../decrypt-O1iqFIDL.js';
2
+ export { B as ALGORITHM_SUITES, j as DEFAULT_ARGON2ID_PARAMS, D as DecryptOptions, E as EncryptOptions, F as FileInput, r as HybridDecryptOptions, p as HybridEncryptOptions, M as MIN_ARGON2ID_PARAMS, v as OQEError, t as OQEErrorCode, o as OQEMode, z as OQE_FORMAT_VERSION, x as OQE_FORMAT_VERSION_V1, y as OQE_FORMAT_VERSION_V2, I as OQE_HEADER_SIZE, C as OQE_HEADER_SIZE_V1, G as OQE_HEADER_SIZE_V2, w as OQE_MAGIC, s as PasswordDecryptOptions, q as PasswordEncryptOptions, u as ProgressCallback, S as SUPPORTED_OQE_VERSIONS, l as combinedFileKekV2, d as decryptFile, m as decryptFileForSelf, b as decryptFileWithPassword, e as encryptFile, k as encryptFileForSelf, a as encryptFileWithPassword, n as inspectOQEFile, J as toUint8Array } from '../decrypt-O1iqFIDL.js';
3
3
 
4
4
  /**
5
5
  * Omnituum FS - Argon2id Key Derivation
@@ -168,17 +168,24 @@ declare function aesDecryptStreaming(encrypted: Uint8Array, key: CryptoKey | Uin
168
168
  * Implements a documented, stable binary format for encrypted files.
169
169
  */
170
170
 
171
+ /** Byte length of a section's fixed header for the given format version. */
172
+ declare function oqeHeaderSize(version: number): number;
171
173
  /**
172
- * Write an OQE file header.
174
+ * Write an OQE file header. Layout depends on `header.version`: v2 appends a
175
+ * second 12-byte IV (the content IV) after the metadata IV.
176
+ *
177
+ * The returned bytes are also used verbatim as the AES-GCM associated data for
178
+ * both sections (v2), so every field here — version, suite, flags, lengths and
179
+ * both IVs — is authenticated and cannot be tampered with undetected.
173
180
  *
174
181
  * @param header - Header data
175
- * @returns 30-byte header buffer
182
+ * @returns Header buffer (30 bytes for v1, 42 bytes for v2)
176
183
  */
177
184
  declare function writeOQEHeader(header: OQEHeader): Uint8Array;
178
185
  /**
179
- * Parse an OQE file header.
186
+ * Parse an OQE file header (v1 or v2).
180
187
  *
181
- * @param data - File data (at least 30 bytes)
188
+ * @param data - File data
182
189
  * @returns Parsed header
183
190
  * @throws OQEError if header is invalid
184
191
  */
@@ -202,6 +209,20 @@ declare function serializeHybridKeyMaterial(km: HybridKeyMaterial): Uint8Array;
202
209
  * Parse hybrid mode key material.
203
210
  */
204
211
  declare function parseHybridKeyMaterial(data: Uint8Array): HybridKeyMaterial;
212
+ /**
213
+ * Serialize v2 hybrid key material (single AND-combined wrap).
214
+ *
215
+ * Format:
216
+ * - X25519 ephemeral PK (32 bytes)
217
+ * - Kyber ciphertext length (2 bytes) + Kyber ciphertext (variable)
218
+ * - Content-key wrap nonce (24 bytes)
219
+ * - Wrapped content key length (2 bytes) + wrapped content key (variable)
220
+ */
221
+ declare function serializeHybridKeyMaterialV2(km: HybridKeyMaterialV2): Uint8Array;
222
+ /**
223
+ * Parse v2 hybrid key material (single AND-combined wrap).
224
+ */
225
+ declare function parseHybridKeyMaterialV2(data: Uint8Array): HybridKeyMaterialV2;
205
226
  /**
206
227
  * Serialize password mode key material.
207
228
  *
@@ -397,4 +418,4 @@ declare function isFileAPIAvailable(): boolean;
397
418
  */
398
419
  declare function isDragDropSupported(): boolean;
399
420
 
400
- export { AES_GCM_IV_SIZE, AES_GCM_TAG_SIZE, AES_KEY_SIZE, AlgorithmSuiteId, Argon2idParams, HybridKeyMaterial, OQEDecryptResult, OQEEncryptResult, OQEHeader, OQEMetadata, OQE_EXTENSION, OQE_MIME_TYPE, PasswordKeyMaterial, STREAM_CHUNK_SIZE, addOQEExtension, aesDecrypt, aesDecryptCombined, aesDecryptStreaming, aesEncrypt, aesEncryptCombined, aesEncryptStreaming, assembleOQEFile, benchmarkArgon2, bytesToDataURL, copyToClipboard, createDropZone, createObjectURL, decryptResultToBlob, deriveKeyFromPassword, downloadBlob, downloadBytes, downloadDecryptedFile, downloadEncryptedFile, encryptResultToBlob, estimateArgon2Params, exportAesKey, formatFileSize, generateAesKey, generateArgon2Salt, getAlgorithmName, getFileInfo, importAesKey, isArgon2Available, isBrowser, isDragDropSupported, isFileAPIAvailable, isOQEFile, isWebCryptoAvailable, openFilePicker, openFileToEncrypt, openOQEFilePicker, parseHybridKeyMaterial, parseMetadata, parseOQEFile, parseOQEHeader, parsePasswordKeyMaterial, readFile, readFileAsDataURL, readFileAsText, removeOQEExtension, serializeHybridKeyMaterial, serializeMetadata, serializePasswordKeyMaterial, verifyPassword, writeOQEHeader };
421
+ export { AES_GCM_IV_SIZE, AES_GCM_TAG_SIZE, AES_KEY_SIZE, AlgorithmSuiteId, Argon2idParams, HybridKeyMaterial, HybridKeyMaterialV2, OQEDecryptResult, OQEEncryptResult, OQEHeader, OQEMetadata, OQE_EXTENSION, OQE_MIME_TYPE, PasswordKeyMaterial, STREAM_CHUNK_SIZE, addOQEExtension, aesDecrypt, aesDecryptCombined, aesDecryptStreaming, aesEncrypt, aesEncryptCombined, aesEncryptStreaming, assembleOQEFile, benchmarkArgon2, bytesToDataURL, copyToClipboard, createDropZone, createObjectURL, decryptResultToBlob, deriveKeyFromPassword, downloadBlob, downloadBytes, downloadDecryptedFile, downloadEncryptedFile, encryptResultToBlob, estimateArgon2Params, exportAesKey, formatFileSize, generateAesKey, generateArgon2Salt, getAlgorithmName, getFileInfo, importAesKey, isArgon2Available, isBrowser, isDragDropSupported, isFileAPIAvailable, isOQEFile, isWebCryptoAvailable, openFilePicker, openFileToEncrypt, openOQEFilePicker, oqeHeaderSize, parseHybridKeyMaterial, parseHybridKeyMaterialV2, parseMetadata, parseOQEFile, parseOQEHeader, parsePasswordKeyMaterial, readFile, readFileAsDataURL, readFileAsText, removeOQEExtension, serializeHybridKeyMaterial, serializeHybridKeyMaterialV2, serializeMetadata, serializePasswordKeyMaterial, verifyPassword, writeOQEHeader };