@thezelijah/majik-message 1.1.0 → 1.1.1
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/majik-message.d.ts +1 -1
- package/dist/majik-message.js +8 -0
- package/package.json +1 -1
package/dist/majik-message.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { MajikContactDirectory, type MajikContactDirectoryData } from "./core/co
|
|
|
6
6
|
import type { MAJIK_API_RESPONSE } from "./core/types";
|
|
7
7
|
import { MajikMessageChat } from "./core/database/chat/majik-message-chat";
|
|
8
8
|
import { MajikMessageIdentity } from "./core/database/system/identity";
|
|
9
|
-
type MajikMessageEvents = "message" | "envelope" | "untrusted" | "error" | "active-account-change";
|
|
9
|
+
type MajikMessageEvents = "message" | "envelope" | "untrusted" | "error" | "new-account" | "new-contact" | "removed-account" | "removed-contact" | "active-account-change";
|
|
10
10
|
interface MajikMessageStatic<T extends MajikMessage> {
|
|
11
11
|
new (config: MajikMessageConfig, id?: string): T;
|
|
12
12
|
fromJSON(json: MajikMessageJSON): Promise<T>;
|
package/dist/majik-message.js
CHANGED
|
@@ -48,6 +48,10 @@ export class MajikMessage {
|
|
|
48
48
|
"envelope",
|
|
49
49
|
"untrusted",
|
|
50
50
|
"error",
|
|
51
|
+
"new-account",
|
|
52
|
+
"new-contact",
|
|
53
|
+
"removed-account",
|
|
54
|
+
"removed-contact",
|
|
51
55
|
"active-account-change",
|
|
52
56
|
].forEach((e) => this.listeners.set(e, []));
|
|
53
57
|
// Attach autosave handlers so state is persisted automatically
|
|
@@ -156,6 +160,7 @@ export class MajikMessage {
|
|
|
156
160
|
this.setActiveAccount(account.id);
|
|
157
161
|
this.unlocked = true;
|
|
158
162
|
}
|
|
163
|
+
this.emit("new-account", account);
|
|
159
164
|
}
|
|
160
165
|
catch (e) {
|
|
161
166
|
// ignore if contact can't be added
|
|
@@ -232,6 +237,7 @@ export class MajikMessage {
|
|
|
232
237
|
this.envelopeCache.deleteByFingerprint(id).catch((error) => {
|
|
233
238
|
console.warn("Account not found in cache: ", error);
|
|
234
239
|
});
|
|
240
|
+
this.emit("removed-account", id);
|
|
235
241
|
this.scheduleAutosave();
|
|
236
242
|
return true;
|
|
237
243
|
}
|
|
@@ -432,6 +438,7 @@ export class MajikMessage {
|
|
|
432
438
|
}
|
|
433
439
|
addContact(contact) {
|
|
434
440
|
this.contactDirectory.addContact(contact);
|
|
441
|
+
this.emit("new-contact", contact);
|
|
435
442
|
this.scheduleAutosave();
|
|
436
443
|
}
|
|
437
444
|
removeContact(id) {
|
|
@@ -439,6 +446,7 @@ export class MajikMessage {
|
|
|
439
446
|
if (!removalStatus.success) {
|
|
440
447
|
throw new Error(removalStatus.message);
|
|
441
448
|
}
|
|
449
|
+
this.emit("removed-contact", id);
|
|
442
450
|
this.scheduleAutosave();
|
|
443
451
|
}
|
|
444
452
|
updateContactMeta(id, meta) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@thezelijah/majik-message",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Encrypt and decrypt messages on any website. Secure chats with keypairs and seed-based accounts. Open source.",
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.1",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "Zelijah",
|
|
8
8
|
"main": "./dist/index.js",
|