@majikah/majik-message 0.2.6 → 0.2.8

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.
@@ -208,6 +208,7 @@ export declare class MajikKeyStore {
208
208
  * Drop-in for MajikKeyStore.deleteIdentity().
209
209
  */
210
210
  static deleteIdentity(id: string): Promise<void>;
211
+ static deleteAll(): Promise<void>;
211
212
  /**
212
213
  * Drop-in for MajikKeyStore.generateMnemonic().
213
214
  */
@@ -519,6 +519,20 @@ export class MajikKeyStore {
519
519
  static async deleteIdentity(id) {
520
520
  return this.delete(id);
521
521
  }
522
+ static async deleteAll() {
523
+ const db = await this._getDB();
524
+ const clearStore = (storeName) => new Promise((resolve, reject) => {
525
+ if (!db.objectStoreNames.contains(storeName))
526
+ return resolve();
527
+ const tx = db.transaction(storeName, "readwrite");
528
+ const req = tx.objectStore(storeName).clear();
529
+ req.onsuccess = () => resolve();
530
+ req.onerror = () => reject(new MajikKeyStoreError(`Failed to clear store: ${storeName}`, req.error));
531
+ });
532
+ await clearStore(STORE_NAME);
533
+ await clearStore(LEGACY_STORE_NAME);
534
+ this._keys.clear();
535
+ }
522
536
  /**
523
537
  * Drop-in for MajikKeyStore.generateMnemonic().
524
538
  */
@@ -1998,6 +1998,12 @@ export class MajikMessage {
1998
1998
  catch {
1999
1999
  /* ignore */
2000
2000
  }
2001
+ try {
2002
+ await MajikKeyStore.deleteAll();
2003
+ }
2004
+ catch {
2005
+ /* ignore */
2006
+ }
2001
2007
  this.pinHash = null;
2002
2008
  this.id = arrayToBase64(randomBytes(32));
2003
2009
  try {
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.6",
5
+ "version": "0.2.8",
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.17",
85
- "@majikah/majik-key": "^0.2.0",
86
- "@majikah/majik-signature": "^0.0.3",
84
+ "@majikah/majik-file": "^0.0.19",
85
+ "@majikah/majik-key": "^0.2.1",
86
+ "@majikah/majik-signature": "^0.0.6",
87
87
  "@noble/hashes": "^2.0.1",
88
88
  "@noble/post-quantum": "^0.5.4",
89
89
  "@scure/bip39": "^1.6.0",