@ubedsockets/baileys 1.6.6 → 1.6.8
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/WAProto/GenerateStatics.sh +4 -3
- package/WAProto/WAProto.proto +511 -1215
- package/WAProto/index.js +131318 -59331
- package/lib/Defaults/index.js +92 -76
- package/lib/Signal/Group/ciphertext-message.js +5 -2
- package/lib/Signal/Group/group-session-builder.js +41 -7
- package/lib/Signal/Group/group_cipher.js +51 -37
- package/lib/Signal/Group/index.js +57 -12
- package/lib/Signal/Group/keyhelper.js +44 -7
- package/lib/Signal/Group/sender-chain-key.js +15 -7
- package/lib/Signal/Group/sender-key-distribution-message.js +11 -8
- package/lib/Signal/Group/sender-key-message.js +12 -9
- package/lib/Signal/Group/sender-key-name.js +5 -2
- package/lib/Signal/Group/sender-key-record.js +21 -9
- package/lib/Signal/Group/sender-key-state.js +42 -27
- package/lib/Signal/Group/sender-message-key.js +7 -4
- package/lib/Signal/libsignal.js +90 -347
- package/lib/Socket/Client/index.js +18 -3
- package/lib/Socket/Client/types.js +6 -4
- package/lib/Socket/Client/websocket.js +78 -21
- package/lib/Socket/business.js +43 -162
- package/lib/Socket/chats.js +249 -571
- package/lib/Socket/groups.js +99 -114
- package/lib/Socket/index.js +9 -11
- package/lib/Socket/messages-recv.js +559 -1277
- package/lib/Socket/messages-send.js +669 -674
- package/lib/Socket/newsletter.js +286 -149
- package/lib/Socket/socket.js +235 -548
- package/lib/Types/Auth.js +2 -2
- package/lib/Types/Call.js +2 -2
- package/lib/Types/Chat.js +4 -8
- package/lib/Types/Contact.js +2 -2
- package/lib/Types/Events.js +2 -2
- package/lib/Types/GroupMetadata.js +2 -2
- package/lib/Types/Label.js +5 -3
- package/lib/Types/LabelAssociation.js +5 -3
- package/lib/Types/Message.js +7 -11
- package/lib/Types/Product.js +2 -2
- package/lib/Types/Signal.js +2 -2
- package/lib/Types/Socket.js +2 -3
- package/lib/Types/State.js +2 -56
- package/lib/Types/USync.js +2 -2
- package/lib/Types/index.js +31 -15
- package/lib/Utils/auth-utils.js +136 -239
- package/lib/Utils/business.js +69 -66
- package/lib/Utils/chat-utils.js +238 -380
- package/lib/Utils/crypto.js +127 -56
- package/lib/Utils/decode-wa-message.js +63 -173
- package/lib/Utils/event-buffer.js +70 -174
- package/lib/Utils/generics.js +207 -159
- package/lib/Utils/history.js +53 -93
- package/lib/Utils/index.js +33 -22
- package/lib/Utils/link-preview.js +58 -17
- package/lib/Utils/logger.js +7 -3
- package/lib/Utils/lt-hash.js +46 -3
- package/lib/Utils/make-mutex.js +34 -24
- package/lib/Utils/messages-media.js +744 -483
- package/lib/Utils/messages.js +621 -411
- package/lib/Utils/noise-handler.js +99 -149
- package/lib/Utils/process-message.js +150 -459
- package/lib/Utils/signal.js +73 -112
- package/lib/Utils/use-multi-file-auth-state.js +27 -23
- package/lib/Utils/validate-connection.js +104 -74
- package/lib/WABinary/constants.js +11 -9
- package/lib/WABinary/decode.js +52 -49
- package/lib/WABinary/encode.js +49 -19
- package/lib/WABinary/generic-utils.js +43 -46
- package/lib/WABinary/index.js +21 -6
- package/lib/WABinary/jid-utils.js +45 -72
- package/lib/WABinary/types.js +2 -2
- package/lib/WAM/BinaryInfo.js +5 -2
- package/lib/WAM/constants.js +11958 -19461
- package/lib/WAM/encode.js +22 -17
- package/lib/WAM/index.js +19 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +13 -33
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +14 -11
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +11 -8
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +13 -9
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +22 -20
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +8 -13
- package/lib/WAUSync/Protocols/index.js +20 -6
- package/lib/WAUSync/USyncQuery.js +35 -44
- package/lib/WAUSync/USyncUser.js +5 -10
- package/lib/WAUSync/index.js +19 -4
- package/lib/index.js +70 -11
- package/package.json +60 -100
- package/engine-requirements.js +0 -10
package/lib/Utils/auth-utils.js
CHANGED
|
@@ -1,290 +1,188 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.initAuthCreds = exports.addTransactionCapability = void 0;
|
|
7
|
+
exports.makeCacheableSignalKeyStore = makeCacheableSignalKeyStore;
|
|
8
|
+
const crypto_1 = require("crypto");
|
|
9
|
+
const node_cache_1 = __importDefault(require("@cacheable/node-cache"));
|
|
10
|
+
const Defaults_1 = require("../Defaults");
|
|
11
|
+
const crypto_2 = require("./crypto");
|
|
12
|
+
const generics_1 = require("./generics");
|
|
11
13
|
/**
|
|
12
14
|
* Adds caching capability to a SignalKeyStore
|
|
13
15
|
* @param store the store to add caching to
|
|
14
16
|
* @param logger to log trace events
|
|
15
17
|
* @param _cache cache store to use
|
|
16
18
|
*/
|
|
17
|
-
|
|
18
|
-
const cache = _cache ||
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
24
|
-
// Mutex for protecting cache operations
|
|
25
|
-
const cacheMutex = new Mutex();
|
|
19
|
+
function makeCacheableSignalKeyStore(store, logger, _cache) {
|
|
20
|
+
const cache = _cache || new node_cache_1.default({
|
|
21
|
+
stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.SIGNAL_STORE, // 5 minutes
|
|
22
|
+
useClones: false,
|
|
23
|
+
deleteOnExpire: true,
|
|
24
|
+
});
|
|
26
25
|
function getUniqueId(type, id) {
|
|
27
26
|
return `${type}.${id}`;
|
|
28
27
|
}
|
|
29
28
|
return {
|
|
30
29
|
async get(type, ids) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
data[id] = item;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
idsToFetch.push(id);
|
|
41
|
-
}
|
|
30
|
+
const data = {};
|
|
31
|
+
const idsToFetch = [];
|
|
32
|
+
for (const id of ids) {
|
|
33
|
+
const item = cache.get(getUniqueId(type, id));
|
|
34
|
+
if (typeof item !== 'undefined') {
|
|
35
|
+
data[id] = item;
|
|
42
36
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
else {
|
|
38
|
+
idsToFetch.push(id);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (idsToFetch.length) {
|
|
42
|
+
logger === null || logger === void 0 ? void 0 : logger.trace({ items: idsToFetch.length }, 'loading from store');
|
|
43
|
+
const fetched = await store.get(type, idsToFetch);
|
|
44
|
+
for (const id of idsToFetch) {
|
|
45
|
+
const item = fetched[id];
|
|
46
|
+
if (item) {
|
|
47
|
+
data[id] = item;
|
|
48
|
+
cache.set(getUniqueId(type, id), item);
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
}
|
|
52
|
+
return data;
|
|
57
53
|
},
|
|
58
54
|
async set(data) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
for (const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
keys += 1;
|
|
65
|
-
}
|
|
55
|
+
let keys = 0;
|
|
56
|
+
for (const type in data) {
|
|
57
|
+
for (const id in data[type]) {
|
|
58
|
+
cache.set(getUniqueId(type, id), data[type][id]);
|
|
59
|
+
keys += 1;
|
|
66
60
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
}
|
|
62
|
+
logger === null || logger === void 0 ? void 0 : logger.trace({ keys }, 'updated cache');
|
|
63
|
+
await store.set(data);
|
|
70
64
|
},
|
|
71
65
|
async clear() {
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
var _a;
|
|
67
|
+
cache.flushAll();
|
|
68
|
+
await ((_a = store.clear) === null || _a === void 0 ? void 0 : _a.call(store));
|
|
74
69
|
}
|
|
75
70
|
};
|
|
76
71
|
}
|
|
77
72
|
/**
|
|
78
|
-
* Adds DB
|
|
79
|
-
*
|
|
73
|
+
* Adds DB like transaction capability (https://en.wikipedia.org/wiki/Database_transaction) to the SignalKeyStore,
|
|
74
|
+
* this allows batch read & write operations & improves the performance of the lib
|
|
80
75
|
* @param state the key store to apply this capability to
|
|
81
76
|
* @param logger logger to log events
|
|
82
77
|
* @returns SignalKeyStore with transaction capability
|
|
83
78
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
// Pre-key manager for specialized operations
|
|
92
|
-
const preKeyManager = new PreKeyManager(state, logger);
|
|
93
|
-
/**
|
|
94
|
-
* Get or create a queue for a specific key type
|
|
95
|
-
*/
|
|
96
|
-
function getQueue(key) {
|
|
97
|
-
if (!keyQueues.has(key)) {
|
|
98
|
-
keyQueues.set(key, new PQueue({ concurrency: 1 }));
|
|
99
|
-
}
|
|
100
|
-
return keyQueues.get(key);
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Get or create a transaction mutex
|
|
104
|
-
*/
|
|
105
|
-
function getTxMutex(key) {
|
|
106
|
-
if (!txMutexes.has(key)) {
|
|
107
|
-
txMutexes.set(key, new Mutex());
|
|
108
|
-
txMutexRefCounts.set(key, 0);
|
|
109
|
-
}
|
|
110
|
-
return txMutexes.get(key);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Acquire a reference to a transaction mutex
|
|
114
|
-
*/
|
|
115
|
-
function acquireTxMutexRef(key) {
|
|
116
|
-
const count = txMutexRefCounts.get(key) ?? 0;
|
|
117
|
-
txMutexRefCounts.set(key, count + 1);
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Release a reference to a transaction mutex and cleanup if no longer needed
|
|
121
|
-
*/
|
|
122
|
-
function releaseTxMutexRef(key) {
|
|
123
|
-
const count = (txMutexRefCounts.get(key) ?? 1) - 1;
|
|
124
|
-
txMutexRefCounts.set(key, count);
|
|
125
|
-
// Cleanup if no more references and mutex is not locked
|
|
126
|
-
if (count <= 0) {
|
|
127
|
-
const mutex = txMutexes.get(key);
|
|
128
|
-
if (mutex && !mutex.isLocked()) {
|
|
129
|
-
txMutexes.delete(key);
|
|
130
|
-
txMutexRefCounts.delete(key);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Check if currently in a transaction
|
|
136
|
-
*/
|
|
137
|
-
function isInTransaction() {
|
|
138
|
-
return !!txStorage.getStore();
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Commit transaction with retries
|
|
142
|
-
*/
|
|
143
|
-
async function commitWithRetry(mutations) {
|
|
144
|
-
if (Object.keys(mutations).length === 0) {
|
|
145
|
-
logger.trace('no mutations in transaction');
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
logger.trace('committing transaction');
|
|
149
|
-
for (let attempt = 0; attempt < maxCommitRetries; attempt++) {
|
|
150
|
-
try {
|
|
151
|
-
await state.set(mutations);
|
|
152
|
-
logger.trace({ mutationCount: Object.keys(mutations).length }, 'committed transaction');
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
catch (error) {
|
|
156
|
-
const retriesLeft = maxCommitRetries - attempt - 1;
|
|
157
|
-
logger.warn(`failed to commit mutations, retries left=${retriesLeft}`);
|
|
158
|
-
if (retriesLeft === 0) {
|
|
159
|
-
throw error;
|
|
160
|
-
}
|
|
161
|
-
await delay(delayBetweenTriesMs);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
79
|
+
const addTransactionCapability = (state, logger, { maxCommitRetries, delayBetweenTriesMs }) => {
|
|
80
|
+
// number of queries made to the DB during the transaction
|
|
81
|
+
// only there for logging purposes
|
|
82
|
+
let dbQueriesInTransaction = 0;
|
|
83
|
+
let transactionCache = {};
|
|
84
|
+
let mutations = {};
|
|
85
|
+
let transactionsInProgress = 0;
|
|
165
86
|
return {
|
|
166
87
|
get: async (type, ids) => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const fetched = await getTxMutex(type).runExclusive(() => state.get(type, missing));
|
|
179
|
-
// Update cache
|
|
180
|
-
ctx.cache[type] = ctx.cache[type] || {};
|
|
181
|
-
Object.assign(ctx.cache[type], fetched);
|
|
182
|
-
}
|
|
183
|
-
// Return requested ids from cache
|
|
184
|
-
const result = {};
|
|
185
|
-
for (const id of ids) {
|
|
186
|
-
const value = ctx.cache[type]?.[id];
|
|
187
|
-
if (value !== undefined && value !== null) {
|
|
188
|
-
result[id] = value;
|
|
88
|
+
if (isInTransaction()) {
|
|
89
|
+
const dict = transactionCache[type];
|
|
90
|
+
const idsRequiringFetch = dict
|
|
91
|
+
? ids.filter(item => typeof dict[item] === 'undefined')
|
|
92
|
+
: ids;
|
|
93
|
+
// only fetch if there are any items to fetch
|
|
94
|
+
if (idsRequiringFetch.length) {
|
|
95
|
+
dbQueriesInTransaction += 1;
|
|
96
|
+
const result = await state.get(type, idsRequiringFetch);
|
|
97
|
+
transactionCache[type] || (transactionCache[type] = {});
|
|
98
|
+
Object.assign(transactionCache[type], result);
|
|
189
99
|
}
|
|
100
|
+
return ids.reduce((dict, id) => {
|
|
101
|
+
var _a;
|
|
102
|
+
const value = (_a = transactionCache[type]) === null || _a === void 0 ? void 0 : _a[id];
|
|
103
|
+
if (value) {
|
|
104
|
+
dict[id] = value;
|
|
105
|
+
}
|
|
106
|
+
return dict;
|
|
107
|
+
}, {});
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
return state.get(type, ids);
|
|
190
111
|
}
|
|
191
|
-
return result;
|
|
192
112
|
},
|
|
193
|
-
set:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (type === 'pre-key') {
|
|
202
|
-
await preKeyManager.validateDeletions(data, type);
|
|
203
|
-
}
|
|
113
|
+
set: data => {
|
|
114
|
+
if (isInTransaction()) {
|
|
115
|
+
logger.trace({ types: Object.keys(data) }, 'caching in transaction');
|
|
116
|
+
for (const key in data) {
|
|
117
|
+
transactionCache[key] = transactionCache[key] || {};
|
|
118
|
+
Object.assign(transactionCache[key], data[key]);
|
|
119
|
+
mutations[key] = mutations[key] || {};
|
|
120
|
+
Object.assign(mutations[key], data[key]);
|
|
204
121
|
}
|
|
205
|
-
// Write all data in parallel
|
|
206
|
-
await Promise.all(types.map(type => getQueue(type).add(async () => {
|
|
207
|
-
const typeData = { [type]: data[type] };
|
|
208
|
-
await state.set(typeData);
|
|
209
|
-
})));
|
|
210
|
-
return;
|
|
211
122
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
for (const key_ in data) {
|
|
215
|
-
const key = key_;
|
|
216
|
-
// Ensure structures exist
|
|
217
|
-
ctx.cache[key] = ctx.cache[key] || {};
|
|
218
|
-
ctx.mutations[key] = ctx.mutations[key] || {};
|
|
219
|
-
// Special handling for pre-keys
|
|
220
|
-
if (key === 'pre-key') {
|
|
221
|
-
await preKeyManager.processOperations(data, key, ctx.cache, ctx.mutations, true);
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
// Normal key types
|
|
225
|
-
Object.assign(ctx.cache[key], data[key]);
|
|
226
|
-
Object.assign(ctx.mutations[key], data[key]);
|
|
227
|
-
}
|
|
123
|
+
else {
|
|
124
|
+
return state.set(data);
|
|
228
125
|
}
|
|
229
126
|
},
|
|
230
127
|
isInTransaction,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
if (
|
|
235
|
-
logger.trace('
|
|
236
|
-
return work();
|
|
128
|
+
async transaction(work) {
|
|
129
|
+
let result;
|
|
130
|
+
transactionsInProgress += 1;
|
|
131
|
+
if (transactionsInProgress === 1) {
|
|
132
|
+
logger.trace('entering transaction');
|
|
237
133
|
}
|
|
238
|
-
// New transaction - acquire mutex and create context
|
|
239
|
-
const mutex = getTxMutex(key);
|
|
240
|
-
acquireTxMutexRef(key);
|
|
241
134
|
try {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
135
|
+
result = await work();
|
|
136
|
+
// commit if this is the outermost transaction
|
|
137
|
+
if (transactionsInProgress === 1) {
|
|
138
|
+
if (Object.keys(mutations).length) {
|
|
139
|
+
logger.trace('committing transaction');
|
|
140
|
+
// retry mechanism to ensure we've some recovery
|
|
141
|
+
// in case a transaction fails in the first attempt
|
|
142
|
+
let tries = maxCommitRetries;
|
|
143
|
+
while (tries) {
|
|
144
|
+
tries -= 1;
|
|
145
|
+
try {
|
|
146
|
+
await state.set(mutations);
|
|
147
|
+
logger.trace({ dbQueriesInTransaction }, 'committed transaction');
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
logger.warn(`failed to commit ${Object.keys(mutations).length} mutations, tries left=${tries}`);
|
|
152
|
+
await (0, generics_1.delay)(delayBetweenTriesMs);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
255
155
|
}
|
|
256
|
-
|
|
257
|
-
logger.
|
|
258
|
-
throw error;
|
|
156
|
+
else {
|
|
157
|
+
logger.trace('no mutations in transaction');
|
|
259
158
|
}
|
|
260
|
-
}
|
|
159
|
+
}
|
|
261
160
|
}
|
|
262
161
|
finally {
|
|
263
|
-
|
|
162
|
+
transactionsInProgress -= 1;
|
|
163
|
+
if (transactionsInProgress === 0) {
|
|
164
|
+
transactionCache = {};
|
|
165
|
+
mutations = {};
|
|
166
|
+
dbQueriesInTransaction = 0;
|
|
167
|
+
}
|
|
264
168
|
}
|
|
169
|
+
return result;
|
|
265
170
|
}
|
|
266
171
|
};
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
* Returns the authenticated user's JID, or throws a Boom-401 if creds are not yet authenticated.
|
|
270
|
-
* Use this anywhere we'd otherwise reach for `creds.me!.id` to fail fast with a descriptive error.
|
|
271
|
-
*/
|
|
272
|
-
export const assertMeId = (creds) => {
|
|
273
|
-
const id = creds.me?.id;
|
|
274
|
-
if (!id) {
|
|
275
|
-
throw new Boom('Cannot proceed: socket is not authenticated yet (creds.me.id is missing)', { statusCode: 401 });
|
|
172
|
+
function isInTransaction() {
|
|
173
|
+
return transactionsInProgress > 0;
|
|
276
174
|
}
|
|
277
|
-
return id;
|
|
278
175
|
};
|
|
279
|
-
|
|
280
|
-
|
|
176
|
+
exports.addTransactionCapability = addTransactionCapability;
|
|
177
|
+
const initAuthCreds = () => {
|
|
178
|
+
const identityKey = crypto_2.Curve.generateKeyPair();
|
|
281
179
|
return {
|
|
282
|
-
noiseKey: Curve.generateKeyPair(),
|
|
283
|
-
pairingEphemeralKeyPair: Curve.generateKeyPair(),
|
|
180
|
+
noiseKey: crypto_2.Curve.generateKeyPair(),
|
|
181
|
+
pairingEphemeralKeyPair: crypto_2.Curve.generateKeyPair(),
|
|
284
182
|
signedIdentityKey: identityKey,
|
|
285
|
-
signedPreKey: signedKeyPair(identityKey, 1),
|
|
286
|
-
registrationId: generateRegistrationId(),
|
|
287
|
-
advSecretKey: randomBytes(32).toString('base64'),
|
|
183
|
+
signedPreKey: (0, crypto_2.signedKeyPair)(identityKey, 1),
|
|
184
|
+
registrationId: (0, generics_1.generateRegistrationId)(),
|
|
185
|
+
advSecretKey: (0, crypto_1.randomBytes)(32).toString('base64'),
|
|
288
186
|
processedHistoryMessages: [],
|
|
289
187
|
nextPreKeyId: 1,
|
|
290
188
|
firstUnuploadedPreKeyId: 1,
|
|
@@ -296,7 +194,6 @@ export const initAuthCreds = () => {
|
|
|
296
194
|
pairingCode: undefined,
|
|
297
195
|
lastPropHash: undefined,
|
|
298
196
|
routingInfo: undefined,
|
|
299
|
-
additionalData: undefined
|
|
300
197
|
};
|
|
301
198
|
};
|
|
302
|
-
|
|
199
|
+
exports.initAuthCreds = initAuthCreds;
|