@vex-chat/libvex 0.27.1 → 1.0.0-rc.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/Client.d.ts +34 -40
- package/dist/Client.js +1343 -1473
- package/dist/Client.js.map +1 -1
- package/dist/IStorage.d.ts +9 -10
- package/dist/IStorage.js +1 -2
- package/dist/IStorage.js.map +1 -1
- package/dist/Storage.d.ts +11 -12
- package/dist/Storage.js +393 -447
- package/dist/Storage.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/utils/capitalize.js +1 -4
- package/dist/utils/capitalize.js.map +1 -1
- package/dist/utils/constants.js +2 -5
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/createLogger.js +8 -15
- package/dist/utils/createLogger.js.map +1 -1
- package/dist/utils/formatBytes.js +1 -4
- package/dist/utils/formatBytes.js.map +1 -1
- package/dist/utils/sqlSessionToCrypto.d.ts +2 -2
- package/dist/utils/sqlSessionToCrypto.js +5 -9
- package/dist/utils/sqlSessionToCrypto.js.map +1 -1
- package/dist/utils/uint8uuid.d.ts +2 -2
- package/dist/utils/uint8uuid.js +5 -10
- package/dist/utils/uint8uuid.js.map +1 -1
- package/package.json +42 -43
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/RELEASING.md +0 -95
- package/dist/__tests__/Client.d.ts +0 -1
- package/dist/__tests__/Client.js +0 -271
- package/dist/__tests__/Client.js.map +0 -1
- package/jest.config.js +0 -18
- package/mise.toml +0 -3
package/dist/Client.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { XTypes } from "@vex-chat/types";
|
|
1
|
+
import type { IChannel, IDevice, IEmoji, IFileResponse, IFileSQL, IInvite, IPermission, IServer, ISessionSQL } from "@vex-chat/types";
|
|
3
2
|
import { AxiosError } from "axios";
|
|
4
3
|
import { EventEmitter } from "events";
|
|
5
|
-
import { IStorage } from "./IStorage";
|
|
4
|
+
import type { IStorage } from "./IStorage.js";
|
|
6
5
|
interface ICensoredUser {
|
|
7
6
|
lastSeen: number;
|
|
8
7
|
userID: string;
|
|
@@ -28,8 +27,7 @@ export interface IMessage {
|
|
|
28
27
|
/**
|
|
29
28
|
* IPermission is a permission to a resource.
|
|
30
29
|
*/
|
|
31
|
-
export
|
|
32
|
-
}
|
|
30
|
+
export type { IPermission } from "@vex-chat/types";
|
|
33
31
|
/**
|
|
34
32
|
* IKeys are a pair of ed25519 public and private keys,
|
|
35
33
|
* encoded as hex strings.
|
|
@@ -38,8 +36,7 @@ export interface IKeys {
|
|
|
38
36
|
public: string;
|
|
39
37
|
private: string;
|
|
40
38
|
}
|
|
41
|
-
export
|
|
42
|
-
}
|
|
39
|
+
export type { IDevice } from "@vex-chat/types";
|
|
43
40
|
/**
|
|
44
41
|
* IUser is a single user on the vex platform.
|
|
45
42
|
*/
|
|
@@ -48,34 +45,32 @@ export interface IUser extends ICensoredUser {
|
|
|
48
45
|
/**
|
|
49
46
|
* ISession is an end to end encryption session with another peer.
|
|
50
47
|
*/
|
|
51
|
-
export interface ISession extends
|
|
48
|
+
export interface ISession extends ISessionSQL {
|
|
52
49
|
}
|
|
53
50
|
/**
|
|
54
51
|
* IChannel is a chat channel on a server.
|
|
55
52
|
*/
|
|
56
|
-
export
|
|
57
|
-
}
|
|
53
|
+
export type { IChannel } from "@vex-chat/types";
|
|
58
54
|
/**
|
|
59
55
|
* IServer is a single chat server.
|
|
60
56
|
*/
|
|
61
|
-
export
|
|
62
|
-
}
|
|
57
|
+
export type { IServer } from "@vex-chat/types";
|
|
63
58
|
/**
|
|
64
59
|
* Ifile is an uploaded encrypted file.
|
|
65
60
|
*/
|
|
66
|
-
export interface IFile extends
|
|
61
|
+
export interface IFile extends IFileSQL {
|
|
67
62
|
}
|
|
68
63
|
/**
|
|
69
64
|
* IFileRes is a server response to a file retrieval request.
|
|
70
65
|
*/
|
|
71
|
-
export interface IFileRes extends
|
|
66
|
+
export interface IFileRes extends IFileResponse {
|
|
72
67
|
}
|
|
73
68
|
/**
|
|
74
69
|
* @ignore
|
|
75
70
|
*/
|
|
76
71
|
interface IMe {
|
|
77
72
|
user: () => ICensoredUser;
|
|
78
|
-
device: () =>
|
|
73
|
+
device: () => IDevice;
|
|
79
74
|
setAvatar: (avatar: Buffer) => Promise<void>;
|
|
80
75
|
}
|
|
81
76
|
/**
|
|
@@ -100,9 +95,9 @@ interface IMessages {
|
|
|
100
95
|
* @ignore
|
|
101
96
|
*/
|
|
102
97
|
interface IServers {
|
|
103
|
-
retrieve: () => Promise<
|
|
104
|
-
retrieveByID: (serverID: string) => Promise<
|
|
105
|
-
create: (name: string) => Promise<
|
|
98
|
+
retrieve: () => Promise<IServer[]>;
|
|
99
|
+
retrieveByID: (serverID: string) => Promise<IServer | null>;
|
|
100
|
+
create: (name: string) => Promise<IServer>;
|
|
106
101
|
delete: (serverID: string) => Promise<void>;
|
|
107
102
|
leave: (serverID: string) => Promise<void>;
|
|
108
103
|
}
|
|
@@ -111,30 +106,30 @@ interface IServers {
|
|
|
111
106
|
*/
|
|
112
107
|
interface IModeration {
|
|
113
108
|
kick: (userID: string, serverID: string) => Promise<void>;
|
|
114
|
-
fetchPermissionList: (serverID: string) => Promise<
|
|
109
|
+
fetchPermissionList: (serverID: string) => Promise<IPermission[]>;
|
|
115
110
|
}
|
|
116
111
|
/**
|
|
117
112
|
* @ignore
|
|
118
113
|
*/
|
|
119
114
|
interface IPermissions {
|
|
120
|
-
retrieve: () => Promise<
|
|
115
|
+
retrieve: () => Promise<IPermission[]>;
|
|
121
116
|
delete: (permissionID: string) => Promise<void>;
|
|
122
117
|
}
|
|
123
118
|
/**
|
|
124
119
|
* @ignore
|
|
125
120
|
*/
|
|
126
121
|
interface IInvites {
|
|
127
|
-
redeem: (inviteID: string) => Promise<
|
|
128
|
-
create: (serverID: string, duration: string) => Promise<
|
|
129
|
-
retrieve: (serverID: string) => Promise<
|
|
122
|
+
redeem: (inviteID: string) => Promise<IPermission>;
|
|
123
|
+
create: (serverID: string, duration: string) => Promise<IInvite>;
|
|
124
|
+
retrieve: (serverID: string) => Promise<IInvite[]>;
|
|
130
125
|
}
|
|
131
126
|
/**
|
|
132
127
|
* @ignore
|
|
133
128
|
*/
|
|
134
129
|
interface IChannels {
|
|
135
|
-
retrieve: (serverID: string) => Promise<
|
|
136
|
-
retrieveByID: (channelID: string) => Promise<
|
|
137
|
-
create: (name: string, serverID: string) => Promise<
|
|
130
|
+
retrieve: (serverID: string) => Promise<IChannel[]>;
|
|
131
|
+
retrieveByID: (channelID: string) => Promise<IChannel | null>;
|
|
132
|
+
create: (name: string, serverID: string) => Promise<IChannel>;
|
|
138
133
|
delete: (channelID: string) => Promise<void>;
|
|
139
134
|
userList: (channelID: string) => Promise<IUser[]>;
|
|
140
135
|
}
|
|
@@ -142,32 +137,32 @@ interface IChannels {
|
|
|
142
137
|
* @ignore
|
|
143
138
|
*/
|
|
144
139
|
interface ISessions {
|
|
145
|
-
retrieve: () => Promise<
|
|
146
|
-
verify: (session:
|
|
140
|
+
retrieve: () => Promise<ISessionSQL[]>;
|
|
141
|
+
verify: (session: ISessionSQL) => string;
|
|
147
142
|
markVerified: (fingerprint: string) => Promise<void>;
|
|
148
143
|
}
|
|
149
144
|
/**
|
|
150
145
|
* @ignore
|
|
151
146
|
*/
|
|
152
147
|
interface IDevices {
|
|
153
|
-
retrieve: (deviceIdentifier: string) => Promise<
|
|
154
|
-
register: () => Promise<
|
|
148
|
+
retrieve: (deviceIdentifier: string) => Promise<IDevice | null>;
|
|
149
|
+
register: () => Promise<IDevice | null>;
|
|
155
150
|
delete: (deviceID: string) => Promise<void>;
|
|
156
151
|
}
|
|
157
152
|
/**
|
|
158
153
|
* @ignore
|
|
159
154
|
*/
|
|
160
155
|
interface IFiles {
|
|
161
|
-
create: (file: Buffer) => Promise<[
|
|
162
|
-
retrieve: (fileID: string, key: string) => Promise<
|
|
156
|
+
create: (file: Buffer) => Promise<[IFileSQL, string]>;
|
|
157
|
+
retrieve: (fileID: string, key: string) => Promise<IFileResponse | null>;
|
|
163
158
|
}
|
|
164
159
|
/**
|
|
165
160
|
* @ignore
|
|
166
161
|
*/
|
|
167
|
-
interface
|
|
168
|
-
create: (emoji: Buffer, name: string, serverID: string) => Promise<
|
|
169
|
-
retrieveList: (serverID: string) => Promise<
|
|
170
|
-
retrieve: (emojiID: string) => Promise<
|
|
162
|
+
interface IEmojis {
|
|
163
|
+
create: (emoji: Buffer, name: string, serverID: string) => Promise<IEmoji | null>;
|
|
164
|
+
retrieveList: (serverID: string) => Promise<IEmoji[]>;
|
|
165
|
+
retrieve: (emojiID: string) => Promise<IEmoji | null>;
|
|
171
166
|
}
|
|
172
167
|
export interface IFileProgress {
|
|
173
168
|
token: string;
|
|
@@ -359,8 +354,8 @@ export declare interface Client {
|
|
|
359
354
|
*/
|
|
360
355
|
export declare class Client extends EventEmitter {
|
|
361
356
|
static loadKeyFile: (path: string, password: string) => string;
|
|
362
|
-
static saveKeyFile: (path: string, password: string, keyToSave: string, iterationOverride?: number
|
|
363
|
-
static create: (privateKey?: string
|
|
357
|
+
static saveKeyFile: (path: string, password: string, keyToSave: string, iterationOverride?: number) => void;
|
|
358
|
+
static create: (privateKey?: string, options?: IClientOptions, storage?: IStorage) => Promise<Client>;
|
|
364
359
|
/**
|
|
365
360
|
* Generates an ed25519 secret key as a hex string.
|
|
366
361
|
*
|
|
@@ -379,7 +374,7 @@ export declare class Client extends EventEmitter {
|
|
|
379
374
|
* The IUsers interface contains methods for dealing with users.
|
|
380
375
|
*/
|
|
381
376
|
users: IUsers;
|
|
382
|
-
emoji:
|
|
377
|
+
emoji: IEmojis;
|
|
383
378
|
me: IMe;
|
|
384
379
|
devices: IDevices;
|
|
385
380
|
/**
|
|
@@ -561,4 +556,3 @@ export declare class Client extends EventEmitter {
|
|
|
561
556
|
private ping;
|
|
562
557
|
private censorPreKey;
|
|
563
558
|
}
|
|
564
|
-
export {};
|