@session-foundation/libsession-wasm 0.0.5 → 0.0.7
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/build/index.d.ts +5 -0
- package/build/index.js +3 -0
- package/build/libsession-wasm-fixed.d.ts +615 -0
- package/package.json +8 -5
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
// TypeScript bindings for emscripten-generated code. Automatically generated at compile time.
|
|
2
|
+
interface WasmModule {
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export interface ClassHandle {
|
|
7
|
+
isAliasOf(other: ClassHandle): boolean;
|
|
8
|
+
delete(): void;
|
|
9
|
+
deleteLater(): this;
|
|
10
|
+
isDeleted(): boolean;
|
|
11
|
+
// @ts-ignore - If targeting lower than ESNext, this symbol might not exist.
|
|
12
|
+
[Symbol.dispose](): void;
|
|
13
|
+
clone(): this;
|
|
14
|
+
}
|
|
15
|
+
export interface ConfigBase extends ClassHandle {
|
|
16
|
+
storageNamespace(): Namespace;
|
|
17
|
+
activeHashes(): StringVector;
|
|
18
|
+
makePushHex(): StringVector;
|
|
19
|
+
mergeHex(merges: MergeStructVector): StringVector;
|
|
20
|
+
needsPush(): boolean;
|
|
21
|
+
needsDump(): boolean;
|
|
22
|
+
confirmPushed(seqno: number, hashes: StringVector): void;
|
|
23
|
+
pushHex(): WPushResultStruct;
|
|
24
|
+
encryptionDomain(): string;
|
|
25
|
+
dumpHex(): string;
|
|
26
|
+
makeDumpHex(): string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface UserProfile extends ConfigBase {
|
|
30
|
+
getNtsPriority(): number;
|
|
31
|
+
setNtsPriority(priority: number): void;
|
|
32
|
+
getProfilePic(): ProfilePic;
|
|
33
|
+
setProfilePic(pic: ProfilePic): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface UserProfileW extends UserProfile {
|
|
37
|
+
setBlindedMsgRequests(enabled: boolean): void;
|
|
38
|
+
getBlindedMsgRequests(): boolean;
|
|
39
|
+
getNtsExpirySeconds(): number;
|
|
40
|
+
setNtsExpirySeconds(seconds: number): void;
|
|
41
|
+
setName(name: string): void;
|
|
42
|
+
setNameTruncated(name: string): void;
|
|
43
|
+
getName(): string | undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface ContactInfo extends ClassHandle {
|
|
47
|
+
notifications: NotificationMode;
|
|
48
|
+
expirationMode: ExpirationMode;
|
|
49
|
+
approved: boolean;
|
|
50
|
+
approvedMe: boolean;
|
|
51
|
+
blocked: boolean;
|
|
52
|
+
priority: number;
|
|
53
|
+
expireTimerSeconds: number;
|
|
54
|
+
createdAtSeconds: number;
|
|
55
|
+
get sessionId(): string;
|
|
56
|
+
set sessionId(value: string);
|
|
57
|
+
get name(): string;
|
|
58
|
+
set name(name: string);
|
|
59
|
+
get nickname(): string;
|
|
60
|
+
set nickname(value: string);
|
|
61
|
+
profilePicture: ProfilePic;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface Contacts extends ConfigBase {
|
|
65
|
+
set(contact: ContactInfo): void;
|
|
66
|
+
empty(): boolean;
|
|
67
|
+
size(): number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface ContactsW extends Contacts {
|
|
71
|
+
all(): ContactInfoVector;
|
|
72
|
+
getOrConstruct(sessionId: string): ContactInfo;
|
|
73
|
+
get(sessionId: string): ContactInfo | undefined;
|
|
74
|
+
setName(sessionId: string, name: string): void;
|
|
75
|
+
setNickname(sessionId: string, nickname: string): void;
|
|
76
|
+
setApproved(sessionId: string, approved: boolean): void;
|
|
77
|
+
setApprovedMe(sessionId: string, approvedMe: boolean): void;
|
|
78
|
+
setBlocked(sessionId: string, blocked: boolean): void;
|
|
79
|
+
setPriority(sessionId: string, priority: number): void;
|
|
80
|
+
setNotifications(sessionId: string, mode: NotificationMode): void;
|
|
81
|
+
setExpirySeconds(sessionId: string, mode: ExpirationMode, seconds: number): void;
|
|
82
|
+
setCreatedAtSeconds(sessionId: string, createdAtSeconds: number): void;
|
|
83
|
+
erase(sessionId: string): boolean;
|
|
84
|
+
setProfilePic(sessionId: string, profilePic: ProfilePic): void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface BaseGroupInfo extends ClassHandle {
|
|
88
|
+
notifications: NotificationMode;
|
|
89
|
+
invitePending: boolean;
|
|
90
|
+
priority: number;
|
|
91
|
+
joinedAtSeconds: bigint;
|
|
92
|
+
get name(): string;
|
|
93
|
+
set name(name: string);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface LegacyGroupInfo extends BaseGroupInfo {
|
|
97
|
+
expiryTimerSeconds: number;
|
|
98
|
+
get groupPk(): string;
|
|
99
|
+
set groupPk(value: string);
|
|
100
|
+
get encPubkeyHex(): string;
|
|
101
|
+
set encPubkeyHex(value: string);
|
|
102
|
+
get encSeckeyHex(): string;
|
|
103
|
+
set encSeckeyHex(value: string);
|
|
104
|
+
members(): StringVector;
|
|
105
|
+
admins(): StringVector;
|
|
106
|
+
insert(sessionId: string, isAdmin: boolean): boolean;
|
|
107
|
+
erase(sessionId: string): boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface GroupInfo extends BaseGroupInfo {
|
|
111
|
+
removedStatus: number;
|
|
112
|
+
get groupPk(): string;
|
|
113
|
+
set groupPk(value: string);
|
|
114
|
+
get adminSecretKey(): string;
|
|
115
|
+
set adminSecretKey(value: string);
|
|
116
|
+
get authData(): string;
|
|
117
|
+
set authData(value: string);
|
|
118
|
+
kicked(): boolean;
|
|
119
|
+
destroyed(): boolean;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface CommunityInfo extends ClassHandle {
|
|
123
|
+
notifications: NotificationMode;
|
|
124
|
+
invitePending: boolean;
|
|
125
|
+
priority: number;
|
|
126
|
+
joinedAtSeconds: bigint;
|
|
127
|
+
get name(): string;
|
|
128
|
+
set name(name: string);
|
|
129
|
+
baseUrl(): string;
|
|
130
|
+
pubkeyHex(): string;
|
|
131
|
+
fullUrl(): string;
|
|
132
|
+
room(): string;
|
|
133
|
+
normalisedRoom(): string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface UserGroups extends ConfigBase {
|
|
137
|
+
createGroup(): GroupInfo;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface UserGroupsW extends UserGroups {
|
|
141
|
+
allLegacyGroups(): LegacyGroupInfoVector;
|
|
142
|
+
allGroups(): GroupInfoVector;
|
|
143
|
+
allCommunities(): CommunityInfoVector;
|
|
144
|
+
setLegacyGroup(group: LegacyGroupInfo): void;
|
|
145
|
+
setGroup(group: GroupInfo): void;
|
|
146
|
+
setCommunity(community: CommunityInfo): void;
|
|
147
|
+
getLegacyGroup(groupId: string): LegacyGroupInfo | undefined;
|
|
148
|
+
getOrConstructLegacyGroup(groupId: string): LegacyGroupInfo;
|
|
149
|
+
eraseLegacyGroup(groupId: string): void;
|
|
150
|
+
getGroup(groupId: string): GroupInfo | undefined;
|
|
151
|
+
getOrConstructGroup(groupId: string): GroupInfo;
|
|
152
|
+
markGroupKicked(groupId: string): void;
|
|
153
|
+
markGroupInvited(groupId: string): void;
|
|
154
|
+
markGroupDestroyed(groupId: string): void;
|
|
155
|
+
eraseGroup(groupId: string): void;
|
|
156
|
+
getOrConstructCommunity(fullUrl: string): CommunityInfo;
|
|
157
|
+
eraseCommunity(baseUrl: string, room: string): void;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface BaseConvoVolatile extends ClassHandle {
|
|
161
|
+
forcedUnread: boolean;
|
|
162
|
+
lastReadMs: bigint;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface ConvoVolatile1to1 extends BaseConvoVolatile {
|
|
166
|
+
get sessionId(): string;
|
|
167
|
+
set sessionId(value: string);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface ConvoVolatileLegacyGroup extends BaseConvoVolatile {
|
|
171
|
+
get sessionId(): string;
|
|
172
|
+
set sessionId(value: string);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface ConvoVolatileGroup extends BaseConvoVolatile {
|
|
176
|
+
get sessionId(): string;
|
|
177
|
+
set sessionId(value: string);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface ConvoVolatileCommunity extends ClassHandle {
|
|
181
|
+
readonly forcedUnread: boolean;
|
|
182
|
+
readonly lastReadMs: bigint;
|
|
183
|
+
baseUrl(): string;
|
|
184
|
+
pubkeyHex(): string;
|
|
185
|
+
fullUrl(): string;
|
|
186
|
+
room(): string;
|
|
187
|
+
normalisedRoom(): string;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface ConvoInfoVolatile extends ConfigBase {
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface ConvoInfoVolatileW extends ConvoInfoVolatile {
|
|
194
|
+
getAll1o1s(): VectorOfConvoVolatile1o1;
|
|
195
|
+
getAllLegacyGroups(): VectorOfConvoVolatileLegacyGroup;
|
|
196
|
+
getAllGroups(): VectorOfConvoVolatileGroup;
|
|
197
|
+
getAllCommunities(): VectorOfConvoVolatileCommunity;
|
|
198
|
+
get1o1(sessionId: string): ConvoVolatile1to1 | undefined;
|
|
199
|
+
set1o1(sessionId: string, lastRead: bigint, unread: boolean): void;
|
|
200
|
+
erase1o1(sessionId: string): boolean;
|
|
201
|
+
getGroup(groupId: string): ConvoVolatileGroup | undefined;
|
|
202
|
+
setGroup(groupId: string, lastRead: bigint, unread: boolean): void;
|
|
203
|
+
eraseGroup(groupId: string): boolean;
|
|
204
|
+
getLegacyGroup(groupId: string): ConvoVolatileLegacyGroup | undefined;
|
|
205
|
+
setLegacyGroup(groupId: string, lastRead: bigint, unread: boolean): void;
|
|
206
|
+
eraseLegacyGroup(groupId: string): boolean;
|
|
207
|
+
getCommunity(fullUrl: string): ConvoVolatileCommunity | undefined;
|
|
208
|
+
setCommunityByFullUrl(fullUrl: string, lastRead: bigint, unread: boolean): void;
|
|
209
|
+
eraseCommunityByFullUrl(fullUrl: string): boolean;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface CommunityMessageToDecrypt extends ClassHandle {
|
|
213
|
+
serverId: number;
|
|
214
|
+
contentOrEnvelope: Uint8Array;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface CommunityDecryptOptions extends ClassHandle {
|
|
218
|
+
nowMs: bigint;
|
|
219
|
+
get proBackendPubkeyHex(): string;
|
|
220
|
+
set proBackendPubkeyHex(value: string);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface MultiEncryptW extends ClassHandle {
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface MetaGroupW extends ClassHandle {
|
|
227
|
+
infosStorageNamespace(): Namespace;
|
|
228
|
+
membersStorageNamespace(): Namespace;
|
|
229
|
+
keysStorageNamespace(): Namespace;
|
|
230
|
+
membersAll(): MemberInGroupVector;
|
|
231
|
+
activeHashes(): StringVector;
|
|
232
|
+
encryptMessagesHex(messages: StringVector): StringVector;
|
|
233
|
+
decryptMessages(messages: VectorOfEncryptedGroupMessage): VectorOfDecryptedGroupMessage;
|
|
234
|
+
destroyGroup(): void;
|
|
235
|
+
membersSet(member: Member): void;
|
|
236
|
+
needsPush(): boolean;
|
|
237
|
+
needsDump(): boolean;
|
|
238
|
+
isDestroyed(): boolean;
|
|
239
|
+
admin(): boolean;
|
|
240
|
+
merge(infoMerges: MergeStructVector, membersMerges: MergeStructVector, keysMerges: MergeStructGroupKeysVector): number;
|
|
241
|
+
setExpiryTimerSeconds(seconds: number): void;
|
|
242
|
+
getExpiryTimerSeconds(): number;
|
|
243
|
+
setCreatedAtSeconds(seconds: number): void;
|
|
244
|
+
getCreatedAtSeconds(): number;
|
|
245
|
+
setDeleteBeforeSeconds(seconds: number): void;
|
|
246
|
+
getDeleteBeforeSeconds(): number;
|
|
247
|
+
setDeleteAttachBeforeSeconds(seconds: number): void;
|
|
248
|
+
getDeleteAttachBeforeSeconds(): number;
|
|
249
|
+
membersLength(): number;
|
|
250
|
+
keysCount(): number;
|
|
251
|
+
keysCurrentGeneration(): number;
|
|
252
|
+
makeDumpHex(): string;
|
|
253
|
+
makeInfoDumpHex(): string;
|
|
254
|
+
makeMembersDumpHex(): string;
|
|
255
|
+
makeKeysDumpHex(): string;
|
|
256
|
+
setName(name: string): void;
|
|
257
|
+
setNameTruncated(name: string): void;
|
|
258
|
+
setDescription(description: string): void;
|
|
259
|
+
setDescriptionTruncated(description: string): void;
|
|
260
|
+
membersGetOrConstruct(sessionId: string): Member;
|
|
261
|
+
membersGet(sessionId: string): Member | undefined;
|
|
262
|
+
membersErase(sessionId: string): boolean;
|
|
263
|
+
memberGetStatus(sessionId: string): GroupMemberStatus | undefined;
|
|
264
|
+
loadAdminKey(secretKey: string): void;
|
|
265
|
+
rekeyHex(): string;
|
|
266
|
+
keysSupplementHex(keys: StringVector): string;
|
|
267
|
+
loadKeyMessageHex(messageHash: string, messageData: string, timestampMs: number): boolean;
|
|
268
|
+
makeSubaccountHex(sessionId: string, write: boolean, del: boolean): string;
|
|
269
|
+
verifySubaccountHex(signature: string, write: boolean, del: boolean): boolean;
|
|
270
|
+
subaccountTokenHex(sessionId: string, write: boolean, del: boolean): string;
|
|
271
|
+
loadKeyMessageHex(messageHash: string, messageData: string, timestampMs: number): boolean;
|
|
272
|
+
getProfilePic(): ProfilePic;
|
|
273
|
+
setProfilePic(pic: ProfilePic): void;
|
|
274
|
+
getName(): string | undefined;
|
|
275
|
+
getDescription(): string | undefined;
|
|
276
|
+
pendingConfigHex(): string | undefined;
|
|
277
|
+
subaccountSign(sessionId: string, message: string, write: boolean): SwarmAuth;
|
|
278
|
+
pushHex(): WGroupPushResultStruct;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface Member extends ClassHandle {
|
|
282
|
+
admin: boolean;
|
|
283
|
+
supplement: boolean;
|
|
284
|
+
get pubkey(): string;
|
|
285
|
+
set pubkey(value: string);
|
|
286
|
+
get name(): string;
|
|
287
|
+
set name(name: string);
|
|
288
|
+
profile_picture: ProfilePic;
|
|
289
|
+
setInviteSent(): void;
|
|
290
|
+
setInviteNotSent(): void;
|
|
291
|
+
setInviteFailed(): void;
|
|
292
|
+
setInviteAccepted(): void;
|
|
293
|
+
setPromoted(): void;
|
|
294
|
+
setPromotionSent(): void;
|
|
295
|
+
setPromotionFailed(): void;
|
|
296
|
+
setPromotionAccepted(): void;
|
|
297
|
+
setRemoved(includingMessages: boolean): void;
|
|
298
|
+
setName(name: string): void;
|
|
299
|
+
setNameTruncated(name: string): void;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export interface GroupKeysUtilities extends ClassHandle {
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface NamespaceValue<T extends number> {
|
|
306
|
+
value: T;
|
|
307
|
+
}
|
|
308
|
+
export type Namespace = NamespaceValue<2>|NamespaceValue<3>|NamespaceValue<4>|NamespaceValue<5>|NamespaceValue<11>|NamespaceValue<12>|NamespaceValue<13>|NamespaceValue<14>;
|
|
309
|
+
|
|
310
|
+
export interface NotificationModeValue<T extends number> {
|
|
311
|
+
value: T;
|
|
312
|
+
}
|
|
313
|
+
export type NotificationMode = NotificationModeValue<1>|NotificationModeValue<0>|NotificationModeValue<2>|NotificationModeValue<3>;
|
|
314
|
+
|
|
315
|
+
export interface ExpirationModeValue<T extends number> {
|
|
316
|
+
value: T;
|
|
317
|
+
}
|
|
318
|
+
export type ExpirationMode = ExpirationModeValue<0>|ExpirationModeValue<1>|ExpirationModeValue<2>;
|
|
319
|
+
|
|
320
|
+
export interface GroupMemberStatusValue<T extends number> {
|
|
321
|
+
value: T;
|
|
322
|
+
}
|
|
323
|
+
export type GroupMemberStatus = GroupMemberStatusValue<0>|GroupMemberStatusValue<1>|GroupMemberStatusValue<2>|GroupMemberStatusValue<3>|GroupMemberStatusValue<4>|GroupMemberStatusValue<5>|GroupMemberStatusValue<6>|GroupMemberStatusValue<7>|GroupMemberStatusValue<8>|GroupMemberStatusValue<9>|GroupMemberStatusValue<10>|GroupMemberStatusValue<11>|GroupMemberStatusValue<12>|GroupMemberStatusValue<13>|GroupMemberStatusValue<14>;
|
|
324
|
+
|
|
325
|
+
export interface ContactInfoVector extends ClassHandle {
|
|
326
|
+
push_back(item: ContactInfo): void;
|
|
327
|
+
resize(size: number, value: ContactInfo): void;
|
|
328
|
+
size(): number;
|
|
329
|
+
get(index: number): ContactInfo | undefined;
|
|
330
|
+
set(index: number, value: ContactInfo): boolean;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface LegacyGroupInfoVector extends ClassHandle {
|
|
334
|
+
push_back(item: LegacyGroupInfo): void;
|
|
335
|
+
resize(size: number, value: LegacyGroupInfo): void;
|
|
336
|
+
size(): number;
|
|
337
|
+
get(index: number): LegacyGroupInfo | undefined;
|
|
338
|
+
set(index: number, value: LegacyGroupInfo): boolean;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export interface GroupInfoVector extends ClassHandle {
|
|
342
|
+
push_back(item: GroupInfo): void;
|
|
343
|
+
resize(size: number, value: GroupInfo): void;
|
|
344
|
+
size(): number;
|
|
345
|
+
get(index: number): GroupInfo | undefined;
|
|
346
|
+
set(index: number, value: GroupInfo): boolean;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export interface MemberInGroupVector extends ClassHandle {
|
|
350
|
+
push_back(item: Member): void;
|
|
351
|
+
resize(size: number, value: Member): void;
|
|
352
|
+
size(): number;
|
|
353
|
+
get(index: number): Member | undefined;
|
|
354
|
+
set(index: number, value: Member): boolean;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export interface StringVector extends ClassHandle {
|
|
358
|
+
size(): number;
|
|
359
|
+
get(index: number): string | undefined;
|
|
360
|
+
push_back(value: string): void;
|
|
361
|
+
resize(size: number, value: string): void;
|
|
362
|
+
set(index: number, value: string): boolean;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export interface MergeStructVector extends ClassHandle {
|
|
366
|
+
size(): number;
|
|
367
|
+
get(index: number): WMergeStruct | undefined;
|
|
368
|
+
push_back(item: WMergeStruct): void;
|
|
369
|
+
resize(size: number, value: WMergeStruct): void;
|
|
370
|
+
set(index: number, value: WMergeStruct): boolean;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export interface MergeStructGroupKeysVector extends ClassHandle {
|
|
374
|
+
size(): number;
|
|
375
|
+
get(index: number): WMergeStructGroupKeys | undefined;
|
|
376
|
+
push_back(item: WMergeStructGroupKeys): void;
|
|
377
|
+
resize(size: number, value: WMergeStructGroupKeys): void;
|
|
378
|
+
set(index: number, value: WMergeStructGroupKeys): boolean;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export interface VectorOfDecryptedGroupMessage extends ClassHandle {
|
|
382
|
+
size(): number;
|
|
383
|
+
get(index: number): DecryptedGroupMessage | undefined;
|
|
384
|
+
push_back(item: DecryptedGroupMessage): void;
|
|
385
|
+
resize(size: number, value: DecryptedGroupMessage): void;
|
|
386
|
+
set(index: number, value: DecryptedGroupMessage): boolean;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export interface VectorOfEncryptedGroupMessage extends ClassHandle {
|
|
390
|
+
size(): number;
|
|
391
|
+
get(index: number): EncryptedGroupMessage | undefined;
|
|
392
|
+
push_back(item: EncryptedGroupMessage): void;
|
|
393
|
+
resize(size: number, value: EncryptedGroupMessage): void;
|
|
394
|
+
set(index: number, value: EncryptedGroupMessage): boolean;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export interface VectorOfConvoVolatile1o1 extends ClassHandle {
|
|
398
|
+
push_back(item: ConvoVolatile1to1): void;
|
|
399
|
+
resize(size: number, value: ConvoVolatile1to1): void;
|
|
400
|
+
size(): number;
|
|
401
|
+
get(index: number): ConvoVolatile1to1 | undefined;
|
|
402
|
+
set(index: number, value: ConvoVolatile1to1): boolean;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export interface VectorOfConvoVolatileLegacyGroup extends ClassHandle {
|
|
406
|
+
push_back(item: ConvoVolatileLegacyGroup): void;
|
|
407
|
+
resize(size: number, value: ConvoVolatileLegacyGroup): void;
|
|
408
|
+
size(): number;
|
|
409
|
+
get(index: number): ConvoVolatileLegacyGroup | undefined;
|
|
410
|
+
set(index: number, value: ConvoVolatileLegacyGroup): boolean;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export interface VectorOfConvoVolatileGroup extends ClassHandle {
|
|
414
|
+
push_back(item: ConvoVolatileGroup): void;
|
|
415
|
+
resize(size: number, value: ConvoVolatileGroup): void;
|
|
416
|
+
size(): number;
|
|
417
|
+
get(index: number): ConvoVolatileGroup | undefined;
|
|
418
|
+
set(index: number, value: ConvoVolatileGroup): boolean;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
export interface CommunityInfoVector extends ClassHandle {
|
|
422
|
+
push_back(item: CommunityInfo): void;
|
|
423
|
+
resize(size: number, value: CommunityInfo): void;
|
|
424
|
+
size(): number;
|
|
425
|
+
get(index: number): CommunityInfo | undefined;
|
|
426
|
+
set(index: number, value: CommunityInfo): boolean;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export interface VectorOfConvoVolatileCommunity extends ClassHandle {
|
|
430
|
+
push_back(item: ConvoVolatileCommunity): void;
|
|
431
|
+
resize(size: number, value: ConvoVolatileCommunity): void;
|
|
432
|
+
size(): number;
|
|
433
|
+
get(index: number): ConvoVolatileCommunity | undefined;
|
|
434
|
+
set(index: number, value: ConvoVolatileCommunity): boolean;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export interface CommunityMessageToDecryptVector extends ClassHandle {
|
|
438
|
+
push_back(item: CommunityMessageToDecrypt): void;
|
|
439
|
+
resize(size: number, value: CommunityMessageToDecrypt): void;
|
|
440
|
+
size(): number;
|
|
441
|
+
get(index: number): CommunityMessageToDecrypt | undefined;
|
|
442
|
+
set(index: number, value: CommunityMessageToDecrypt): boolean;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
export type WPushResultStruct = {
|
|
446
|
+
seqno: number,
|
|
447
|
+
dataHex: StringVector,
|
|
448
|
+
hashes: StringVector,
|
|
449
|
+
storageNamespace: Namespace
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
export type ProfilePic = {
|
|
453
|
+
url: string,
|
|
454
|
+
key: string
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
export type WMergeStruct = {
|
|
458
|
+
hash: string,
|
|
459
|
+
dataHex: string
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
export type SwarmAuth = {
|
|
463
|
+
subaccount: string,
|
|
464
|
+
subaccountSig: string,
|
|
465
|
+
signature: string
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
export type WMergeStructGroupKeys = {
|
|
469
|
+
hash: string,
|
|
470
|
+
dataHex: string,
|
|
471
|
+
timestampMs: number
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
export type EncryptedGroupMessage = {
|
|
475
|
+
dataHex: string,
|
|
476
|
+
hash: string
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
export type DecryptedGroupMessage = {
|
|
480
|
+
author: string,
|
|
481
|
+
dataHex: string,
|
|
482
|
+
hash: string
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
export type WKeysPushResultStruct = {
|
|
486
|
+
dataHex: string,
|
|
487
|
+
storageNamespace: Namespace
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
export type WGroupPushResultStruct = {
|
|
491
|
+
infosPush: WPushResultStruct | undefined,
|
|
492
|
+
membersPush: WPushResultStruct | undefined,
|
|
493
|
+
keysPush: WKeysPushResultStruct | undefined
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
interface EmbindModule {
|
|
497
|
+
ConfigBase: {};
|
|
498
|
+
UserProfile: {};
|
|
499
|
+
UserProfileW: {
|
|
500
|
+
new(edPubkey: string, dump?: string): UserProfileW;
|
|
501
|
+
};
|
|
502
|
+
ContactInfo: {
|
|
503
|
+
new(sessionId: string): ContactInfo;
|
|
504
|
+
};
|
|
505
|
+
Contacts: {};
|
|
506
|
+
ContactsW: {
|
|
507
|
+
new(edPubkey: string, dump?: string): ContactsW;
|
|
508
|
+
};
|
|
509
|
+
BaseGroupInfo: {
|
|
510
|
+
NAME_MAX_LENGTH: number;
|
|
511
|
+
};
|
|
512
|
+
LegacyGroupInfo: {
|
|
513
|
+
new(groupId: string): LegacyGroupInfo;
|
|
514
|
+
};
|
|
515
|
+
GroupInfo: {
|
|
516
|
+
new(groupId: string): GroupInfo;
|
|
517
|
+
};
|
|
518
|
+
CommunityInfo: {
|
|
519
|
+
new(): CommunityInfo;
|
|
520
|
+
};
|
|
521
|
+
UserGroups: {};
|
|
522
|
+
UserGroupsW: {
|
|
523
|
+
new(edPubkey: string, dump?: string): UserGroupsW;
|
|
524
|
+
};
|
|
525
|
+
BaseConvoVolatile: {};
|
|
526
|
+
ConvoVolatile1to1: {
|
|
527
|
+
new(sessionId: string): ConvoVolatile1to1;
|
|
528
|
+
};
|
|
529
|
+
ConvoVolatileLegacyGroup: {
|
|
530
|
+
new(sessionId: string): ConvoVolatileLegacyGroup;
|
|
531
|
+
};
|
|
532
|
+
ConvoVolatileGroup: {
|
|
533
|
+
new(sessionId: string): ConvoVolatileGroup;
|
|
534
|
+
};
|
|
535
|
+
ConvoVolatileCommunity: {
|
|
536
|
+
new(fullUrl: string): ConvoVolatileCommunity;
|
|
537
|
+
};
|
|
538
|
+
ConvoInfoVolatile: {};
|
|
539
|
+
ConvoInfoVolatileW: {
|
|
540
|
+
new(edPubkey: string, dump?: string): ConvoInfoVolatileW;
|
|
541
|
+
};
|
|
542
|
+
CommunityMessageToDecrypt: {
|
|
543
|
+
new(contentOrEnvelope: Uint8Array, serverId: number): CommunityMessageToDecrypt;
|
|
544
|
+
};
|
|
545
|
+
CommunityDecryptOptions: {
|
|
546
|
+
new(nowMs: bigint, proBackendPubkey: string): CommunityDecryptOptions;
|
|
547
|
+
};
|
|
548
|
+
MultiEncryptW: {
|
|
549
|
+
decryptForCommunity(messages: CommunityMessageToDecryptVector, options: CommunityDecryptOptions): string;
|
|
550
|
+
decryptForGroup(): string;
|
|
551
|
+
decryptFor1o1(): string;
|
|
552
|
+
};
|
|
553
|
+
MetaGroupW: {
|
|
554
|
+
new(userEdSecretKey: string, groupEdPubkey: string, groupAdminSecretKey?: string, dumpedMeta?: string): MetaGroupW;
|
|
555
|
+
};
|
|
556
|
+
Member: {
|
|
557
|
+
new(sessionId: string): Member;
|
|
558
|
+
MAX_NAME_LENGTH: number;
|
|
559
|
+
};
|
|
560
|
+
GroupKeysUtilities: {
|
|
561
|
+
swarmSubaccountSignAsUserHex(userSecretKey: string, subaccountToken: string, message: string): SwarmAuth;
|
|
562
|
+
};
|
|
563
|
+
Namespace: {UserProfile: NamespaceValue<2>, Contacts: NamespaceValue<3>, ConvoInfoVolatile: NamespaceValue<4>, UserGroups: NamespaceValue<5>, GroupMessages: NamespaceValue<11>, GroupKeys: NamespaceValue<12>, GroupInfo: NamespaceValue<13>, GroupMembers: NamespaceValue<14>};
|
|
564
|
+
NotificationMode: {All: NotificationModeValue<1>, defaulted: NotificationModeValue<0>, disabled: NotificationModeValue<2>, mentions_only: NotificationModeValue<3>};
|
|
565
|
+
ExpirationMode: {None: ExpirationModeValue<0>, AfterSend: ExpirationModeValue<1>, AfterRead: ExpirationModeValue<2>};
|
|
566
|
+
GroupMemberStatus: {invite_unknown: GroupMemberStatusValue<0>, invite_not_sent: GroupMemberStatusValue<1>, invite_sending: GroupMemberStatusValue<2>, invite_failed: GroupMemberStatusValue<3>, invite_sent: GroupMemberStatusValue<4>, invite_accepted: GroupMemberStatusValue<5>, promotion_unknown: GroupMemberStatusValue<6>, promotion_not_sent: GroupMemberStatusValue<7>, promotion_sending: GroupMemberStatusValue<8>, promotion_failed: GroupMemberStatusValue<9>, promotion_sent: GroupMemberStatusValue<10>, promotion_accepted: GroupMemberStatusValue<11>, removed_unknown: GroupMemberStatusValue<12>, removed: GroupMemberStatusValue<13>, removed_including_messages: GroupMemberStatusValue<14>};
|
|
567
|
+
ContactInfoVector: {
|
|
568
|
+
new(): ContactInfoVector;
|
|
569
|
+
};
|
|
570
|
+
LegacyGroupInfoVector: {
|
|
571
|
+
new(): LegacyGroupInfoVector;
|
|
572
|
+
};
|
|
573
|
+
GroupInfoVector: {
|
|
574
|
+
new(): GroupInfoVector;
|
|
575
|
+
};
|
|
576
|
+
MemberInGroupVector: {
|
|
577
|
+
new(): MemberInGroupVector;
|
|
578
|
+
};
|
|
579
|
+
StringVector: {
|
|
580
|
+
new(): StringVector;
|
|
581
|
+
};
|
|
582
|
+
MergeStructVector: {
|
|
583
|
+
new(): MergeStructVector;
|
|
584
|
+
};
|
|
585
|
+
MergeStructGroupKeysVector: {
|
|
586
|
+
new(): MergeStructGroupKeysVector;
|
|
587
|
+
};
|
|
588
|
+
VectorOfDecryptedGroupMessage: {
|
|
589
|
+
new(): VectorOfDecryptedGroupMessage;
|
|
590
|
+
};
|
|
591
|
+
VectorOfEncryptedGroupMessage: {
|
|
592
|
+
new(): VectorOfEncryptedGroupMessage;
|
|
593
|
+
};
|
|
594
|
+
VectorOfConvoVolatile1o1: {
|
|
595
|
+
new(): VectorOfConvoVolatile1o1;
|
|
596
|
+
};
|
|
597
|
+
VectorOfConvoVolatileLegacyGroup: {
|
|
598
|
+
new(): VectorOfConvoVolatileLegacyGroup;
|
|
599
|
+
};
|
|
600
|
+
VectorOfConvoVolatileGroup: {
|
|
601
|
+
new(): VectorOfConvoVolatileGroup;
|
|
602
|
+
};
|
|
603
|
+
CommunityInfoVector: {
|
|
604
|
+
new(): CommunityInfoVector;
|
|
605
|
+
};
|
|
606
|
+
VectorOfConvoVolatileCommunity: {
|
|
607
|
+
new(): VectorOfConvoVolatileCommunity;
|
|
608
|
+
};
|
|
609
|
+
CommunityMessageToDecryptVector: {
|
|
610
|
+
new(): CommunityMessageToDecryptVector;
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export type MainModule = WasmModule & EmbindModule;
|
|
615
|
+
export default function MainModuleFactory (options?: unknown): Promise<MainModule>;
|
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@session-foundation/libsession-wasm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
|
-
"types": "./build/
|
|
8
|
-
"default": "./build/
|
|
7
|
+
"types": "./build/index.d.ts",
|
|
8
|
+
"default": "./build/index.js"
|
|
9
9
|
},
|
|
10
10
|
"./wasm": "./build/libsession-wasm.wasm"
|
|
11
11
|
},
|
|
12
|
-
"main": "./build/
|
|
13
|
-
"types": "./build/
|
|
12
|
+
"main": "./build/index.js",
|
|
13
|
+
"types": "./build/index.d.ts",
|
|
14
14
|
"files": [
|
|
15
|
+
"build/index.d.ts",
|
|
16
|
+
"build/index.js",
|
|
15
17
|
"build/libsession-wasm-fixed.d.ts",
|
|
16
18
|
"build/libsession-wasm-raw.d.ts",
|
|
17
19
|
"build/libsession-wasm.js",
|
|
@@ -38,6 +40,7 @@
|
|
|
38
40
|
},
|
|
39
41
|
"scripts": {
|
|
40
42
|
"build": "mkdir build; cd build ; emcmake cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_ONIONREQ=OFF -DBUILD_SHARED_LIBS=OFF -DWITH_TESTS=OFF -DUSE_LTO=OFF .. && emmake make -j32",
|
|
43
|
+
"postbuild": "npx tsx scripts/fix-types.js build/libsession-wasm-raw.d.ts build/libsession-wasm-fixed.d.ts && node scripts/generate-index.js",
|
|
41
44
|
"pretest": "tsc --incremental && cp build/libsession-wasm.wasm dist/build/libsession-wasm.wasm",
|
|
42
45
|
"test": "mocha --require ts-node/register --extensions js 'dist/tests/**/*.js' dist/tests/*.test.js"
|
|
43
46
|
}
|