@majikah/majik-message 0.2.1 → 0.2.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.
- package/dist/core/types.d.ts +35 -0
- package/dist/majik-message.js +2 -1
- package/package.json +2 -2
package/dist/core/types.d.ts
CHANGED
|
@@ -85,6 +85,22 @@ export interface MajikKeyMetadata {
|
|
|
85
85
|
kdfVersion: number;
|
|
86
86
|
hasMlKem: boolean;
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Explicit integer compression level for Zstd, 1–22.
|
|
90
|
+
*
|
|
91
|
+
* Recommended values:
|
|
92
|
+
* - 1 → Fastest possible; still meaningfully compresses text/code.
|
|
93
|
+
* - 3 → Good speed/ratio balance for real-time paths.
|
|
94
|
+
* - 6 → Inflection point — noticeably better ratio, modest speed cost.
|
|
95
|
+
* - 9 → Strong compression; gains plateau significantly after this.
|
|
96
|
+
* - 15 → High-effort; use only for smaller, latency-insensitive uploads.
|
|
97
|
+
* - 19 → Near-maximum ratio without WASM memory pressure.
|
|
98
|
+
* - 22 → Archival-grade; not safe for files > 10 MB in WASM environments.
|
|
99
|
+
*
|
|
100
|
+
* For production use, prefer a CompressionPreset over a raw integer unless
|
|
101
|
+
* you have a specific tuning requirement.
|
|
102
|
+
*/
|
|
103
|
+
export type CompressionLevel = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22;
|
|
88
104
|
/**
|
|
89
105
|
* Options for MajikMessage.encryptFile().
|
|
90
106
|
*
|
|
@@ -137,6 +153,25 @@ export interface EncryptFileOptions {
|
|
|
137
153
|
threadMessageId?: string;
|
|
138
154
|
/** Foreign-key association with a thread. */
|
|
139
155
|
threadId?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Zstd compression level or preset for this file.
|
|
158
|
+
*
|
|
159
|
+
* Accepts either a raw integer (`CompressionLevel` 1–22) or a named
|
|
160
|
+
* `CompressionPreset` value. The level is always run through
|
|
161
|
+
* `MajikCompressor.adaptiveLevel()` before use, so it will be silently
|
|
162
|
+
* clamped downward for large files to avoid WASM out-of-memory errors.
|
|
163
|
+
*
|
|
164
|
+
* Defaults to ZSTD_MAX_LEVEL (22) when omitted — existing behaviour.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* // Raw integer
|
|
168
|
+
* compressionLevel: 9
|
|
169
|
+
*
|
|
170
|
+
* // Named preset
|
|
171
|
+
* compressionLevel: CompressionPreset.GOOD // 9
|
|
172
|
+
* compressionLevel: CompressionPreset.BALANCED // 6
|
|
173
|
+
*/
|
|
174
|
+
compressionLevel?: CompressionLevel | number;
|
|
140
175
|
}
|
|
141
176
|
/**
|
|
142
177
|
* Returned by MajikMessage.encryptFile().
|
package/dist/majik-message.js
CHANGED
|
@@ -659,7 +659,7 @@ export class MajikMessage {
|
|
|
659
659
|
* ```
|
|
660
660
|
*/
|
|
661
661
|
async encryptFile(options) {
|
|
662
|
-
const { data, context, originalName, mimeType, recipients = [], conversationId, isTemporary = false, expiresAt, bypassSizeLimit = false, chatMessageId, threadMessageId, threadId, userId, } = options;
|
|
662
|
+
const { data, context, originalName, mimeType, recipients = [], conversationId, isTemporary = false, expiresAt, bypassSizeLimit = false, chatMessageId, threadMessageId, threadId, userId, compressionLevel, } = options;
|
|
663
663
|
// ── 1. Resolve sender identity ──────────────────────────────────────────
|
|
664
664
|
// Builds MajikFileIdentity with both public + secret keys from keystore.
|
|
665
665
|
const identity = await this._resolveFileIdentity();
|
|
@@ -687,6 +687,7 @@ export class MajikMessage {
|
|
|
687
687
|
threadMessageId,
|
|
688
688
|
userId: finalUserID,
|
|
689
689
|
threadId: threadId,
|
|
690
|
+
compressionLevel,
|
|
690
691
|
});
|
|
691
692
|
// ── 4. Package the result ───────────────────────────────────────────────
|
|
692
693
|
return {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@majikah/majik-message",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Post-quantum end-to-end encryption with ML-KEM-768. Seed phrase–based accounts. Auto-expiring messages. Offline-ready. Exportable encrypted messages. Tamper-proof threads with blockchain-like integrity. Quantum-resistant messaging.",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.2",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "Zelijah",
|
|
8
8
|
"main": "./dist/index.js",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@bokuweb/zstd-wasm": "^0.0.27",
|
|
83
83
|
"@majikah/majik-envelope": "^0.0.1",
|
|
84
|
-
"@majikah/majik-file": "^0.0.
|
|
84
|
+
"@majikah/majik-file": "^0.0.14",
|
|
85
85
|
"@majikah/majik-key": "^0.1.10",
|
|
86
86
|
"@noble/hashes": "^2.0.1",
|
|
87
87
|
"@noble/post-quantum": "^0.5.4",
|