@majikah/majik-message 0.2.9 → 0.2.10

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.
@@ -27,6 +27,12 @@ export class MajikContactDirectory {
27
27
  * Contact Management
28
28
  * ================================ */
29
29
  addContact(contact) {
30
+ if (!contact?.id ||
31
+ !contact?.publicKey ||
32
+ !contact?.fingerprint ||
33
+ !contact?.mlKey) {
34
+ throw new MajikContactDirectoryError("Invalid contact");
35
+ }
30
36
  if (!(contact instanceof MajikContact)) {
31
37
  throw new MajikContactDirectoryError("Invalid contact instance");
32
38
  }
@@ -418,6 +418,9 @@ export class MajikMessage {
418
418
  catch {
419
419
  publicKey = { raw: new Uint8Array(rawBuffer) };
420
420
  }
421
+ if (!data?.id || !publicKey || !data?.fingerprint || !data?.mlKey) {
422
+ throw new Error("Invalid contact JSON");
423
+ }
421
424
  return new MajikContact({
422
425
  id: data.id,
423
426
  publicKey,
@@ -427,6 +430,12 @@ export class MajikMessage {
427
430
  });
428
431
  }
429
432
  addContact(contact) {
433
+ if (!contact?.id ||
434
+ !contact?.publicKey ||
435
+ !contact?.fingerprint ||
436
+ !contact?.mlKey) {
437
+ throw new Error("Invalid contact JSON");
438
+ }
430
439
  this.contactDirectory.addContact(contact);
431
440
  this.emit("new-contact", contact);
432
441
  this.scheduleAutosave();
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.9",
5
+ "version": "0.2.10",
6
6
  "license": "Apache-2.0",
7
7
  "author": "Zelijah",
8
8
  "main": "./dist/index.js",
@@ -81,9 +81,9 @@
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.19",
85
- "@majikah/majik-key": "^0.2.2",
86
- "@majikah/majik-signature": "^0.0.6",
84
+ "@majikah/majik-file": "^0.0.20",
85
+ "@majikah/majik-key": "^0.2.3",
86
+ "@majikah/majik-signature": "^0.0.10",
87
87
  "@noble/hashes": "^2.0.1",
88
88
  "@noble/post-quantum": "^0.5.4",
89
89
  "@scure/bip39": "^1.6.0",