@gara31/void-baileys 7.0.0-rc.14

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 (95) hide show
  1. package/LICENSE +21 -0
  2. package/WAProto/index.js +117292 -0
  3. package/lib/Defaults/baileys-version.json +3 -0
  4. package/lib/Defaults/index.js +116 -0
  5. package/lib/Signal/Group/ciphertext-message.js +12 -0
  6. package/lib/Signal/Group/group-session-builder.js +42 -0
  7. package/lib/Signal/Group/group_cipher.js +109 -0
  8. package/lib/Signal/Group/index.js +12 -0
  9. package/lib/Signal/Group/keyhelper.js +18 -0
  10. package/lib/Signal/Group/sender-chain-key.js +32 -0
  11. package/lib/Signal/Group/sender-key-distribution-message.js +67 -0
  12. package/lib/Signal/Group/sender-key-message.js +80 -0
  13. package/lib/Signal/Group/sender-key-name.js +50 -0
  14. package/lib/Signal/Group/sender-key-record.js +47 -0
  15. package/lib/Signal/Group/sender-key-state.js +105 -0
  16. package/lib/Signal/Group/sender-message-key.js +30 -0
  17. package/lib/Signal/libsignal.js +416 -0
  18. package/lib/Signal/lid-mapping.js +189 -0
  19. package/lib/Socket/Client/index.js +3 -0
  20. package/lib/Socket/Client/types.js +11 -0
  21. package/lib/Socket/Client/websocket.js +61 -0
  22. package/lib/Socket/business.js +404 -0
  23. package/lib/Socket/chats.js +1146 -0
  24. package/lib/Socket/communities.js +505 -0
  25. package/lib/Socket/groups.js +404 -0
  26. package/lib/Socket/index.js +18 -0
  27. package/lib/Socket/messages-recv.js +1600 -0
  28. package/lib/Socket/messages-send.js +1203 -0
  29. package/lib/Socket/mex.js +56 -0
  30. package/lib/Socket/newsletter.js +240 -0
  31. package/lib/Socket/socket.js +1060 -0
  32. package/lib/Types/Auth.js +2 -0
  33. package/lib/Types/Bussines.js +2 -0
  34. package/lib/Types/Call.js +2 -0
  35. package/lib/Types/Chat.js +8 -0
  36. package/lib/Types/Contact.js +2 -0
  37. package/lib/Types/Events.js +2 -0
  38. package/lib/Types/GroupMetadata.js +2 -0
  39. package/lib/Types/Label.js +25 -0
  40. package/lib/Types/LabelAssociation.js +7 -0
  41. package/lib/Types/Message.js +11 -0
  42. package/lib/Types/Newsletter.js +31 -0
  43. package/lib/Types/Product.js +2 -0
  44. package/lib/Types/Signal.js +2 -0
  45. package/lib/Types/Socket.js +3 -0
  46. package/lib/Types/State.js +13 -0
  47. package/lib/Types/USync.js +2 -0
  48. package/lib/Types/index.js +32 -0
  49. package/lib/Utils/auth-utils.js +276 -0
  50. package/lib/Utils/browser-utils.js +32 -0
  51. package/lib/Utils/business.js +262 -0
  52. package/lib/Utils/chat-utils.js +941 -0
  53. package/lib/Utils/crypto.js +179 -0
  54. package/lib/Utils/decode-wa-message.js +333 -0
  55. package/lib/Utils/event-buffer.js +580 -0
  56. package/lib/Utils/generics.js +436 -0
  57. package/lib/Utils/history.js +103 -0
  58. package/lib/Utils/index.js +19 -0
  59. package/lib/Utils/link-preview.js +99 -0
  60. package/lib/Utils/logger.js +3 -0
  61. package/lib/Utils/lt-hash.js +56 -0
  62. package/lib/Utils/make-mutex.js +38 -0
  63. package/lib/Utils/message-retry-manager.js +181 -0
  64. package/lib/Utils/messages-media.js +727 -0
  65. package/lib/Utils/messages.js +1309 -0
  66. package/lib/Utils/noise-handler.js +162 -0
  67. package/lib/Utils/pre-key-manager.js +125 -0
  68. package/lib/Utils/process-message.js +594 -0
  69. package/lib/Utils/signal.js +194 -0
  70. package/lib/Utils/use-multi-file-auth-state.js +118 -0
  71. package/lib/Utils/validate-connection.js +240 -0
  72. package/lib/WABinary/constants.js +1301 -0
  73. package/lib/WABinary/decode.js +240 -0
  74. package/lib/WABinary/encode.js +216 -0
  75. package/lib/WABinary/generic-utils.js +104 -0
  76. package/lib/WABinary/index.js +6 -0
  77. package/lib/WABinary/jid-utils.js +95 -0
  78. package/lib/WABinary/types.js +2 -0
  79. package/lib/WAM/BinaryInfo.js +10 -0
  80. package/lib/WAM/constants.js +22863 -0
  81. package/lib/WAM/encode.js +152 -0
  82. package/lib/WAM/index.js +4 -0
  83. package/lib/WAUSync/Protocols/USyncContactProtocol.js +29 -0
  84. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +59 -0
  85. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
  86. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +36 -0
  87. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +60 -0
  88. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
  89. package/lib/WAUSync/Protocols/index.js +5 -0
  90. package/lib/WAUSync/USyncQuery.js +104 -0
  91. package/lib/WAUSync/USyncUser.js +23 -0
  92. package/lib/WAUSync/index.js +4 -0
  93. package/lib/index.js +11 -0
  94. package/package.json +32 -0
  95. package/readme.md +1452 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Auth.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Bussines.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Call.js.map
@@ -0,0 +1,8 @@
1
+ export const ALL_WA_PATCH_NAMES = [
2
+ "critical_block",
3
+ "critical_unblock_low",
4
+ "regular_high",
5
+ "regular_low",
6
+ "regular",
7
+ ];
8
+ //# sourceMappingURL=Chat.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Contact.js.map
@@ -0,0 +1,2 @@
1
+ import { proto } from "../../WAProto/index.js";
2
+ //# sourceMappingURL=Events.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=GroupMetadata.js.map
@@ -0,0 +1,25 @@
1
+ /** WhatsApp has 20 predefined colors */
2
+ export var LabelColor;
3
+ (function (LabelColor) {
4
+ LabelColor[(LabelColor["Color1"] = 0)] = "Color1";
5
+ LabelColor[(LabelColor["Color2"] = 1)] = "Color2";
6
+ LabelColor[(LabelColor["Color3"] = 2)] = "Color3";
7
+ LabelColor[(LabelColor["Color4"] = 3)] = "Color4";
8
+ LabelColor[(LabelColor["Color5"] = 4)] = "Color5";
9
+ LabelColor[(LabelColor["Color6"] = 5)] = "Color6";
10
+ LabelColor[(LabelColor["Color7"] = 6)] = "Color7";
11
+ LabelColor[(LabelColor["Color8"] = 7)] = "Color8";
12
+ LabelColor[(LabelColor["Color9"] = 8)] = "Color9";
13
+ LabelColor[(LabelColor["Color10"] = 9)] = "Color10";
14
+ LabelColor[(LabelColor["Color11"] = 10)] = "Color11";
15
+ LabelColor[(LabelColor["Color12"] = 11)] = "Color12";
16
+ LabelColor[(LabelColor["Color13"] = 12)] = "Color13";
17
+ LabelColor[(LabelColor["Color14"] = 13)] = "Color14";
18
+ LabelColor[(LabelColor["Color15"] = 14)] = "Color15";
19
+ LabelColor[(LabelColor["Color16"] = 15)] = "Color16";
20
+ LabelColor[(LabelColor["Color17"] = 16)] = "Color17";
21
+ LabelColor[(LabelColor["Color18"] = 17)] = "Color18";
22
+ LabelColor[(LabelColor["Color19"] = 18)] = "Color19";
23
+ LabelColor[(LabelColor["Color20"] = 19)] = "Color20";
24
+ })(LabelColor || (LabelColor = {}));
25
+ //# sourceMappingURL=Label.js.map
@@ -0,0 +1,7 @@
1
+ /** Association type */
2
+ export var LabelAssociationType;
3
+ (function (LabelAssociationType) {
4
+ LabelAssociationType["Chat"] = "label_jid";
5
+ LabelAssociationType["Message"] = "label_message";
6
+ })(LabelAssociationType || (LabelAssociationType = {}));
7
+ //# sourceMappingURL=LabelAssociation.js.map
@@ -0,0 +1,11 @@
1
+ import { proto } from "../../WAProto/index.js";
2
+ // export the WAMessage Prototypes
3
+ export { proto as WAProto };
4
+ export const WAMessageStubType = proto.WebMessageInfo.StubType;
5
+ export const WAMessageStatus = proto.WebMessageInfo.Status;
6
+ export var WAMessageAddressingMode;
7
+ (function (WAMessageAddressingMode) {
8
+ WAMessageAddressingMode["PN"] = "pn";
9
+ WAMessageAddressingMode["LID"] = "lid";
10
+ })(WAMessageAddressingMode || (WAMessageAddressingMode = {}));
11
+ //# sourceMappingURL=Message.js.map
@@ -0,0 +1,31 @@
1
+ export var XWAPaths;
2
+ (function (XWAPaths) {
3
+ XWAPaths["xwa2_newsletter_create"] = "xwa2_newsletter_create";
4
+ XWAPaths["xwa2_newsletter_subscribers"] = "xwa2_newsletter_subscribers";
5
+ XWAPaths["xwa2_newsletter_view"] = "xwa2_newsletter_view";
6
+ XWAPaths["xwa2_newsletter_metadata"] = "xwa2_newsletter";
7
+ XWAPaths["xwa2_newsletter_admin_count"] = "xwa2_newsletter_admin";
8
+ XWAPaths["xwa2_newsletter_mute_v2"] = "xwa2_newsletter_mute_v2";
9
+ XWAPaths["xwa2_newsletter_unmute_v2"] = "xwa2_newsletter_unmute_v2";
10
+ XWAPaths["xwa2_newsletter_follow"] = "xwa2_newsletter_follow";
11
+ XWAPaths["xwa2_newsletter_unfollow"] = "xwa2_newsletter_unfollow";
12
+ XWAPaths["xwa2_newsletter_change_owner"] = "xwa2_newsletter_change_owner";
13
+ XWAPaths["xwa2_newsletter_demote"] = "xwa2_newsletter_demote";
14
+ XWAPaths["xwa2_newsletter_delete_v2"] = "xwa2_newsletter_delete_v2";
15
+ })(XWAPaths || (XWAPaths = {}));
16
+ export var QueryIds;
17
+ (function (QueryIds) {
18
+ QueryIds["CREATE"] = "8823471724422422";
19
+ QueryIds["UPDATE_METADATA"] = "24250201037901610";
20
+ QueryIds["METADATA"] = "6563316087068696";
21
+ QueryIds["SUBSCRIBERS"] = "9783111038412085";
22
+ QueryIds["FOLLOW"] = "7871414976211147";
23
+ QueryIds["UNFOLLOW"] = "7238632346214362";
24
+ QueryIds["MUTE"] = "29766401636284406";
25
+ QueryIds["UNMUTE"] = "9864994326891137";
26
+ QueryIds["ADMIN_COUNT"] = "7130823597031706";
27
+ QueryIds["CHANGE_OWNER"] = "7341777602580933";
28
+ QueryIds["DEMOTE"] = "6551828931592903";
29
+ QueryIds["DELETE"] = "30062808666639665";
30
+ })(QueryIds || (QueryIds = {}));
31
+ //# sourceMappingURL=Newsletter.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Product.js.map
@@ -0,0 +1,2 @@
1
+ import { proto } from "../../WAProto/index.js";
2
+ //# sourceMappingURL=Signal.js.map
@@ -0,0 +1,3 @@
1
+ import { proto } from "../../WAProto/index.js";
2
+ import {} from "./Message.js";
3
+ //# sourceMappingURL=Socket.js.map
@@ -0,0 +1,13 @@
1
+ import { Boom } from "@hapi/boom";
2
+ export var SyncState;
3
+ (function (SyncState) {
4
+ /** The socket is connecting, but we haven't received pending notifications yet. */
5
+ SyncState[(SyncState["Connecting"] = 0)] = "Connecting";
6
+ /** Pending notifications received. Buffering events until we decide whether to sync or not. */
7
+ SyncState[(SyncState["AwaitingInitialSync"] = 1)] = "AwaitingInitialSync";
8
+ /** The initial app state sync (history, etc.) is in progress. Buffering continues. */
9
+ SyncState[(SyncState["Syncing"] = 2)] = "Syncing";
10
+ /** Initial sync is complete, or was skipped. The socket is fully operational and events are processed in real-time. */
11
+ SyncState[(SyncState["Online"] = 3)] = "Online";
12
+ })(SyncState || (SyncState = {}));
13
+ //# sourceMappingURL=State.js.map
@@ -0,0 +1,2 @@
1
+ import { USyncUser } from "../WAUSync/index.js";
2
+ //# sourceMappingURL=USync.js.map
@@ -0,0 +1,32 @@
1
+ export * from "./Auth.js";
2
+ export * from "./GroupMetadata.js";
3
+ export * from "./Chat.js";
4
+ export * from "./Contact.js";
5
+ export * from "./State.js";
6
+ export * from "./Message.js";
7
+ export * from "./Socket.js";
8
+ export * from "./Events.js";
9
+ export * from "./Product.js";
10
+ export * from "./Call.js";
11
+ export * from "./Signal.js";
12
+ export * from "./Newsletter.js";
13
+ export var DisconnectReason;
14
+ (function (DisconnectReason) {
15
+ DisconnectReason[(DisconnectReason["connectionClosed"] = 428)] =
16
+ "connectionClosed";
17
+ DisconnectReason[(DisconnectReason["connectionLost"] = 408)] =
18
+ "connectionLost";
19
+ DisconnectReason[(DisconnectReason["connectionReplaced"] = 440)] =
20
+ "connectionReplaced";
21
+ DisconnectReason[(DisconnectReason["timedOut"] = 408)] = "timedOut";
22
+ DisconnectReason[(DisconnectReason["loggedOut"] = 401)] = "loggedOut";
23
+ DisconnectReason[(DisconnectReason["badSession"] = 500)] = "badSession";
24
+ DisconnectReason[(DisconnectReason["restartRequired"] = 515)] =
25
+ "restartRequired";
26
+ DisconnectReason[(DisconnectReason["multideviceMismatch"] = 411)] =
27
+ "multideviceMismatch";
28
+ DisconnectReason[(DisconnectReason["forbidden"] = 403)] = "forbidden";
29
+ DisconnectReason[(DisconnectReason["unavailableService"] = 503)] =
30
+ "unavailableService";
31
+ })(DisconnectReason || (DisconnectReason = {}));
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,276 @@
1
+ import NodeCache from "@cacheable/node-cache";
2
+ import { AsyncLocalStorage } from "async_hooks";
3
+ import { Mutex } from "async-mutex";
4
+ import { randomBytes } from "crypto";
5
+ import PQueue from "p-queue";
6
+ import { DEFAULT_CACHE_TTLS } from "../Defaults/index.js";
7
+ import { Curve, signedKeyPair } from "./crypto.js";
8
+ import { delay, generateRegistrationId } from "./generics.js";
9
+ import { PreKeyManager } from "./pre-key-manager.js";
10
+ /**
11
+ * Adds caching capability to a SignalKeyStore
12
+ * @param store the store to add caching to
13
+ * @param logger to log trace events
14
+ * @param _cache cache store to use
15
+ */
16
+ export function makeCacheableSignalKeyStore(store, logger, _cache) {
17
+ const cache =
18
+ _cache ||
19
+ new NodeCache({
20
+ stdTTL: DEFAULT_CACHE_TTLS.SIGNAL_STORE, // 5 minutes
21
+ useClones: false,
22
+ deleteOnExpire: true,
23
+ });
24
+ // Mutex for protecting cache operations
25
+ const cacheMutex = new Mutex();
26
+ function getUniqueId(type, id) {
27
+ return `${type}.${id}`;
28
+ }
29
+ return {
30
+ async get(type, ids) {
31
+ return cacheMutex.runExclusive(async () => {
32
+ const data = {};
33
+ const idsToFetch = [];
34
+ for (const id of ids) {
35
+ const item = await cache.get(getUniqueId(type, id));
36
+ if (typeof item !== "undefined") {
37
+ data[id] = item;
38
+ } else {
39
+ idsToFetch.push(id);
40
+ }
41
+ }
42
+ if (idsToFetch.length) {
43
+ logger?.trace({ items: idsToFetch.length }, "loading from store");
44
+ const fetched = await store.get(type, idsToFetch);
45
+ for (const id of idsToFetch) {
46
+ const item = fetched[id];
47
+ if (item) {
48
+ data[id] = item;
49
+ await cache.set(getUniqueId(type, id), item);
50
+ }
51
+ }
52
+ }
53
+ return data;
54
+ });
55
+ },
56
+ async set(data) {
57
+ return cacheMutex.runExclusive(async () => {
58
+ let keys = 0;
59
+ for (const type in data) {
60
+ for (const id in data[type]) {
61
+ await cache.set(getUniqueId(type, id), data[type][id]);
62
+ keys += 1;
63
+ }
64
+ }
65
+ logger?.trace({ keys }, "updated cache");
66
+ await store.set(data);
67
+ });
68
+ },
69
+ async clear() {
70
+ await cache.flushAll();
71
+ await store.clear?.();
72
+ },
73
+ };
74
+ }
75
+ /**
76
+ * Adds DB-like transaction capability to the SignalKeyStore
77
+ * Uses AsyncLocalStorage for automatic context management
78
+ * @param state the key store to apply this capability to
79
+ * @param logger logger to log events
80
+ * @returns SignalKeyStore with transaction capability
81
+ */
82
+ export const addTransactionCapability = (
83
+ state,
84
+ logger,
85
+ { maxCommitRetries, delayBetweenTriesMs },
86
+ ) => {
87
+ const txStorage = new AsyncLocalStorage();
88
+ // Queues for concurrency control
89
+ const keyQueues = new Map();
90
+ const txMutexes = new Map();
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
+ }
109
+ return txMutexes.get(key);
110
+ }
111
+ /**
112
+ * Check if currently in a transaction
113
+ */
114
+ function isInTransaction() {
115
+ return !!txStorage.getStore();
116
+ }
117
+ /**
118
+ * Commit transaction with retries
119
+ */
120
+ async function commitWithRetry(mutations) {
121
+ if (Object.keys(mutations).length === 0) {
122
+ logger.trace("no mutations in transaction");
123
+ return;
124
+ }
125
+ logger.trace("committing transaction");
126
+ for (let attempt = 0; attempt < maxCommitRetries; attempt++) {
127
+ try {
128
+ await state.set(mutations);
129
+ logger.trace(
130
+ { mutationCount: Object.keys(mutations).length },
131
+ "committed transaction",
132
+ );
133
+ return;
134
+ } catch (error) {
135
+ const retriesLeft = maxCommitRetries - attempt - 1;
136
+ logger.warn(`failed to commit mutations, retries left=${retriesLeft}`);
137
+ if (retriesLeft === 0) {
138
+ throw error;
139
+ }
140
+ await delay(delayBetweenTriesMs);
141
+ }
142
+ }
143
+ }
144
+ return {
145
+ get: async (type, ids) => {
146
+ const ctx = txStorage.getStore();
147
+ if (!ctx) {
148
+ // No transaction - direct read without exclusive lock for concurrency
149
+ return state.get(type, ids);
150
+ }
151
+ // In transaction - check cache first
152
+ const cached = ctx.cache[type] || {};
153
+ const missing = ids.filter((id) => !(id in cached));
154
+ if (missing.length > 0) {
155
+ ctx.dbQueries++;
156
+ logger.trace(
157
+ { type, count: missing.length },
158
+ "fetching missing keys in transaction",
159
+ );
160
+ const fetched = await getTxMutex(type).runExclusive(() =>
161
+ state.get(type, missing),
162
+ );
163
+ // Update cache
164
+ ctx.cache[type] = ctx.cache[type] || {};
165
+ Object.assign(ctx.cache[type], fetched);
166
+ }
167
+ // Return requested ids from cache
168
+ const result = {};
169
+ for (const id of ids) {
170
+ const value = ctx.cache[type]?.[id];
171
+ if (value !== undefined && value !== null) {
172
+ result[id] = value;
173
+ }
174
+ }
175
+ return result;
176
+ },
177
+ set: async (data) => {
178
+ const ctx = txStorage.getStore();
179
+ if (!ctx) {
180
+ // No transaction - direct write with queue protection
181
+ const types = Object.keys(data);
182
+ // Process pre-keys with validation
183
+ for (const type_ of types) {
184
+ const type = type_;
185
+ if (type === "pre-key") {
186
+ await preKeyManager.validateDeletions(data, type);
187
+ }
188
+ }
189
+ // Write all data in parallel
190
+ await Promise.all(
191
+ types.map((type) =>
192
+ getQueue(type).add(async () => {
193
+ const typeData = { [type]: data[type] };
194
+ await state.set(typeData);
195
+ }),
196
+ ),
197
+ );
198
+ return;
199
+ }
200
+ // In transaction - update cache and mutations
201
+ logger.trace({ types: Object.keys(data) }, "caching in transaction");
202
+ for (const key_ in data) {
203
+ const key = key_;
204
+ // Ensure structures exist
205
+ ctx.cache[key] = ctx.cache[key] || {};
206
+ ctx.mutations[key] = ctx.mutations[key] || {};
207
+ // Special handling for pre-keys
208
+ if (key === "pre-key") {
209
+ await preKeyManager.processOperations(
210
+ data,
211
+ key,
212
+ ctx.cache,
213
+ ctx.mutations,
214
+ true,
215
+ );
216
+ } else {
217
+ // Normal key types
218
+ Object.assign(ctx.cache[key], data[key]);
219
+ Object.assign(ctx.mutations[key], data[key]);
220
+ }
221
+ }
222
+ },
223
+ isInTransaction,
224
+ transaction: async (work, key) => {
225
+ const existing = txStorage.getStore();
226
+ // Nested transaction - reuse existing context
227
+ if (existing) {
228
+ logger.trace("reusing existing transaction context");
229
+ return work();
230
+ }
231
+ // New transaction - acquire mutex and create context
232
+ return getTxMutex(key).runExclusive(async () => {
233
+ const ctx = {
234
+ cache: {},
235
+ mutations: {},
236
+ dbQueries: 0,
237
+ };
238
+ logger.trace("entering transaction");
239
+ try {
240
+ const result = await txStorage.run(ctx, work);
241
+ // Commit mutations
242
+ await commitWithRetry(ctx.mutations);
243
+ logger.trace({ dbQueries: ctx.dbQueries }, "transaction completed");
244
+ return result;
245
+ } catch (error) {
246
+ logger.error({ error }, "transaction failed, rolling back");
247
+ throw error;
248
+ }
249
+ });
250
+ },
251
+ };
252
+ };
253
+ export const initAuthCreds = () => {
254
+ const identityKey = Curve.generateKeyPair();
255
+ return {
256
+ noiseKey: Curve.generateKeyPair(),
257
+ pairingEphemeralKeyPair: Curve.generateKeyPair(),
258
+ signedIdentityKey: identityKey,
259
+ signedPreKey: signedKeyPair(identityKey, 1),
260
+ registrationId: generateRegistrationId(),
261
+ advSecretKey: randomBytes(32).toString("base64"),
262
+ processedHistoryMessages: [],
263
+ nextPreKeyId: 1,
264
+ firstUnuploadedPreKeyId: 1,
265
+ accountSyncCounter: 0,
266
+ accountSettings: {
267
+ unarchiveChats: false,
268
+ },
269
+ registered: false,
270
+ pairingCode: undefined,
271
+ lastPropHash: undefined,
272
+ routingInfo: undefined,
273
+ additionalData: undefined,
274
+ };
275
+ };
276
+ //# sourceMappingURL=auth-utils.js.map
@@ -0,0 +1,32 @@
1
+ import { platform, release } from "os";
2
+ import { proto } from "../../WAProto/index.js";
3
+ const PLATFORM_MAP = {
4
+ aix: "AIX",
5
+ darwin: "Mac OS",
6
+ win32: "Windows",
7
+ android: "Android",
8
+ freebsd: "FreeBSD",
9
+ openbsd: "OpenBSD",
10
+ sunos: "Solaris",
11
+ linux: undefined,
12
+ haiku: undefined,
13
+ cygwin: undefined,
14
+ netbsd: undefined,
15
+ };
16
+ export const Browsers = {
17
+ ubuntu: (browser) => ["Ubuntu", browser, "22.04.4"],
18
+ macOS: (browser) => ["Mac OS", browser, "14.4.1"],
19
+ baileys: (browser) => ["Baileys", browser, "6.5.0"],
20
+ windows: (browser) => ["Windows", browser, "10.0.22631"],
21
+ /** The appropriate browser based on your OS & release */
22
+ appropriate: (browser) => [
23
+ PLATFORM_MAP[platform()] || "Ubuntu",
24
+ browser,
25
+ release(),
26
+ ],
27
+ };
28
+ export const getPlatformId = (browser) => {
29
+ const platformType = proto.DeviceProps.PlatformType[browser.toUpperCase()];
30
+ return platformType ? platformType.toString() : "1"; //chrome
31
+ };
32
+ //# sourceMappingURL=browser-utils.js.map