@thezelijah/majik-message 1.0.14 → 1.0.15
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MajikMessageAccountID, MajikMessageChatID, MajikMessagePublicKey } from "../../types";
|
|
2
2
|
import { MajikMessageIdentity } from "../system/identity";
|
|
3
|
-
import { MajikMessageChatJSON } from "./types";
|
|
3
|
+
import { MajikMessageChatJSON, RedisKey } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* Represents a temporary, compressed message with automatic expiration.
|
|
6
6
|
* Messages are automatically compressed on creation and stored in Redis by default.
|
|
@@ -88,9 +88,10 @@ export declare class MajikMessageChat {
|
|
|
88
88
|
getUnreadRecipients(): string[];
|
|
89
89
|
toJSON(): MajikMessageChatJSON;
|
|
90
90
|
static fromJSON(json: string | MajikMessageChatJSON): MajikMessageChat;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
getRedisKey(): RedisKey;
|
|
92
|
+
getRedisMessageKey(): RedisKey;
|
|
93
|
+
getRedisConversationIndexKey(): RedisKey;
|
|
94
|
+
getRedisInboxIndexKey(publicKey: MajikMessagePublicKey): RedisKey;
|
|
94
95
|
getTTLUnixTimestamp(): number;
|
|
95
96
|
getTTLSeconds(): number;
|
|
96
97
|
toRedisPayload(): string;
|
|
@@ -365,6 +365,9 @@ export class MajikMessageChat {
|
|
|
365
365
|
return new MajikMessageChat(rawParse.id, rawParse.account, rawParse.message, rawParse.sender, rawParse.recipients || [], rawParse.timestamp, rawParse.expires_at, rawParse.read_by || [], rawParse?.conversation_id);
|
|
366
366
|
}
|
|
367
367
|
// ============= REDIS METHODS =============
|
|
368
|
+
getRedisKey() {
|
|
369
|
+
return `majik_message:${this.conversation_id}:${this.id}`;
|
|
370
|
+
}
|
|
368
371
|
// Generate Redis key
|
|
369
372
|
getRedisMessageKey() {
|
|
370
373
|
return `msg:${this.id}`;
|
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.0.
|
|
5
|
+
"version": "1.0.15",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "Zelijah",
|
|
8
8
|
"main": "./dist/index.js",
|