@haven-chat-org/core 1.0.0
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/LICENSE +661 -0
- package/README.md +71 -0
- package/dist/crypto/backup.d.ts +87 -0
- package/dist/crypto/backup.js +62 -0
- package/dist/crypto/backup.js.map +1 -0
- package/dist/crypto/double-ratchet.d.ts +104 -0
- package/dist/crypto/double-ratchet.js +274 -0
- package/dist/crypto/double-ratchet.js.map +1 -0
- package/dist/crypto/file.d.ts +14 -0
- package/dist/crypto/file.js +20 -0
- package/dist/crypto/file.js.map +1 -0
- package/dist/crypto/index.d.ts +9 -0
- package/dist/crypto/index.js +10 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/crypto/keys.d.ts +61 -0
- package/dist/crypto/keys.js +79 -0
- package/dist/crypto/keys.js.map +1 -0
- package/dist/crypto/passphrase.d.ts +10 -0
- package/dist/crypto/passphrase.js +142 -0
- package/dist/crypto/passphrase.js.map +1 -0
- package/dist/crypto/profile.d.ts +31 -0
- package/dist/crypto/profile.js +73 -0
- package/dist/crypto/profile.js.map +1 -0
- package/dist/crypto/sender-keys.d.ts +76 -0
- package/dist/crypto/sender-keys.js +170 -0
- package/dist/crypto/sender-keys.js.map +1 -0
- package/dist/crypto/sender-keys.test.d.ts +1 -0
- package/dist/crypto/sender-keys.test.js +272 -0
- package/dist/crypto/sender-keys.test.js.map +1 -0
- package/dist/crypto/utils.d.ts +41 -0
- package/dist/crypto/utils.js +102 -0
- package/dist/crypto/utils.js.map +1 -0
- package/dist/crypto/x3dh.d.ts +45 -0
- package/dist/crypto/x3dh.js +106 -0
- package/dist/crypto/x3dh.js.map +1 -0
- package/dist/export/__tests__/archive.test.d.ts +1 -0
- package/dist/export/__tests__/archive.test.js +276 -0
- package/dist/export/__tests__/archive.test.js.map +1 -0
- package/dist/export/archive.d.ts +38 -0
- package/dist/export/archive.js +107 -0
- package/dist/export/archive.js.map +1 -0
- package/dist/export/index.d.ts +4 -0
- package/dist/export/index.js +4 -0
- package/dist/export/index.js.map +1 -0
- package/dist/export/reader.d.ts +27 -0
- package/dist/export/reader.js +101 -0
- package/dist/export/reader.js.map +1 -0
- package/dist/export/signing.d.ts +15 -0
- package/dist/export/signing.js +44 -0
- package/dist/export/signing.js.map +1 -0
- package/dist/export/types.d.ts +128 -0
- package/dist/export/types.js +3 -0
- package/dist/export/types.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/net/api.d.ts +200 -0
- package/dist/net/api.js +715 -0
- package/dist/net/api.js.map +1 -0
- package/dist/net/api.test.d.ts +1 -0
- package/dist/net/api.test.js +884 -0
- package/dist/net/api.test.js.map +1 -0
- package/dist/net/index.d.ts +2 -0
- package/dist/net/index.js +3 -0
- package/dist/net/index.js.map +1 -0
- package/dist/net/ws.d.ts +71 -0
- package/dist/net/ws.js +257 -0
- package/dist/net/ws.js.map +1 -0
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.js +2 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/memory.d.ts +24 -0
- package/dist/store/memory.js +50 -0
- package/dist/store/memory.js.map +1 -0
- package/dist/store/types.d.ts +23 -0
- package/dist/store/types.js +2 -0
- package/dist/store/types.js.map +1 -0
- package/dist/types.d.ts +850 -0
- package/dist/types.js +35 -0
- package/dist/types.js.map +1 -0
- package/package.json +41 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,850 @@
|
|
|
1
|
+
export interface RegisterRequest {
|
|
2
|
+
username: string;
|
|
3
|
+
password: string;
|
|
4
|
+
display_name?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
identity_key: string;
|
|
7
|
+
signed_prekey: string;
|
|
8
|
+
signed_prekey_signature: string;
|
|
9
|
+
one_time_prekeys: string[];
|
|
10
|
+
pow_challenge: string;
|
|
11
|
+
pow_nonce: string;
|
|
12
|
+
invite_code?: string;
|
|
13
|
+
turnstile_token?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Fields the caller provides — PoW fields are auto-filled by the API client */
|
|
16
|
+
export type RegisterInput = Omit<RegisterRequest, "pow_challenge" | "pow_nonce">;
|
|
17
|
+
export interface PowChallengeResponse {
|
|
18
|
+
challenge: string;
|
|
19
|
+
difficulty: number;
|
|
20
|
+
turnstile_site_key?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface LoginRequest {
|
|
23
|
+
username: string;
|
|
24
|
+
password: string;
|
|
25
|
+
totp_code?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface AuthResponse {
|
|
28
|
+
access_token: string;
|
|
29
|
+
refresh_token: string;
|
|
30
|
+
user: UserPublic;
|
|
31
|
+
}
|
|
32
|
+
export interface LoginTotpRequiredResponse {
|
|
33
|
+
totp_required: true;
|
|
34
|
+
}
|
|
35
|
+
export type LoginResponse = AuthResponse | LoginTotpRequiredResponse;
|
|
36
|
+
export declare function isLoginSuccess(res: LoginResponse): res is AuthResponse;
|
|
37
|
+
export interface RefreshRequest {
|
|
38
|
+
refresh_token: string;
|
|
39
|
+
}
|
|
40
|
+
export interface TotpSetupResponse {
|
|
41
|
+
secret: string;
|
|
42
|
+
qr_code_uri: string;
|
|
43
|
+
}
|
|
44
|
+
export interface TotpVerifyRequest {
|
|
45
|
+
code: string;
|
|
46
|
+
}
|
|
47
|
+
export interface SessionResponse {
|
|
48
|
+
id: string;
|
|
49
|
+
family_id: string | null;
|
|
50
|
+
device_name: string | null;
|
|
51
|
+
ip_address: string | null;
|
|
52
|
+
last_activity: string | null;
|
|
53
|
+
created_at: string;
|
|
54
|
+
is_current: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface UserPublic {
|
|
57
|
+
id: string;
|
|
58
|
+
username: string;
|
|
59
|
+
display_name: string | null;
|
|
60
|
+
about_me: string | null;
|
|
61
|
+
avatar_url: string | null;
|
|
62
|
+
banner_url: string | null;
|
|
63
|
+
custom_status: string | null;
|
|
64
|
+
custom_status_emoji: string | null;
|
|
65
|
+
created_at: string;
|
|
66
|
+
encrypted_profile?: string | null;
|
|
67
|
+
is_instance_admin?: boolean;
|
|
68
|
+
totp_enabled?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface MutualFriendInfo {
|
|
71
|
+
user_id: string;
|
|
72
|
+
username: string;
|
|
73
|
+
display_name: string | null;
|
|
74
|
+
avatar_url: string | null;
|
|
75
|
+
}
|
|
76
|
+
export interface UserProfileResponse {
|
|
77
|
+
id: string;
|
|
78
|
+
username: string;
|
|
79
|
+
display_name: string | null;
|
|
80
|
+
about_me: string | null;
|
|
81
|
+
avatar_url: string | null;
|
|
82
|
+
banner_url: string | null;
|
|
83
|
+
custom_status: string | null;
|
|
84
|
+
custom_status_emoji: string | null;
|
|
85
|
+
created_at: string;
|
|
86
|
+
is_blocked: boolean;
|
|
87
|
+
is_friend: boolean;
|
|
88
|
+
friend_request_status: "pending_incoming" | "pending_outgoing" | null;
|
|
89
|
+
friendship_id: string | null;
|
|
90
|
+
mutual_friend_count: number;
|
|
91
|
+
mutual_friends: MutualFriendInfo[];
|
|
92
|
+
mutual_server_count: number;
|
|
93
|
+
roles?: RoleResponse[];
|
|
94
|
+
encrypted_profile?: string | null;
|
|
95
|
+
}
|
|
96
|
+
export interface UpdateProfileRequest {
|
|
97
|
+
display_name?: string | null;
|
|
98
|
+
about_me?: string | null;
|
|
99
|
+
custom_status?: string | null;
|
|
100
|
+
custom_status_emoji?: string | null;
|
|
101
|
+
encrypted_profile?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface ProfileKeyDistributionEntry {
|
|
104
|
+
to_user_id: string;
|
|
105
|
+
encrypted_profile_key: string;
|
|
106
|
+
}
|
|
107
|
+
export interface DistributeProfileKeysRequest {
|
|
108
|
+
distributions: ProfileKeyDistributionEntry[];
|
|
109
|
+
}
|
|
110
|
+
export interface ProfileKeyResponse {
|
|
111
|
+
from_user_id: string;
|
|
112
|
+
encrypted_profile_key: string;
|
|
113
|
+
}
|
|
114
|
+
/** Plaintext fields stored inside the encrypted profile blob */
|
|
115
|
+
export interface ProfileFields {
|
|
116
|
+
about_me?: string | null;
|
|
117
|
+
custom_status?: string | null;
|
|
118
|
+
custom_status_emoji?: string | null;
|
|
119
|
+
}
|
|
120
|
+
export interface ChangePasswordRequest {
|
|
121
|
+
current_password: string;
|
|
122
|
+
new_password: string;
|
|
123
|
+
}
|
|
124
|
+
export interface BlockedUserResponse {
|
|
125
|
+
user_id: string;
|
|
126
|
+
username: string;
|
|
127
|
+
display_name: string | null;
|
|
128
|
+
avatar_url: string | null;
|
|
129
|
+
blocked_at: string;
|
|
130
|
+
}
|
|
131
|
+
export interface KeyBundle {
|
|
132
|
+
identity_key: string;
|
|
133
|
+
signed_prekey: string;
|
|
134
|
+
signed_prekey_sig: string;
|
|
135
|
+
one_time_prekey: string | null;
|
|
136
|
+
}
|
|
137
|
+
export interface UploadPreKeysRequest {
|
|
138
|
+
prekeys: string[];
|
|
139
|
+
}
|
|
140
|
+
export interface PreKeyCountResponse {
|
|
141
|
+
count: number;
|
|
142
|
+
needs_replenishment: boolean;
|
|
143
|
+
}
|
|
144
|
+
export interface UpdateKeysRequest {
|
|
145
|
+
identity_key: string;
|
|
146
|
+
signed_prekey: string;
|
|
147
|
+
signed_prekey_signature: string;
|
|
148
|
+
}
|
|
149
|
+
export interface UploadKeyBackupRequest {
|
|
150
|
+
encrypted_data: string;
|
|
151
|
+
nonce: string;
|
|
152
|
+
salt: string;
|
|
153
|
+
version?: number;
|
|
154
|
+
}
|
|
155
|
+
export interface KeyBackupResponse {
|
|
156
|
+
encrypted_data: string;
|
|
157
|
+
nonce: string;
|
|
158
|
+
salt: string;
|
|
159
|
+
version: number;
|
|
160
|
+
updated_at: string;
|
|
161
|
+
}
|
|
162
|
+
export interface KeyBackupStatusResponse {
|
|
163
|
+
has_backup: boolean;
|
|
164
|
+
version: number | null;
|
|
165
|
+
updated_at: string | null;
|
|
166
|
+
}
|
|
167
|
+
export interface CreateServerRequest {
|
|
168
|
+
encrypted_meta: string;
|
|
169
|
+
}
|
|
170
|
+
export interface ServerResponse {
|
|
171
|
+
id: string;
|
|
172
|
+
encrypted_meta: string;
|
|
173
|
+
owner_id: string;
|
|
174
|
+
created_at: string;
|
|
175
|
+
my_permissions?: string;
|
|
176
|
+
system_channel_id?: string;
|
|
177
|
+
icon_url?: string;
|
|
178
|
+
}
|
|
179
|
+
export interface CreateChannelRequest {
|
|
180
|
+
encrypted_meta: string;
|
|
181
|
+
channel_type?: string;
|
|
182
|
+
position?: number;
|
|
183
|
+
category_id?: string | null;
|
|
184
|
+
is_private?: boolean;
|
|
185
|
+
encrypted?: boolean;
|
|
186
|
+
}
|
|
187
|
+
export interface ChannelResponse {
|
|
188
|
+
id: string;
|
|
189
|
+
server_id: string | null;
|
|
190
|
+
encrypted_meta: string;
|
|
191
|
+
channel_type: string;
|
|
192
|
+
position: number;
|
|
193
|
+
created_at: string;
|
|
194
|
+
category_id: string | null;
|
|
195
|
+
dm_status?: string;
|
|
196
|
+
last_message_id?: string;
|
|
197
|
+
is_private: boolean;
|
|
198
|
+
encrypted: boolean;
|
|
199
|
+
export_allowed: boolean;
|
|
200
|
+
}
|
|
201
|
+
export interface CategoryResponse {
|
|
202
|
+
id: string;
|
|
203
|
+
server_id: string;
|
|
204
|
+
name: string;
|
|
205
|
+
position: number;
|
|
206
|
+
created_at: string;
|
|
207
|
+
}
|
|
208
|
+
export interface CreateCategoryRequest {
|
|
209
|
+
name: string;
|
|
210
|
+
position?: number;
|
|
211
|
+
}
|
|
212
|
+
export interface UpdateCategoryRequest {
|
|
213
|
+
name?: string;
|
|
214
|
+
position?: number;
|
|
215
|
+
}
|
|
216
|
+
export interface ReorderCategoriesRequest {
|
|
217
|
+
order: Array<{
|
|
218
|
+
id: string;
|
|
219
|
+
position: number;
|
|
220
|
+
}>;
|
|
221
|
+
}
|
|
222
|
+
export interface SetChannelCategoryRequest {
|
|
223
|
+
category_id: string | null;
|
|
224
|
+
}
|
|
225
|
+
export interface ReorderChannelsRequest {
|
|
226
|
+
order: Array<{
|
|
227
|
+
id: string;
|
|
228
|
+
position: number;
|
|
229
|
+
category_id: string | null;
|
|
230
|
+
}>;
|
|
231
|
+
}
|
|
232
|
+
export interface CreateDmRequest {
|
|
233
|
+
target_user_id: string;
|
|
234
|
+
encrypted_meta: string;
|
|
235
|
+
}
|
|
236
|
+
export interface CreateGroupDmRequest {
|
|
237
|
+
member_ids: string[];
|
|
238
|
+
encrypted_meta: string;
|
|
239
|
+
}
|
|
240
|
+
export interface ChannelMemberInfo {
|
|
241
|
+
user_id: string;
|
|
242
|
+
username: string;
|
|
243
|
+
display_name: string | null;
|
|
244
|
+
avatar_url: string | null;
|
|
245
|
+
joined_at: string;
|
|
246
|
+
}
|
|
247
|
+
export interface SendMessageRequest {
|
|
248
|
+
channel_id: string;
|
|
249
|
+
sender_token: string;
|
|
250
|
+
encrypted_body: string;
|
|
251
|
+
expires_at?: string;
|
|
252
|
+
has_attachments: boolean;
|
|
253
|
+
}
|
|
254
|
+
export interface MessageResponse {
|
|
255
|
+
id: string;
|
|
256
|
+
channel_id: string;
|
|
257
|
+
sender_token: string;
|
|
258
|
+
encrypted_body: string;
|
|
259
|
+
timestamp: string;
|
|
260
|
+
expires_at: string | null;
|
|
261
|
+
has_attachments: boolean;
|
|
262
|
+
edited: boolean;
|
|
263
|
+
reply_to_id: string | null;
|
|
264
|
+
message_type?: string;
|
|
265
|
+
}
|
|
266
|
+
export interface MessageQuery {
|
|
267
|
+
before?: string;
|
|
268
|
+
limit?: number;
|
|
269
|
+
}
|
|
270
|
+
export interface UploadResponse {
|
|
271
|
+
attachment_id: string;
|
|
272
|
+
storage_key: string;
|
|
273
|
+
}
|
|
274
|
+
export interface DistributeSenderKeyRequest {
|
|
275
|
+
distributions: Array<{
|
|
276
|
+
to_user_id: string;
|
|
277
|
+
distribution_id: string;
|
|
278
|
+
encrypted_skdm: string;
|
|
279
|
+
}>;
|
|
280
|
+
}
|
|
281
|
+
export interface SenderKeyDistributionResponse {
|
|
282
|
+
id: string;
|
|
283
|
+
channel_id: string;
|
|
284
|
+
from_user_id: string;
|
|
285
|
+
distribution_id: string;
|
|
286
|
+
encrypted_skdm: string;
|
|
287
|
+
created_at: string;
|
|
288
|
+
}
|
|
289
|
+
export interface ChannelMemberKeyInfo {
|
|
290
|
+
user_id: string;
|
|
291
|
+
identity_key: string;
|
|
292
|
+
}
|
|
293
|
+
export interface ReactionGroup {
|
|
294
|
+
message_id: string;
|
|
295
|
+
emoji: string;
|
|
296
|
+
count: number;
|
|
297
|
+
user_ids: string[];
|
|
298
|
+
}
|
|
299
|
+
export type WsClientMessage = {
|
|
300
|
+
type: "SendMessage";
|
|
301
|
+
payload: {
|
|
302
|
+
channel_id: string;
|
|
303
|
+
sender_token: string;
|
|
304
|
+
encrypted_body: string;
|
|
305
|
+
expires_at?: string;
|
|
306
|
+
attachment_ids?: string[];
|
|
307
|
+
reply_to_id?: string;
|
|
308
|
+
};
|
|
309
|
+
} | {
|
|
310
|
+
type: "EditMessage";
|
|
311
|
+
payload: {
|
|
312
|
+
message_id: string;
|
|
313
|
+
encrypted_body: string;
|
|
314
|
+
};
|
|
315
|
+
} | {
|
|
316
|
+
type: "DeleteMessage";
|
|
317
|
+
payload: {
|
|
318
|
+
message_id: string;
|
|
319
|
+
};
|
|
320
|
+
} | {
|
|
321
|
+
type: "AddReaction";
|
|
322
|
+
payload: {
|
|
323
|
+
message_id: string;
|
|
324
|
+
emoji: string;
|
|
325
|
+
};
|
|
326
|
+
} | {
|
|
327
|
+
type: "RemoveReaction";
|
|
328
|
+
payload: {
|
|
329
|
+
message_id: string;
|
|
330
|
+
emoji: string;
|
|
331
|
+
};
|
|
332
|
+
} | {
|
|
333
|
+
type: "Subscribe";
|
|
334
|
+
payload: {
|
|
335
|
+
channel_id: string;
|
|
336
|
+
};
|
|
337
|
+
} | {
|
|
338
|
+
type: "Unsubscribe";
|
|
339
|
+
payload: {
|
|
340
|
+
channel_id: string;
|
|
341
|
+
};
|
|
342
|
+
} | {
|
|
343
|
+
type: "Typing";
|
|
344
|
+
payload: {
|
|
345
|
+
channel_id: string;
|
|
346
|
+
};
|
|
347
|
+
} | {
|
|
348
|
+
type: "SetStatus";
|
|
349
|
+
payload: {
|
|
350
|
+
status: string;
|
|
351
|
+
};
|
|
352
|
+
} | {
|
|
353
|
+
type: "PinMessage";
|
|
354
|
+
payload: {
|
|
355
|
+
channel_id: string;
|
|
356
|
+
message_id: string;
|
|
357
|
+
};
|
|
358
|
+
} | {
|
|
359
|
+
type: "UnpinMessage";
|
|
360
|
+
payload: {
|
|
361
|
+
channel_id: string;
|
|
362
|
+
message_id: string;
|
|
363
|
+
};
|
|
364
|
+
} | {
|
|
365
|
+
type: "CallInvite";
|
|
366
|
+
payload: {
|
|
367
|
+
channel_id: string;
|
|
368
|
+
};
|
|
369
|
+
} | {
|
|
370
|
+
type: "CallAccept";
|
|
371
|
+
payload: {
|
|
372
|
+
channel_id: string;
|
|
373
|
+
};
|
|
374
|
+
} | {
|
|
375
|
+
type: "CallReject";
|
|
376
|
+
payload: {
|
|
377
|
+
channel_id: string;
|
|
378
|
+
};
|
|
379
|
+
} | {
|
|
380
|
+
type: "CallEnd";
|
|
381
|
+
payload: {
|
|
382
|
+
channel_id: string;
|
|
383
|
+
};
|
|
384
|
+
} | {
|
|
385
|
+
type: "Ping";
|
|
386
|
+
} | {
|
|
387
|
+
type: "MarkRead";
|
|
388
|
+
payload: {
|
|
389
|
+
channel_id: string;
|
|
390
|
+
};
|
|
391
|
+
} | {
|
|
392
|
+
type: "Resume";
|
|
393
|
+
payload: {
|
|
394
|
+
session_id: string;
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
export type WsServerMessage = {
|
|
398
|
+
type: "NewMessage";
|
|
399
|
+
payload: MessageResponse;
|
|
400
|
+
} | {
|
|
401
|
+
type: "MessageEdited";
|
|
402
|
+
payload: {
|
|
403
|
+
message_id: string;
|
|
404
|
+
channel_id: string;
|
|
405
|
+
encrypted_body: string;
|
|
406
|
+
};
|
|
407
|
+
} | {
|
|
408
|
+
type: "UserTyping";
|
|
409
|
+
payload: {
|
|
410
|
+
channel_id: string;
|
|
411
|
+
user_id: string;
|
|
412
|
+
username: string;
|
|
413
|
+
};
|
|
414
|
+
} | {
|
|
415
|
+
type: "MessageAck";
|
|
416
|
+
payload: {
|
|
417
|
+
message_id: string;
|
|
418
|
+
};
|
|
419
|
+
} | {
|
|
420
|
+
type: "Subscribed";
|
|
421
|
+
payload: {
|
|
422
|
+
channel_id: string;
|
|
423
|
+
};
|
|
424
|
+
} | {
|
|
425
|
+
type: "Error";
|
|
426
|
+
payload: {
|
|
427
|
+
message: string;
|
|
428
|
+
};
|
|
429
|
+
} | {
|
|
430
|
+
type: "Pong";
|
|
431
|
+
} | {
|
|
432
|
+
type: "SenderKeysUpdated";
|
|
433
|
+
payload: {
|
|
434
|
+
channel_id: string;
|
|
435
|
+
};
|
|
436
|
+
} | {
|
|
437
|
+
type: "MessageDeleted";
|
|
438
|
+
payload: {
|
|
439
|
+
message_id: string;
|
|
440
|
+
channel_id: string;
|
|
441
|
+
};
|
|
442
|
+
} | {
|
|
443
|
+
type: "ReactionAdded";
|
|
444
|
+
payload: {
|
|
445
|
+
message_id: string;
|
|
446
|
+
channel_id: string;
|
|
447
|
+
sender_token: string;
|
|
448
|
+
emoji: string;
|
|
449
|
+
};
|
|
450
|
+
} | {
|
|
451
|
+
type: "ReactionRemoved";
|
|
452
|
+
payload: {
|
|
453
|
+
message_id: string;
|
|
454
|
+
channel_id: string;
|
|
455
|
+
sender_token: string;
|
|
456
|
+
emoji: string;
|
|
457
|
+
};
|
|
458
|
+
} | {
|
|
459
|
+
type: "PresenceUpdate";
|
|
460
|
+
payload: {
|
|
461
|
+
user_id: string;
|
|
462
|
+
status: string;
|
|
463
|
+
};
|
|
464
|
+
} | {
|
|
465
|
+
type: "FriendRequestReceived";
|
|
466
|
+
payload: {
|
|
467
|
+
from_user_id: string;
|
|
468
|
+
from_username: string;
|
|
469
|
+
friendship_id: string;
|
|
470
|
+
};
|
|
471
|
+
} | {
|
|
472
|
+
type: "FriendRequestAccepted";
|
|
473
|
+
payload: {
|
|
474
|
+
user_id: string;
|
|
475
|
+
username: string;
|
|
476
|
+
friendship_id: string;
|
|
477
|
+
};
|
|
478
|
+
} | {
|
|
479
|
+
type: "FriendRemoved";
|
|
480
|
+
payload: {
|
|
481
|
+
user_id: string;
|
|
482
|
+
};
|
|
483
|
+
} | {
|
|
484
|
+
type: "DmRequestReceived";
|
|
485
|
+
payload: {
|
|
486
|
+
channel_id: string;
|
|
487
|
+
from_user_id: string;
|
|
488
|
+
};
|
|
489
|
+
} | {
|
|
490
|
+
type: "MessagePinned";
|
|
491
|
+
payload: {
|
|
492
|
+
channel_id: string;
|
|
493
|
+
message_id: string;
|
|
494
|
+
pinned_by: string;
|
|
495
|
+
};
|
|
496
|
+
} | {
|
|
497
|
+
type: "MessageUnpinned";
|
|
498
|
+
payload: {
|
|
499
|
+
channel_id: string;
|
|
500
|
+
message_id: string;
|
|
501
|
+
};
|
|
502
|
+
} | {
|
|
503
|
+
type: "VoiceStateUpdate";
|
|
504
|
+
payload: {
|
|
505
|
+
channel_id: string;
|
|
506
|
+
user_id: string;
|
|
507
|
+
username: string;
|
|
508
|
+
joined: boolean;
|
|
509
|
+
};
|
|
510
|
+
} | {
|
|
511
|
+
type: "EmojiCreated";
|
|
512
|
+
payload: {
|
|
513
|
+
server_id: string;
|
|
514
|
+
emoji: CustomEmojiResponse;
|
|
515
|
+
};
|
|
516
|
+
} | {
|
|
517
|
+
type: "EmojiDeleted";
|
|
518
|
+
payload: {
|
|
519
|
+
server_id: string;
|
|
520
|
+
emoji_id: string;
|
|
521
|
+
};
|
|
522
|
+
} | {
|
|
523
|
+
type: "VoiceMuteUpdate";
|
|
524
|
+
payload: {
|
|
525
|
+
channel_id: string;
|
|
526
|
+
user_id: string;
|
|
527
|
+
server_muted: boolean;
|
|
528
|
+
server_deafened: boolean;
|
|
529
|
+
};
|
|
530
|
+
} | {
|
|
531
|
+
type: "CallRinging";
|
|
532
|
+
payload: {
|
|
533
|
+
channel_id: string;
|
|
534
|
+
caller_id: string;
|
|
535
|
+
caller_name: string;
|
|
536
|
+
};
|
|
537
|
+
} | {
|
|
538
|
+
type: "CallAccepted";
|
|
539
|
+
payload: {
|
|
540
|
+
channel_id: string;
|
|
541
|
+
user_id: string;
|
|
542
|
+
};
|
|
543
|
+
} | {
|
|
544
|
+
type: "CallRejected";
|
|
545
|
+
payload: {
|
|
546
|
+
channel_id: string;
|
|
547
|
+
user_id: string;
|
|
548
|
+
};
|
|
549
|
+
} | {
|
|
550
|
+
type: "CallEnded";
|
|
551
|
+
payload: {
|
|
552
|
+
channel_id: string;
|
|
553
|
+
ended_by: string;
|
|
554
|
+
};
|
|
555
|
+
} | {
|
|
556
|
+
type: "BulkMessagesDeleted";
|
|
557
|
+
payload: {
|
|
558
|
+
channel_id: string;
|
|
559
|
+
message_ids: string[];
|
|
560
|
+
};
|
|
561
|
+
} | {
|
|
562
|
+
type: "MemberTimedOut";
|
|
563
|
+
payload: {
|
|
564
|
+
server_id: string;
|
|
565
|
+
user_id: string;
|
|
566
|
+
timed_out_until: string | null;
|
|
567
|
+
};
|
|
568
|
+
} | {
|
|
569
|
+
type: "ReadStateUpdated";
|
|
570
|
+
payload: {
|
|
571
|
+
channel_id: string;
|
|
572
|
+
last_read_at: string;
|
|
573
|
+
};
|
|
574
|
+
} | {
|
|
575
|
+
type: "ServerUpdated";
|
|
576
|
+
payload: {
|
|
577
|
+
server_id: string;
|
|
578
|
+
};
|
|
579
|
+
} | {
|
|
580
|
+
type: "Hello";
|
|
581
|
+
payload: {
|
|
582
|
+
session_id: string;
|
|
583
|
+
heartbeat_interval_ms: number;
|
|
584
|
+
};
|
|
585
|
+
} | {
|
|
586
|
+
type: "Resumed";
|
|
587
|
+
payload: {
|
|
588
|
+
replayed_count: number;
|
|
589
|
+
};
|
|
590
|
+
} | {
|
|
591
|
+
type: "InvalidSession";
|
|
592
|
+
};
|
|
593
|
+
export interface PresenceEntry {
|
|
594
|
+
user_id: string;
|
|
595
|
+
status: string;
|
|
596
|
+
}
|
|
597
|
+
export interface AdminStats {
|
|
598
|
+
total_users: number;
|
|
599
|
+
total_servers: number;
|
|
600
|
+
total_channels: number;
|
|
601
|
+
total_messages: number;
|
|
602
|
+
active_connections: number;
|
|
603
|
+
}
|
|
604
|
+
export interface AdminUserResponse {
|
|
605
|
+
id: string;
|
|
606
|
+
username: string;
|
|
607
|
+
display_name: string | null;
|
|
608
|
+
avatar_url: string | null;
|
|
609
|
+
created_at: string;
|
|
610
|
+
is_instance_admin: boolean;
|
|
611
|
+
server_count: number;
|
|
612
|
+
}
|
|
613
|
+
export interface SetAdminRequest {
|
|
614
|
+
is_admin: boolean;
|
|
615
|
+
}
|
|
616
|
+
export interface CreateInviteRequest {
|
|
617
|
+
max_uses?: number;
|
|
618
|
+
expires_in_hours?: number;
|
|
619
|
+
}
|
|
620
|
+
export interface InviteResponse {
|
|
621
|
+
id: string;
|
|
622
|
+
code: string;
|
|
623
|
+
server_id: string;
|
|
624
|
+
max_uses: number | null;
|
|
625
|
+
use_count: number;
|
|
626
|
+
expires_at: string | null;
|
|
627
|
+
created_at: string;
|
|
628
|
+
}
|
|
629
|
+
export interface ServerMemberResponse {
|
|
630
|
+
user_id: string;
|
|
631
|
+
username: string;
|
|
632
|
+
display_name: string | null;
|
|
633
|
+
avatar_url: string | null;
|
|
634
|
+
joined_at: string;
|
|
635
|
+
nickname?: string | null;
|
|
636
|
+
role_ids: string[];
|
|
637
|
+
timed_out_until?: string | null;
|
|
638
|
+
}
|
|
639
|
+
export declare const Permission: {
|
|
640
|
+
readonly ADMINISTRATOR: bigint;
|
|
641
|
+
readonly MANAGE_SERVER: bigint;
|
|
642
|
+
readonly MANAGE_ROLES: bigint;
|
|
643
|
+
readonly MANAGE_CHANNELS: bigint;
|
|
644
|
+
readonly KICK_MEMBERS: bigint;
|
|
645
|
+
readonly BAN_MEMBERS: bigint;
|
|
646
|
+
readonly MANAGE_MESSAGES: bigint;
|
|
647
|
+
readonly VIEW_CHANNELS: bigint;
|
|
648
|
+
readonly SEND_MESSAGES: bigint;
|
|
649
|
+
readonly CREATE_INVITES: bigint;
|
|
650
|
+
readonly MANAGE_INVITES: bigint;
|
|
651
|
+
readonly ADD_REACTIONS: bigint;
|
|
652
|
+
readonly MENTION_EVERYONE: bigint;
|
|
653
|
+
readonly ATTACH_FILES: bigint;
|
|
654
|
+
readonly READ_MESSAGE_HISTORY: bigint;
|
|
655
|
+
readonly MANAGE_EMOJIS: bigint;
|
|
656
|
+
readonly MUTE_MEMBERS: bigint;
|
|
657
|
+
readonly STREAM: bigint;
|
|
658
|
+
readonly PRIORITY_SPEAKER: bigint;
|
|
659
|
+
readonly USE_VOICE_ACTIVITY: bigint;
|
|
660
|
+
readonly USE_EXTERNAL_EMOJIS: bigint;
|
|
661
|
+
readonly MANAGE_WEBHOOKS: bigint;
|
|
662
|
+
readonly VIEW_AUDIT_LOG: bigint;
|
|
663
|
+
readonly MANAGE_EVENTS: bigint;
|
|
664
|
+
readonly MANAGE_THREADS: bigint;
|
|
665
|
+
readonly MODERATE_MEMBERS: bigint;
|
|
666
|
+
readonly MANAGE_NICKNAMES: bigint;
|
|
667
|
+
};
|
|
668
|
+
export interface RoleResponse {
|
|
669
|
+
id: string;
|
|
670
|
+
server_id: string;
|
|
671
|
+
name: string;
|
|
672
|
+
color: string | null;
|
|
673
|
+
permissions: string;
|
|
674
|
+
position: number;
|
|
675
|
+
is_default: boolean;
|
|
676
|
+
created_at: string;
|
|
677
|
+
}
|
|
678
|
+
export interface CreateRoleRequest {
|
|
679
|
+
name: string;
|
|
680
|
+
color?: string;
|
|
681
|
+
permissions?: string;
|
|
682
|
+
position?: number;
|
|
683
|
+
}
|
|
684
|
+
export interface UpdateRoleRequest {
|
|
685
|
+
name?: string;
|
|
686
|
+
color?: string;
|
|
687
|
+
permissions?: string;
|
|
688
|
+
position?: number;
|
|
689
|
+
}
|
|
690
|
+
export interface AssignRoleRequest {
|
|
691
|
+
role_id: string;
|
|
692
|
+
}
|
|
693
|
+
export interface OverwriteResponse {
|
|
694
|
+
id: string;
|
|
695
|
+
channel_id: string;
|
|
696
|
+
target_type: string;
|
|
697
|
+
target_id: string;
|
|
698
|
+
allow_bits: string;
|
|
699
|
+
deny_bits: string;
|
|
700
|
+
}
|
|
701
|
+
export interface SetOverwriteRequest {
|
|
702
|
+
target_type: string;
|
|
703
|
+
target_id: string;
|
|
704
|
+
allow_bits: string;
|
|
705
|
+
deny_bits: string;
|
|
706
|
+
}
|
|
707
|
+
export interface CustomEmojiResponse {
|
|
708
|
+
id: string;
|
|
709
|
+
server_id: string;
|
|
710
|
+
name: string;
|
|
711
|
+
uploaded_by: string | null;
|
|
712
|
+
animated: boolean;
|
|
713
|
+
image_url: string;
|
|
714
|
+
created_at: string;
|
|
715
|
+
}
|
|
716
|
+
export interface DeleteAccountRequest {
|
|
717
|
+
password: string;
|
|
718
|
+
}
|
|
719
|
+
export interface BanResponse {
|
|
720
|
+
id: string;
|
|
721
|
+
user_id: string;
|
|
722
|
+
username: string;
|
|
723
|
+
reason: string | null;
|
|
724
|
+
banned_by: string;
|
|
725
|
+
created_at: string;
|
|
726
|
+
}
|
|
727
|
+
export interface CreateBanRequest {
|
|
728
|
+
reason?: string;
|
|
729
|
+
}
|
|
730
|
+
export interface AddGroupMemberRequest {
|
|
731
|
+
user_id: string;
|
|
732
|
+
}
|
|
733
|
+
export interface FriendResponse {
|
|
734
|
+
id: string;
|
|
735
|
+
user_id: string;
|
|
736
|
+
username: string;
|
|
737
|
+
display_name: string | null;
|
|
738
|
+
avatar_url: string | null;
|
|
739
|
+
status: string;
|
|
740
|
+
is_incoming: boolean;
|
|
741
|
+
created_at: string;
|
|
742
|
+
}
|
|
743
|
+
export interface FriendRequestBody {
|
|
744
|
+
username: string;
|
|
745
|
+
}
|
|
746
|
+
export interface DmRequestAction {
|
|
747
|
+
action: string;
|
|
748
|
+
}
|
|
749
|
+
export interface UpdateDmPrivacyRequest {
|
|
750
|
+
dm_privacy: string;
|
|
751
|
+
}
|
|
752
|
+
export interface CreateReportRequest {
|
|
753
|
+
message_id: string;
|
|
754
|
+
channel_id: string;
|
|
755
|
+
reason: string;
|
|
756
|
+
}
|
|
757
|
+
export interface ReportResponse {
|
|
758
|
+
id: string;
|
|
759
|
+
message_id: string;
|
|
760
|
+
reason: string;
|
|
761
|
+
status: string;
|
|
762
|
+
created_at: string;
|
|
763
|
+
}
|
|
764
|
+
export interface VoiceTokenResponse {
|
|
765
|
+
token: string;
|
|
766
|
+
url: string;
|
|
767
|
+
channel_id: string;
|
|
768
|
+
}
|
|
769
|
+
export interface VoiceParticipant {
|
|
770
|
+
user_id: string;
|
|
771
|
+
username: string;
|
|
772
|
+
display_name: string | null;
|
|
773
|
+
avatar_url: string | null;
|
|
774
|
+
server_muted: boolean;
|
|
775
|
+
server_deafened: boolean;
|
|
776
|
+
}
|
|
777
|
+
export interface ReadStateResponse {
|
|
778
|
+
user_id: string;
|
|
779
|
+
channel_id: string;
|
|
780
|
+
last_read_at: string;
|
|
781
|
+
}
|
|
782
|
+
export interface ChannelUnreadInfo {
|
|
783
|
+
channel_id: string;
|
|
784
|
+
last_message_id: string | null;
|
|
785
|
+
last_message_at: string | null;
|
|
786
|
+
unread_count: number;
|
|
787
|
+
}
|
|
788
|
+
export interface AuditLogEntry {
|
|
789
|
+
id: string;
|
|
790
|
+
actor_id: string;
|
|
791
|
+
actor_username: string;
|
|
792
|
+
action: string;
|
|
793
|
+
target_type: string | null;
|
|
794
|
+
target_id: string | null;
|
|
795
|
+
changes: Record<string, unknown> | null;
|
|
796
|
+
reason: string | null;
|
|
797
|
+
created_at: string;
|
|
798
|
+
}
|
|
799
|
+
export interface TimeoutMemberRequest {
|
|
800
|
+
duration_seconds: number;
|
|
801
|
+
reason?: string;
|
|
802
|
+
}
|
|
803
|
+
export interface BulkDeleteRequest {
|
|
804
|
+
message_ids: string[];
|
|
805
|
+
}
|
|
806
|
+
export interface InviteRequiredResponse {
|
|
807
|
+
invite_required: boolean;
|
|
808
|
+
}
|
|
809
|
+
export interface RegistrationInviteResponse {
|
|
810
|
+
id: string;
|
|
811
|
+
code: string;
|
|
812
|
+
created_by: string | null;
|
|
813
|
+
used: boolean;
|
|
814
|
+
used_by: string | null;
|
|
815
|
+
expires_at: string | null;
|
|
816
|
+
created_at: string;
|
|
817
|
+
}
|
|
818
|
+
export interface GifResult {
|
|
819
|
+
id: string;
|
|
820
|
+
title: string;
|
|
821
|
+
url: string;
|
|
822
|
+
preview_url: string;
|
|
823
|
+
width: number;
|
|
824
|
+
height: number;
|
|
825
|
+
}
|
|
826
|
+
export interface GifSearchResponse {
|
|
827
|
+
results: GifResult[];
|
|
828
|
+
total_count: number;
|
|
829
|
+
}
|
|
830
|
+
export interface RestoreServerResponse {
|
|
831
|
+
categories_created: number;
|
|
832
|
+
channels_created: number;
|
|
833
|
+
roles_created: number;
|
|
834
|
+
roles_updated: number;
|
|
835
|
+
overwrites_applied: number;
|
|
836
|
+
channel_id_map: Record<string, string>;
|
|
837
|
+
}
|
|
838
|
+
export interface ImportMessage {
|
|
839
|
+
sender_token: string;
|
|
840
|
+
encrypted_body: string;
|
|
841
|
+
timestamp: string;
|
|
842
|
+
sender_id: string | null;
|
|
843
|
+
message_type: string;
|
|
844
|
+
reply_to_id: string | null;
|
|
845
|
+
has_attachments: boolean;
|
|
846
|
+
}
|
|
847
|
+
export interface ApiError {
|
|
848
|
+
error: string;
|
|
849
|
+
status: number;
|
|
850
|
+
}
|