morok-bot-sdk 1.0.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.
Files changed (96) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +602 -0
  3. package/README.ru.md +602 -0
  4. package/dist/bot.d.ts +232 -0
  5. package/dist/bot.d.ts.map +1 -0
  6. package/dist/bot.js +558 -0
  7. package/dist/bot.js.map +1 -0
  8. package/dist/crypto/channel-cipher.d.ts +32 -0
  9. package/dist/crypto/channel-cipher.d.ts.map +1 -0
  10. package/dist/crypto/channel-cipher.js +77 -0
  11. package/dist/crypto/channel-cipher.js.map +1 -0
  12. package/dist/crypto/channel-key-store.d.ts +37 -0
  13. package/dist/crypto/channel-key-store.d.ts.map +1 -0
  14. package/dist/crypto/channel-key-store.js +149 -0
  15. package/dist/crypto/channel-key-store.js.map +1 -0
  16. package/dist/crypto/cross-signing.d.ts +57 -0
  17. package/dist/crypto/cross-signing.d.ts.map +1 -0
  18. package/dist/crypto/cross-signing.js +111 -0
  19. package/dist/crypto/cross-signing.js.map +1 -0
  20. package/dist/crypto/file-cipher.d.ts +36 -0
  21. package/dist/crypto/file-cipher.d.ts.map +1 -0
  22. package/dist/crypto/file-cipher.js +61 -0
  23. package/dist/crypto/file-cipher.js.map +1 -0
  24. package/dist/crypto/group-secret-cipher.d.ts +49 -0
  25. package/dist/crypto/group-secret-cipher.d.ts.map +1 -0
  26. package/dist/crypto/group-secret-cipher.js +69 -0
  27. package/dist/crypto/group-secret-cipher.js.map +1 -0
  28. package/dist/crypto/group-secret-store.d.ts +35 -0
  29. package/dist/crypto/group-secret-store.d.ts.map +1 -0
  30. package/dist/crypto/group-secret-store.js +149 -0
  31. package/dist/crypto/group-secret-store.js.map +1 -0
  32. package/dist/crypto/signal.d.ts +81 -0
  33. package/dist/crypto/signal.d.ts.map +1 -0
  34. package/dist/crypto/signal.js +125 -0
  35. package/dist/crypto/signal.js.map +1 -0
  36. package/dist/crypto/stores.d.ts +130 -0
  37. package/dist/crypto/stores.d.ts.map +1 -0
  38. package/dist/crypto/stores.js +314 -0
  39. package/dist/crypto/stores.js.map +1 -0
  40. package/dist/flow/attachments.d.ts +110 -0
  41. package/dist/flow/attachments.d.ts.map +1 -0
  42. package/dist/flow/attachments.js +409 -0
  43. package/dist/flow/attachments.js.map +1 -0
  44. package/dist/flow/conv-cache.d.ts +36 -0
  45. package/dist/flow/conv-cache.d.ts.map +1 -0
  46. package/dist/flow/conv-cache.js +84 -0
  47. package/dist/flow/conv-cache.js.map +1 -0
  48. package/dist/flow/direct.d.ts +109 -0
  49. package/dist/flow/direct.d.ts.map +1 -0
  50. package/dist/flow/direct.js +346 -0
  51. package/dist/flow/direct.js.map +1 -0
  52. package/dist/flow/groups.d.ts +146 -0
  53. package/dist/flow/groups.d.ts.map +1 -0
  54. package/dist/flow/groups.js +768 -0
  55. package/dist/flow/groups.js.map +1 -0
  56. package/dist/flow/prekeys.d.ts +45 -0
  57. package/dist/flow/prekeys.d.ts.map +1 -0
  58. package/dist/flow/prekeys.js +111 -0
  59. package/dist/flow/prekeys.js.map +1 -0
  60. package/dist/flow/receive.d.ts +125 -0
  61. package/dist/flow/receive.d.ts.map +1 -0
  62. package/dist/flow/receive.js +773 -0
  63. package/dist/flow/receive.js.map +1 -0
  64. package/dist/index.d.ts +15 -0
  65. package/dist/index.d.ts.map +1 -0
  66. package/dist/index.js +6 -0
  67. package/dist/index.js.map +1 -0
  68. package/dist/morokbot-file.d.ts +14 -0
  69. package/dist/morokbot-file.d.ts.map +1 -0
  70. package/dist/morokbot-file.js +88 -0
  71. package/dist/morokbot-file.js.map +1 -0
  72. package/dist/ratelimit.d.ts +40 -0
  73. package/dist/ratelimit.d.ts.map +1 -0
  74. package/dist/ratelimit.js +76 -0
  75. package/dist/ratelimit.js.map +1 -0
  76. package/dist/sessions.d.ts +34 -0
  77. package/dist/sessions.d.ts.map +1 -0
  78. package/dist/sessions.js +69 -0
  79. package/dist/sessions.js.map +1 -0
  80. package/dist/state-lock.d.ts +17 -0
  81. package/dist/state-lock.d.ts.map +1 -0
  82. package/dist/state-lock.js +66 -0
  83. package/dist/state-lock.js.map +1 -0
  84. package/dist/transport/http.d.ts +48 -0
  85. package/dist/transport/http.d.ts.map +1 -0
  86. package/dist/transport/http.js +112 -0
  87. package/dist/transport/http.js.map +1 -0
  88. package/dist/transport/ws.d.ts +65 -0
  89. package/dist/transport/ws.d.ts.map +1 -0
  90. package/dist/transport/ws.js +219 -0
  91. package/dist/transport/ws.js.map +1 -0
  92. package/dist/types.d.ts +254 -0
  93. package/dist/types.d.ts.map +1 -0
  94. package/dist/types.js +2 -0
  95. package/dist/types.js.map +1 -0
  96. package/package.json +59 -0
@@ -0,0 +1,254 @@
1
+ /**
2
+ * Public types. Adding fields is non-breaking, renaming or removing needs a major bump
3
+ */
4
+ export interface BotConfig {
5
+ /**
6
+ * Path to the .morokbot file from the web wizard. Read once at construction,
7
+ * keys are imported into stateDir on first start and the file is not re-read after that
8
+ */
9
+ tokenFile?: string;
10
+ /**
11
+ * Where Signal state lives: identity, sessions, prekeys, plus channel-key and group-secret state
12
+ * Default ./bot-state/, holds private keys after import, so chmod 0700 it
13
+ * Must be exclusive to one bot. Two processes on one stateDir corrupt each other's state,
14
+ * the SDK takes a best-effort pid lock but give each bot its own directory
15
+ */
16
+ stateDir?: string;
17
+ /** Default https://app.morok.me. Override for self-host / dev */
18
+ apiBaseUrl?: string;
19
+ /** Default derived from apiBaseUrl (http->ws, https->wss, +/ws) */
20
+ wsUrl?: string;
21
+ /** Replenish OTPKs when count falls below this, default 100 */
22
+ replenishThreshold?: number;
23
+ /** Target OTPK count after replenish, default 200, the server per call cap */
24
+ replenishTarget?: number;
25
+ /** Background loop interval in ms, default 5 minutes. 0 disables it,
26
+ * which drains the prekey pool in production, so use only in tests */
27
+ backgroundIntervalMs?: number;
28
+ /** Pino-shaped logger or anything with info/warn/error/debug. Default is silent */
29
+ logger?: SdkLogger;
30
+ /**
31
+ * If true, call backfillChannelKeys whenever a member joins a group/channel the bot is in,
32
+ * so a new joiner can read history when the bot is the only online member
33
+ * Off by default, backfill is expensive on convs with many devices and epochs
34
+ * Safe to enable, the server filters by joined_secret_version so pre-join history can't leak
35
+ */
36
+ autoBackfillOnJoin?: boolean;
37
+ serveBackfillRequests?: boolean;
38
+ }
39
+ export interface SdkLogger {
40
+ info: (obj: object, msg?: string) => void;
41
+ warn: (obj: object, msg?: string) => void;
42
+ error: (obj: object, msg?: string) => void;
43
+ debug: (obj: object, msg?: string) => void;
44
+ }
45
+ export interface MorokbotKeyPair {
46
+ pub: string;
47
+ priv: string;
48
+ }
49
+ export interface MorokbotSignedPreKey {
50
+ keyId: number;
51
+ pub: string;
52
+ priv: string;
53
+ signature: string;
54
+ }
55
+ export interface MorokbotOneTimePreKey {
56
+ keyId: number;
57
+ pub: string;
58
+ priv: string;
59
+ }
60
+ export interface MorokbotFile {
61
+ version: 1;
62
+ botUserId: number;
63
+ username: string;
64
+ token: string;
65
+ registrationId: number;
66
+ identityKey: MorokbotKeyPair;
67
+ /** Account-level cross-signing key. Optional for legacy wizards that pre-date it, new wizards always include it */
68
+ accountSigningKey?: MorokbotKeyPair;
69
+ signedPreKey: MorokbotSignedPreKey;
70
+ oneTimePreKeys: MorokbotOneTimePreKey[];
71
+ }
72
+ /** A user. Resolved lazily on first mention and cached */
73
+ export interface Peer {
74
+ userId: number;
75
+ username: string;
76
+ displayName: string | null;
77
+ }
78
+ /** DIRECT = peer-to-bot DM, GROUP and CHANNEL = channel-key flows. Routes bot.reply to peer or conversation */
79
+ export type ConversationType = 'DIRECT' | 'GROUP' | 'CHANNEL';
80
+ export interface IncomingMessage {
81
+ /** Persistent server id (messages.id) */
82
+ messageId: number;
83
+ conversationId: number;
84
+ conversationType: ConversationType;
85
+ sender: Peer;
86
+ senderDeviceId: number;
87
+ /** Text body, or the caption that came with an attachment, empty string if none. Always a string */
88
+ text: string;
89
+ /** Single-attachment messages. undefined when the message is a gallery (see `gallery` below) or text-only */
90
+ attachment?: IncomingAttachment;
91
+ /** Multi-attachment bubble (2-10 items). Mutually exclusive with `attachment` */
92
+ gallery?: IncomingGallery;
93
+ /** Sender-stable id shared by every fan-out copy of one logical send. bot.reply threads it through
94
+ * so a reply targets the logical message across all device copies */
95
+ clientMsgId: string | null;
96
+ replyToId: number | null;
97
+ threadRootId: number | null;
98
+ createdAt: Date;
99
+ }
100
+ export interface CommandInvocation extends IncomingMessage {
101
+ /** Command name without the leading slash */
102
+ command: string;
103
+ /** Everything after the command name, trimmed. Empty if none */
104
+ args: string;
105
+ /** args split on whitespace */
106
+ argv: string[];
107
+ }
108
+ export interface BotStartEvent {
109
+ peer: Peer;
110
+ startedAt: Date;
111
+ }
112
+ export interface BotStopEvent {
113
+ peer: Peer;
114
+ stoppedAt: Date;
115
+ }
116
+ /** Bot was added to a group or channel. By the time the handler fires the SDK has pulled the channel-key copies,
117
+ * so an immediate group_message decrypts */
118
+ export interface ConversationAddedEvent {
119
+ conversationId: number;
120
+ conversationType: 'GROUP' | 'CHANNEL';
121
+ /** Title if the group has one, null otherwise */
122
+ title: string | null;
123
+ addedAt: Date;
124
+ }
125
+ /** Bot was removed. The SDK drops local state before the handler fires, no further messages decrypt unless re-added */
126
+ export interface ConversationKickedEvent {
127
+ conversationId: number;
128
+ /** 'kicked' = admin removed, 'left' = conversation destroyed */
129
+ reason: 'kicked' | 'left';
130
+ /** Admin who initiated, if known */
131
+ actorUserId: number | null;
132
+ removedAt: Date;
133
+ }
134
+ export interface ReactionEvent {
135
+ /** Server id of the reactor's fan-out twin of the reacted-to message
136
+ * To find which message was reacted to, match clientMsgId below */
137
+ messageId: number;
138
+ /** Logical id shared by every fan-out copy of the reacted-to message,
139
+ * matching clientMsgId on IncomingMessage and SendResult. null on legacy rows without client_msg_id */
140
+ clientMsgId: string | null;
141
+ reactor: Peer;
142
+ /** Decoded reaction content, any unicode string and not only an emoji
143
+ * The bot receives the reaction envelope and decrypts it like a message
144
+ * null on a removal or if a group reaction's channel-key has not reached the bot yet */
145
+ unicode: string | null;
146
+ /** false = reactor removed their previous reaction */
147
+ added: boolean;
148
+ }
149
+ export interface DisconnectInfo {
150
+ reason: 'transport' | 'auth' | 'shutdown';
151
+ code?: number | string;
152
+ /** false on shutdown, true otherwise (SDK will reconnect) */
153
+ willReconnect: boolean;
154
+ }
155
+ export interface BotCommand {
156
+ command: string;
157
+ description: string;
158
+ sortOrder: number;
159
+ }
160
+ export interface BotControl {
161
+ id: string;
162
+ label: string;
163
+ icon?: string;
164
+ command?: string;
165
+ children?: BotControl[];
166
+ }
167
+ export interface ControlEvent {
168
+ controlId: string;
169
+ sender: Peer;
170
+ conversationId: number;
171
+ conversationType: ConversationType;
172
+ }
173
+ /**
174
+ * Video note shape name, an open string passed to the receiver, which renders the names it knows
175
+ * and shows circle for anything else. Plain string so a new receiver shape works without an SDK release
176
+ *
177
+ * Names the receiver renders: circle, square, slanted, pill, oval, arch, diamond, pentagon, gem, clamShell,
178
+ * sunny, cookie1, cookie2, cookie3, cookie4, clover1, clover2, burst, softBurst, puffyDiamond, pixelCircle, heart
179
+ */
180
+ export type VideoNoteShape = string;
181
+ /** One attachment per send. Use SendArgs.attachments for galleries */
182
+ export type AttachmentInput = {
183
+ kind: 'file';
184
+ /** Raw bytes. Buffer or Uint8Array */
185
+ data: Buffer | Uint8Array;
186
+ /** Filename shown on the receiver's download UI */
187
+ name: string;
188
+ /** Mime. Defaults to application/octet-stream */
189
+ mime?: string;
190
+ } | {
191
+ kind: 'voice';
192
+ data: Buffer | Uint8Array;
193
+ /** Seconds. Receiver clamps to [0.1, 600] (10-min cap for voice notes) */
194
+ duration: number;
195
+ /** Up to 64 ints in [0..100] */
196
+ waveform?: number[];
197
+ /** Defaults to audio/ogg */
198
+ mime?: string;
199
+ } | {
200
+ kind: 'video_note';
201
+ data: Buffer | Uint8Array;
202
+ /** Seconds. Receiver clamps to [0.5, 300] (5-min cap for video notes) */
203
+ duration: number;
204
+ /** Default 'circle' */
205
+ shape?: VideoNoteShape;
206
+ /** Defaults to video/webm */
207
+ mime?: string;
208
+ };
209
+ /**
210
+ * Inbound attachment. download() is lazy, bytes hit the network only when called and return decrypted plaintext,
211
+ * the server never had the key. mime is sender-supplied, treat it as a hint with no security guarantee
212
+ */
213
+ export interface IncomingAttachment {
214
+ kind: 'file' | 'voice' | 'video_note';
215
+ fileId: number;
216
+ sha256: string;
217
+ /** Sender-supplied */
218
+ mime: string;
219
+ /** Plaintext size in bytes */
220
+ size: number;
221
+ /** Filename for 'file'. null for voice / video_note */
222
+ name: string | null;
223
+ /** Seconds, present on voice / video_note */
224
+ duration?: number;
225
+ /** Peaks 0..100, present on voice */
226
+ waveform?: number[];
227
+ /** Present on video_note */
228
+ shape?: VideoNoteShape;
229
+ /** Upload-time VT verdict, or null if pending or out of scope. The SDK does not subscribe to live updates */
230
+ virusTotalVerdict: 'clean' | 'suspicious' | 'malware' | string | null;
231
+ /** Resolves with plaintext bytes, rejects on 404 / 410 / tamper */
232
+ download: () => Promise<Buffer>;
233
+ }
234
+ /** One item inside a gallery. Files have a download(), contact and location items just carry metadata */
235
+ export type IncomingGalleryItem = {
236
+ kind: 'file';
237
+ attachment: IncomingAttachment;
238
+ } | {
239
+ kind: 'contact';
240
+ userId: number;
241
+ username?: string;
242
+ displayName?: string;
243
+ avatarUrl?: string;
244
+ avatarUnicode?: string;
245
+ } | {
246
+ kind: 'location';
247
+ lat: number;
248
+ lng: number;
249
+ };
250
+ /** 2-10 items in one bubble. Caption (if any) is surfaced on IncomingMessage.text */
251
+ export interface IncomingGallery {
252
+ items: IncomingGalleryItem[];
253
+ }
254
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,MAAM,WAAW,SAAS;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;;OAKG;IACH,QAAQ,CAAC,EAA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BAAsB;IACtB,IAAI,EAAM,MAAM,CAAA;IAChB,8BAA8B;IAC9B,IAAI,EAAM,MAAM,CAAA;IAChB,uDAAuD;IACvD,IAAI,EAAM,MAAM,GAAG,IAAI,CAAA;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,4BAA4B;IAC5B,KAAK,CAAC,EAAI,cAAc,CAAA;IACxB,6GAA6G;IAC7G,iBAAiB,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAAA;IACrE,mEAAmE;IACnE,QAAQ,EAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;CACnC;AAGD,yGAAyG;AACzG,MAAM,MAAM,mBAAmB,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,kBAAkB,CAAA;CAAE,GAChD;IACE,IAAI,EAAE,SAAS,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAK,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAI,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;CACzB,GACC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAGpD,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,mBAAmB,EAAE,CAAA;CAC/B"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "morok-bot-sdk",
3
+ "version": "1.0.1",
4
+ "description": "Node.js SDK for building bots on the Morok E2E messaging platform",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "README.ru.md",
18
+ "LICENSE"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.json --declaration false --declarationMap false && tsc -p tsconfig.json --emitDeclarationOnly --removeComments false",
22
+ "clean": "rm -rf dist docs-api",
23
+ "dev": "tsx watch src/index.ts",
24
+ "typecheck": "tsc --noEmit",
25
+ "test": "vitest run",
26
+ "test:watch":"vitest",
27
+ "docs:api": "typedoc"
28
+ },
29
+ "engines": {
30
+ "node": ">=22.0.0"
31
+ },
32
+ "dependencies": {
33
+ "@privacyresearch/libsignal-protocol-typescript": "^0.0.16",
34
+ "axios": "^1.15.0",
35
+ "ws": "^8.20.0",
36
+ "zod": "^3.23.8"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^22.7.4",
40
+ "@types/ws": "^8.18.1",
41
+ "tsx": "^4.19.2",
42
+ "typedoc": "^0.28.0",
43
+ "typescript": "^5.9.3",
44
+ "vitest": "^2.1.4"
45
+ },
46
+ "license": "Apache-2.0",
47
+ "keywords": ["morok", "bot", "sdk", "e2e", "signal", "messaging", "encryption"],
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/geloid/morok-bot-sdk.git"
51
+ },
52
+ "homepage": "https://morok.me",
53
+ "bugs": {
54
+ "url": "https://github.com/geloid/morok-bot-sdk/issues"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ }
59
+ }