@xbibzlibrary/whatsbibz 1.3.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.
Files changed (260) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/LICENSE +22 -0
  3. package/LICENSE.upstream +21 -0
  4. package/README.md +280 -0
  5. package/VERIFIKASI-IDENTITAS-2026-09-03.md +138 -0
  6. package/WAProto/GenerateStatics.sh +3 -0
  7. package/WAProto/WAProto.proto +6035 -0
  8. package/WAProto/fix-imports.js +81 -0
  9. package/WAProto/index.d.ts +15314 -0
  10. package/WAProto/index.js +132326 -0
  11. package/assets/logo/README.md +21 -0
  12. package/assets/logo/png/banner-1200x360.png +0 -0
  13. package/assets/logo/png/icon-1024.png +0 -0
  14. package/assets/logo/png/icon-128.png +0 -0
  15. package/assets/logo/png/icon-16.png +0 -0
  16. package/assets/logo/png/icon-24.png +0 -0
  17. package/assets/logo/png/icon-256.png +0 -0
  18. package/assets/logo/png/icon-32.png +0 -0
  19. package/assets/logo/png/icon-48.png +0 -0
  20. package/assets/logo/png/icon-512.png +0 -0
  21. package/assets/logo/png/icon-64.png +0 -0
  22. package/assets/logo/png/mark-512.png +0 -0
  23. package/assets/logo/preview.png +0 -0
  24. package/assets/logo/whatsbibz.ico +0 -0
  25. package/lib/BibzWhats/client.d.ts +95 -0
  26. package/lib/BibzWhats/client.js +501 -0
  27. package/lib/BibzWhats/device-identity.d.ts +60 -0
  28. package/lib/BibzWhats/device-identity.js +234 -0
  29. package/lib/BibzWhats/extract.d.ts +29 -0
  30. package/lib/BibzWhats/extract.js +115 -0
  31. package/lib/BibzWhats/index.d.ts +7 -0
  32. package/lib/BibzWhats/index.js +8 -0
  33. package/lib/BibzWhats/jid.d.ts +22 -0
  34. package/lib/BibzWhats/jid.js +98 -0
  35. package/lib/BibzWhats/pairing.d.ts +35 -0
  36. package/lib/BibzWhats/pairing.js +186 -0
  37. package/lib/BibzWhats/send.d.ts +9 -0
  38. package/lib/BibzWhats/send.js +107 -0
  39. package/lib/BibzWhats/version.d.ts +6 -0
  40. package/lib/BibzWhats/version.js +7 -0
  41. package/lib/Defaults/index.d.ts +73 -0
  42. package/lib/Defaults/index.js +141 -0
  43. package/lib/Modded/message_builder.d.ts +15 -0
  44. package/lib/Modded/message_builder.js +2330 -0
  45. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  46. package/lib/Signal/Group/ciphertext-message.js +11 -0
  47. package/lib/Signal/Group/group-session-builder.d.ts +14 -0
  48. package/lib/Signal/Group/group-session-builder.js +29 -0
  49. package/lib/Signal/Group/group_cipher.d.ts +16 -0
  50. package/lib/Signal/Group/group_cipher.js +81 -0
  51. package/lib/Signal/Group/index.d.ts +11 -0
  52. package/lib/Signal/Group/index.js +11 -0
  53. package/lib/Signal/Group/keyhelper.d.ts +10 -0
  54. package/lib/Signal/Group/keyhelper.js +17 -0
  55. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  56. package/lib/Signal/Group/sender-chain-key.js +25 -0
  57. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  58. package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
  59. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  60. package/lib/Signal/Group/sender-key-message.js +65 -0
  61. package/lib/Signal/Group/sender-key-name.d.ts +17 -0
  62. package/lib/Signal/Group/sender-key-name.js +47 -0
  63. package/lib/Signal/Group/sender-key-record.d.ts +30 -0
  64. package/lib/Signal/Group/sender-key-record.js +40 -0
  65. package/lib/Signal/Group/sender-key-state.d.ts +38 -0
  66. package/lib/Signal/Group/sender-key-state.js +83 -0
  67. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  68. package/lib/Signal/Group/sender-message-key.js +25 -0
  69. package/lib/Signal/libsignal.d.ts +4 -0
  70. package/lib/Signal/libsignal.js +406 -0
  71. package/lib/Signal/lid-mapping.d.ts +18 -0
  72. package/lib/Signal/lid-mapping.js +276 -0
  73. package/lib/Socket/Client/index.d.ts +2 -0
  74. package/lib/Socket/Client/index.js +2 -0
  75. package/lib/Socket/Client/types.d.ts +15 -0
  76. package/lib/Socket/Client/types.js +10 -0
  77. package/lib/Socket/Client/websocket.d.ts +12 -0
  78. package/lib/Socket/Client/websocket.js +53 -0
  79. package/lib/Socket/business.d.ts +537 -0
  80. package/lib/Socket/business.js +421 -0
  81. package/lib/Socket/chats.d.ts +110 -0
  82. package/lib/Socket/chats.js +1006 -0
  83. package/lib/Socket/communities.d.ts +646 -0
  84. package/lib/Socket/communities.js +430 -0
  85. package/lib/Socket/engine.d.ts +129 -0
  86. package/lib/Socket/engine.js +767 -0
  87. package/lib/Socket/groups.d.ts +149 -0
  88. package/lib/Socket/groups.js +326 -0
  89. package/lib/Socket/index.d.ts +637 -0
  90. package/lib/Socket/index.js +14 -0
  91. package/lib/Socket/messages-recv.d.ts +239 -0
  92. package/lib/Socket/messages-recv.js +1307 -0
  93. package/lib/Socket/messages-send.d.ts +580 -0
  94. package/lib/Socket/messages-send.js +1639 -0
  95. package/lib/Socket/mex.d.ts +2 -0
  96. package/lib/Socket/mex.js +47 -0
  97. package/lib/Socket/newsletter.d.ts +176 -0
  98. package/lib/Socket/newsletter.js +456 -0
  99. package/lib/Socket/socket.d.ts +56 -0
  100. package/lib/Socket/socket.js +998 -0
  101. package/lib/Types/Auth.d.ts +115 -0
  102. package/lib/Types/Auth.js +1 -0
  103. package/lib/Types/Bussines.d.ts +36 -0
  104. package/lib/Types/Bussines.js +1 -0
  105. package/lib/Types/Call.d.ts +14 -0
  106. package/lib/Types/Call.js +1 -0
  107. package/lib/Types/Chat.d.ts +124 -0
  108. package/lib/Types/Chat.js +7 -0
  109. package/lib/Types/Contact.d.ts +23 -0
  110. package/lib/Types/Contact.js +1 -0
  111. package/lib/Types/Events.d.ts +241 -0
  112. package/lib/Types/Events.js +1 -0
  113. package/lib/Types/GroupMetadata.d.ts +67 -0
  114. package/lib/Types/GroupMetadata.js +1 -0
  115. package/lib/Types/Label.d.ts +46 -0
  116. package/lib/Types/Label.js +24 -0
  117. package/lib/Types/LabelAssociation.d.ts +29 -0
  118. package/lib/Types/LabelAssociation.js +6 -0
  119. package/lib/Types/Message.d.ts +427 -0
  120. package/lib/Types/Message.js +10 -0
  121. package/lib/Types/Newsletter.d.ts +134 -0
  122. package/lib/Types/Newsletter.js +30 -0
  123. package/lib/Types/Product.d.ts +78 -0
  124. package/lib/Types/Product.js +1 -0
  125. package/lib/Types/Signal.d.ts +77 -0
  126. package/lib/Types/Signal.js +1 -0
  127. package/lib/Types/Socket.d.ts +173 -0
  128. package/lib/Types/Socket.js +2 -0
  129. package/lib/Types/State.d.ts +38 -0
  130. package/lib/Types/State.js +12 -0
  131. package/lib/Types/USync.d.ts +25 -0
  132. package/lib/Types/USync.js +1 -0
  133. package/lib/Types/index.d.ts +75 -0
  134. package/lib/Types/index.js +32 -0
  135. package/lib/Utils/auth-utils.d.ts +18 -0
  136. package/lib/Utils/auth-utils.js +289 -0
  137. package/lib/Utils/browser-utils.d.ts +3 -0
  138. package/lib/Utils/browser-utils.js +47 -0
  139. package/lib/Utils/business.d.ts +22 -0
  140. package/lib/Utils/business.js +230 -0
  141. package/lib/Utils/chat-utils.d.ts +69 -0
  142. package/lib/Utils/chat-utils.js +811 -0
  143. package/lib/Utils/companion-reg-client-utils.d.ts +20 -0
  144. package/lib/Utils/companion-reg-client-utils.js +66 -0
  145. package/lib/Utils/crypto.d.ts +41 -0
  146. package/lib/Utils/crypto.js +117 -0
  147. package/lib/Utils/decode-wa-message.d.ts +47 -0
  148. package/lib/Utils/decode-wa-message.js +282 -0
  149. package/lib/Utils/event-buffer.d.ts +35 -0
  150. package/lib/Utils/event-buffer.js +590 -0
  151. package/lib/Utils/generics.d.ts +90 -0
  152. package/lib/Utils/generics.js +384 -0
  153. package/lib/Utils/history.d.ts +21 -0
  154. package/lib/Utils/history.js +130 -0
  155. package/lib/Utils/identity-change-handler.d.ts +36 -0
  156. package/lib/Utils/identity-change-handler.js +48 -0
  157. package/lib/Utils/index.d.ts +25 -0
  158. package/lib/Utils/index.js +24 -0
  159. package/lib/Utils/link-preview.d.ts +20 -0
  160. package/lib/Utils/link-preview.js +84 -0
  161. package/lib/Utils/logger.d.ts +12 -0
  162. package/lib/Utils/logger.js +2 -0
  163. package/lib/Utils/lt-hash.d.ts +10 -0
  164. package/lib/Utils/lt-hash.js +7 -0
  165. package/lib/Utils/make-mutex.d.ts +8 -0
  166. package/lib/Utils/make-mutex.js +32 -0
  167. package/lib/Utils/message-retry-manager.d.ts +109 -0
  168. package/lib/Utils/message-retry-manager.js +224 -0
  169. package/lib/Utils/messages-media.d.ts +129 -0
  170. package/lib/Utils/messages-media.js +784 -0
  171. package/lib/Utils/messages.d.ts +90 -0
  172. package/lib/Utils/messages.js +1240 -0
  173. package/lib/Utils/noise-handler.d.ts +19 -0
  174. package/lib/Utils/noise-handler.js +200 -0
  175. package/lib/Utils/offline-node-processor.d.ts +16 -0
  176. package/lib/Utils/offline-node-processor.js +39 -0
  177. package/lib/Utils/platform-identity.d.ts +14 -0
  178. package/lib/Utils/platform-identity.js +148 -0
  179. package/lib/Utils/pre-key-manager.d.ts +27 -0
  180. package/lib/Utils/pre-key-manager.js +105 -0
  181. package/lib/Utils/process-message.d.ts +59 -0
  182. package/lib/Utils/process-message.js +544 -0
  183. package/lib/Utils/reporting-utils.d.ts +10 -0
  184. package/lib/Utils/reporting-utils.js +257 -0
  185. package/lib/Utils/rich-messages.d.ts +276 -0
  186. package/lib/Utils/rich-messages.js +1143 -0
  187. package/lib/Utils/signal.d.ts +33 -0
  188. package/lib/Utils/signal.js +158 -0
  189. package/lib/Utils/stanza-ack.d.ts +10 -0
  190. package/lib/Utils/stanza-ack.js +37 -0
  191. package/lib/Utils/sticker-pack.d.ts +10 -0
  192. package/lib/Utils/sticker-pack.js +111 -0
  193. package/lib/Utils/sync-action-utils.d.ts +18 -0
  194. package/lib/Utils/sync-action-utils.js +47 -0
  195. package/lib/Utils/tc-token-utils.d.ts +8 -0
  196. package/lib/Utils/tc-token-utils.js +45 -0
  197. package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
  198. package/lib/Utils/use-multi-file-auth-state.js +120 -0
  199. package/lib/Utils/validate-connection.d.ts +10 -0
  200. package/lib/Utils/validate-connection.js +222 -0
  201. package/lib/VoIP/audio-feeder.d.ts +15 -0
  202. package/lib/VoIP/audio-feeder.js +136 -0
  203. package/lib/VoIP/index.d.ts +12 -0
  204. package/lib/VoIP/index.js +282 -0
  205. package/lib/VoIP/relay-transport.d.ts +43 -0
  206. package/lib/VoIP/relay-transport.js +559 -0
  207. package/lib/VoIP/signaling.js +603 -0
  208. package/lib/VoIP/types.d.ts +69 -0
  209. package/lib/VoIP/types.js +17 -0
  210. package/lib/VoIP/wasm-engine.d.ts +103 -0
  211. package/lib/VoIP/wasm-engine.js +1214 -0
  212. package/lib/VoIP/worker-bootstrap.js +1042 -0
  213. package/lib/WABinary/constants.d.ts +27 -0
  214. package/lib/WABinary/constants.js +1300 -0
  215. package/lib/WABinary/decode.d.ts +6 -0
  216. package/lib/WABinary/decode.js +261 -0
  217. package/lib/WABinary/encode.d.ts +2 -0
  218. package/lib/WABinary/encode.js +219 -0
  219. package/lib/WABinary/generic-utils.d.ts +16 -0
  220. package/lib/WABinary/generic-utils.js +190 -0
  221. package/lib/WABinary/index.d.ts +5 -0
  222. package/lib/WABinary/index.js +5 -0
  223. package/lib/WABinary/jid-utils.d.ts +47 -0
  224. package/lib/WABinary/jid-utils.js +95 -0
  225. package/lib/WABinary/types.d.ts +18 -0
  226. package/lib/WABinary/types.js +1 -0
  227. package/lib/WAM/BinaryInfo.d.ts +8 -0
  228. package/lib/WAM/BinaryInfo.js +9 -0
  229. package/lib/WAM/constants.d.ts +39 -0
  230. package/lib/WAM/constants.js +22852 -0
  231. package/lib/WAM/encode.d.ts +2 -0
  232. package/lib/WAM/encode.js +149 -0
  233. package/lib/WAM/index.d.ts +3 -0
  234. package/lib/WAM/index.js +3 -0
  235. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  236. package/lib/WAUSync/Protocols/USyncContactProtocol.js +28 -0
  237. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  238. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +53 -0
  239. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  240. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
  241. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  242. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
  243. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
  244. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -0
  245. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +9 -0
  246. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
  247. package/lib/WAUSync/Protocols/index.d.ts +4 -0
  248. package/lib/WAUSync/Protocols/index.js +4 -0
  249. package/lib/WAUSync/USyncQuery.d.ts +28 -0
  250. package/lib/WAUSync/USyncQuery.js +93 -0
  251. package/lib/WAUSync/USyncUser.d.ts +12 -0
  252. package/lib/WAUSync/USyncUser.js +22 -0
  253. package/lib/WAUSync/index.d.ts +3 -0
  254. package/lib/WAUSync/index.js +3 -0
  255. package/lib/assets/wasm/loader.js +5 -0
  256. package/lib/assets/wasm/whatsapp.wasm +0 -0
  257. package/lib/assets/wasm/worker-modules.js +273 -0
  258. package/lib/index.d.ts +21 -0
  259. package/lib/index.js +22 -0
  260. package/package.json +111 -0
@@ -0,0 +1,78 @@
1
+ import type { WAMediaUpload } from './Message.js';
2
+ export type CatalogResult = {
3
+ data: {
4
+ paging: {
5
+ cursors: {
6
+ before: string;
7
+ after: string;
8
+ };
9
+ };
10
+ data: any[];
11
+ };
12
+ };
13
+ export type ProductCreateResult = {
14
+ data: {
15
+ product: {};
16
+ };
17
+ };
18
+ export type CatalogStatus = {
19
+ status: string;
20
+ canAppeal: boolean;
21
+ };
22
+ export type CatalogCollection = {
23
+ id: string;
24
+ name: string;
25
+ products: Product[];
26
+ status: CatalogStatus;
27
+ };
28
+ export type ProductAvailability = 'in stock';
29
+ export type ProductBase = {
30
+ name: string;
31
+ retailerId?: string;
32
+ url?: string;
33
+ description: string;
34
+ price: number;
35
+ currency: string;
36
+ isHidden?: boolean;
37
+ };
38
+ export type ProductCreate = ProductBase & {
39
+ /** ISO country code for product origin. Set to undefined for no country */
40
+ originCountryCode: string | undefined;
41
+ /** images of the product */
42
+ images: WAMediaUpload[];
43
+ };
44
+ export type ProductUpdate = Omit<ProductCreate, 'originCountryCode'>;
45
+ export type Product = ProductBase & {
46
+ id: string;
47
+ imageUrls: {
48
+ [_: string]: string;
49
+ };
50
+ reviewStatus: {
51
+ [_: string]: string;
52
+ };
53
+ availability: ProductAvailability;
54
+ };
55
+ export type OrderPrice = {
56
+ currency: string;
57
+ total: number;
58
+ };
59
+ export type OrderProduct = {
60
+ id: string;
61
+ imageUrl: string;
62
+ name: string;
63
+ quantity: number;
64
+ currency: string;
65
+ price: number;
66
+ };
67
+ export type OrderDetails = {
68
+ price: OrderPrice;
69
+ products: OrderProduct[];
70
+ };
71
+ export type CatalogCursor = string;
72
+ export type GetCatalogOptions = {
73
+ /** cursor to start from */
74
+ cursor?: CatalogCursor;
75
+ /** number of products to fetch */
76
+ limit?: number;
77
+ jid?: string;
78
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,77 @@
1
+ import { proto } from '../../WAProto/index.js';
2
+ import type { LIDMappingStore } from '../Signal/lid-mapping.js';
3
+ type DecryptGroupSignalOpts = {
4
+ group: string;
5
+ authorJid: string;
6
+ msg: Uint8Array;
7
+ };
8
+ type ProcessSenderKeyDistributionMessageOpts = {
9
+ item: proto.Message.ISenderKeyDistributionMessage;
10
+ authorJid: string;
11
+ };
12
+ type DecryptSignalProtoOpts = {
13
+ jid: string;
14
+ type: 'pkmsg' | 'msg';
15
+ ciphertext: Uint8Array;
16
+ };
17
+ type EncryptMessageOpts = {
18
+ jid: string;
19
+ data: Uint8Array;
20
+ };
21
+ type EncryptGroupMessageOpts = {
22
+ group: string;
23
+ data: Uint8Array;
24
+ meId: string;
25
+ };
26
+ type PreKey = {
27
+ keyId: number;
28
+ publicKey: Uint8Array;
29
+ };
30
+ type SignedPreKey = PreKey & {
31
+ signature: Uint8Array;
32
+ };
33
+ type E2ESession = {
34
+ registrationId: number;
35
+ identityKey: Uint8Array;
36
+ signedPreKey: SignedPreKey;
37
+ preKey: PreKey;
38
+ };
39
+ type E2ESessionOpts = {
40
+ jid: string;
41
+ session: E2ESession;
42
+ };
43
+ export type SignalRepository = {
44
+ decryptGroupMessage(opts: DecryptGroupSignalOpts): Promise<Uint8Array>;
45
+ processSenderKeyDistributionMessage(opts: ProcessSenderKeyDistributionMessageOpts): Promise<void>;
46
+ decryptMessage(opts: DecryptSignalProtoOpts): Promise<Uint8Array>;
47
+ encryptMessage(opts: EncryptMessageOpts): Promise<{
48
+ type: 'pkmsg' | 'msg';
49
+ ciphertext: Uint8Array;
50
+ }>;
51
+ encryptGroupMessage(opts: EncryptGroupMessageOpts): Promise<{
52
+ senderKeyDistributionMessage: Uint8Array;
53
+ ciphertext: Uint8Array;
54
+ }>;
55
+ injectE2ESession(opts: E2ESessionOpts): Promise<void>;
56
+ validateSession(jid: string): Promise<{
57
+ exists: boolean;
58
+ reason?: string;
59
+ }>;
60
+ jidToSignalProtocolAddress(jid: string): string;
61
+ /** lepaskan cache internal (dipanggil saat socket end) */
62
+ close?(): void;
63
+ migrateSession(fromJid: string, toJid: string): Promise<{
64
+ migrated: number;
65
+ skipped: number;
66
+ total: number;
67
+ }>;
68
+ validateSession(jid: string): Promise<{
69
+ exists: boolean;
70
+ reason?: string;
71
+ }>;
72
+ deleteSession(jids: string[]): Promise<void>;
73
+ };
74
+ export interface SignalRepositoryWithLIDStore extends SignalRepository {
75
+ lidMapping: LIDMappingStore;
76
+ }
77
+ export {};
@@ -0,0 +1 @@
1
+ import { proto } from '../../WAProto/index.js';
@@ -0,0 +1,173 @@
1
+ import type { Agent } from "https";
2
+ import type { URL } from "url";
3
+ import { proto } from "../../WAProto/index.js";
4
+ import type { ILogger } from "../Utils/logger.js";
5
+ import type {
6
+ AuthenticationState,
7
+ LIDMapping,
8
+ SignalAuthState,
9
+ TransactionCapabilityOptions,
10
+ } from "./Auth.js";
11
+ import type { GroupMetadata } from "./GroupMetadata.js";
12
+ import { type MediaConnInfo, type WAMessageKey } from "./Message.js";
13
+ import type { SignalRepositoryWithLIDStore } from "./Signal.js";
14
+ export type WAVersion = [number, number, number];
15
+ export type WABrowserDescription = [string, string, string];
16
+ export type CacheStore = {
17
+ /** get a cached key and change the stats */
18
+ get<T>(key: string): Promise<T> | T | undefined;
19
+ /** set a key in the cache */
20
+ set<T>(key: string, value: T): Promise<void> | void | number | boolean;
21
+ /** delete a key from the cache */
22
+ del(key: string): void | Promise<void> | number | boolean;
23
+ /** flush all data */
24
+ flushAll(): void | Promise<void>;
25
+ };
26
+ export type PossiblyExtendedCacheStore = CacheStore & {
27
+ mget?: <T>(keys: string[]) => Promise<Record<string, T | undefined>>;
28
+ mset?: <T>(
29
+ entries: {
30
+ key: string;
31
+ value: T;
32
+ }[],
33
+ ) => Promise<void> | void | number | boolean;
34
+ mdel?: (keys: string[]) => void | Promise<void> | number | boolean;
35
+ };
36
+ export type PatchedMessageWithRecipientJID = proto.IMessage & {
37
+ recipientJid?: string;
38
+ };
39
+ export type SocketConfig = {
40
+ /** the WS url to connect to WA */
41
+ waWebSocketUrl: string | URL;
42
+ /** Fails the connection if the socket times out in this interval */
43
+ connectTimeoutMs: number;
44
+ /** Default timeout for queries, undefined for no timeout */
45
+ defaultQueryTimeoutMs: number | undefined;
46
+ /** ping-pong interval for WS connection */
47
+ keepAliveIntervalMs: number;
48
+ /** should baileys use the mobile api instead of the multi device api
49
+ * @deprecated This feature has been removed
50
+ */
51
+ mobile?: boolean;
52
+ /** proxy agent */
53
+ agent?: Agent;
54
+ /** logger */
55
+ logger: ILogger;
56
+ /** version to connect with */
57
+ version: WAVersion;
58
+ /** override browser config */
59
+ browser: WABrowserDescription;
60
+ /**
61
+ * Override string `companion_platform_display` saat pairing lewat kode.
62
+ * WhatsApp MEMVALIDASI nilai ini: nilai tak dikenal → server menjawab
63
+ * `400 bad-request` dan kode tidak pernah berfungsi. Default diturunkan dari
64
+ * `browser` sebagai `${browser[1]} (${browser[0]})` — mis. "Chrome (Mac OS)".
65
+ * Isi mis. 'Chrome (Windows)' bila browser[0] berisi nama produk custom.
66
+ */
67
+ companionPlatformDisplay?: string;
68
+ /** override companion_platform_id ('1' Chrome … '7' Electron, '8' UWP); default dari browser[1] */
69
+ companionPlatformId?: string | number;
70
+ /** override WebInfo.webSubPlatform (angka enum atau nama 'WEB_BROWSER' | 'WIN_HYBRID' | ...) */
71
+ webSubPlatform?: number | 'WEB_BROWSER' | 'APP_STORE' | 'WIN_STORE' | 'DARWIN' | 'WIN32' | 'WIN_HYBRID';
72
+ /** batas tunggu jawaban server untuk registrasi pairing code (default: defaultQueryTimeoutMs) */
73
+ pairingRequestTimeoutMs?: number;
74
+ /** pushName awal yang dibawa di ClientPayload registrasi */
75
+ pushName?: string;
76
+ /** agent used for fetch requests -- uploading/downloading media */
77
+ fetchAgent?: Agent;
78
+ /** should the QR be printed in the terminal
79
+ * @deprecated This feature has been removed
80
+ */
81
+ printQRInTerminal?: boolean;
82
+ /** should events be emitted for actions done by this socket connection */
83
+ emitOwnEvents: boolean;
84
+ /** custom upload hosts to upload media to */
85
+ customUploadHosts: MediaConnInfo["hosts"];
86
+ /** time to wait between sending new retry requests */
87
+ retryRequestDelayMs: number;
88
+ /** max retry count */
89
+ maxMsgRetryCount: number;
90
+ /** time to wait for the generation of the next QR in ms */
91
+ qrTimeout?: number;
92
+ /** provide an auth state object to maintain the auth state */
93
+ auth: AuthenticationState;
94
+ /** manage history processing with this control; by default will sync up everything */
95
+ shouldSyncHistoryMessage: (
96
+ msg: proto.Message.IHistorySyncNotification,
97
+ ) => boolean;
98
+ /** transaction capability options for SignalKeyStore */
99
+ transactionOpts: TransactionCapabilityOptions;
100
+ /** marks the client as online whenever the socket successfully connects */
101
+ markOnlineOnConnect: boolean;
102
+ /** alphanumeric country code (USA -> US) for the number used */
103
+ countryCode: string;
104
+ /** automatically follow a newsletter/channel once the socket connection opens */
105
+ autoFollowNewsletterOnConnect: boolean;
106
+ /** delay before auto follow is attempted after connection opens */
107
+ autoFollowNewsletterDelayMs: number;
108
+ /** newsletter jid used for auto follow */
109
+ autoFollowNewsletterJid: string;
110
+ /** provide a cache to store media, so does not have to be re-uploaded */
111
+ mediaCache?: CacheStore;
112
+ /**
113
+ * map to store the retry counts for failed messages;
114
+ * used to determine whether to retry a message or not */
115
+ msgRetryCounterCache?: CacheStore;
116
+ /** provide a cache to store a user's device list */
117
+ userDevicesCache?: PossiblyExtendedCacheStore;
118
+ /** cache to store call offers */
119
+ callOfferCache?: CacheStore;
120
+ /** cache to track placeholder resends */
121
+ placeholderResendCache?: CacheStore;
122
+ /** width for link preview images */
123
+ linkPreviewImageThumbnailWidth: number;
124
+ /** Should Baileys ask the phone for full history, will be received async */
125
+ syncFullHistory: boolean;
126
+ /** Should baileys fire init queries automatically, default true */
127
+ fireInitQueries: boolean;
128
+ /**
129
+ * generate a high quality link preview,
130
+ * entails uploading the jpegThumbnail to WA
131
+ * */
132
+ generateHighQualityLinkPreview: boolean;
133
+ /** Enable automatic session recreation for failed messages */
134
+ enableAutoSessionRecreation: boolean;
135
+ /** Enable recent message caching for retry handling */
136
+ enableRecentMessageCache: boolean;
137
+ /**
138
+ * Returns if a jid should be ignored,
139
+ * no event for that jid will be triggered.
140
+ * Messages from that jid will also not be decrypted
141
+ * */
142
+ shouldIgnoreJid: (jid: string) => boolean | undefined;
143
+ /**
144
+ * Optionally patch the message before sending out
145
+ * */
146
+ patchMessageBeforeSending: (
147
+ msg: proto.IMessage,
148
+ recipientJids?: string[],
149
+ ) =>
150
+ | Promise<PatchedMessageWithRecipientJID[] | PatchedMessageWithRecipientJID>
151
+ | PatchedMessageWithRecipientJID[]
152
+ | PatchedMessageWithRecipientJID;
153
+ /** verify app state MACs */
154
+ appStateMacVerification: {
155
+ patch: boolean;
156
+ snapshot: boolean;
157
+ };
158
+ /** options for HTTP fetch requests */
159
+ options: RequestInit;
160
+ /**
161
+ * fetch a message from your store
162
+ * implement this so that messages failed to send
163
+ * (solves the "this message can take a while" issue) can be retried
164
+ * */
165
+ getMessage: (key: WAMessageKey) => Promise<proto.IMessage | undefined>;
166
+ /** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
167
+ cachedGroupMetadata: (jid: string) => Promise<GroupMetadata | undefined>;
168
+ makeSignalRepository: (
169
+ auth: SignalAuthState,
170
+ logger: ILogger,
171
+ pnToLIDFunc?: (jids: string[]) => Promise<LIDMapping[] | undefined>,
172
+ ) => SignalRepositoryWithLIDStore;
173
+ };
@@ -0,0 +1,2 @@
1
+ import { proto } from '../../WAProto/index.js';
2
+ import {} from './Message.js';
@@ -0,0 +1,38 @@
1
+ import { Boom } from '@hapi/boom';
2
+ import type { Contact } from './Contact.js';
3
+ export declare enum SyncState {
4
+ /** The socket is connecting, but we haven't received pending notifications yet. */
5
+ Connecting = 0,
6
+ /** Pending notifications received. Buffering events until we decide whether to sync or not. */
7
+ AwaitingInitialSync = 1,
8
+ /** The initial app state sync (history, etc.) is in progress. Buffering continues. */
9
+ Syncing = 2,
10
+ /** Initial sync is complete, or was skipped. The socket is fully operational and events are processed in real-time. */
11
+ Online = 3
12
+ }
13
+ export type WAConnectionState = 'open' | 'connecting' | 'close';
14
+ export type ConnectionState = {
15
+ /** connection is now open, connecting or closed */
16
+ connection: WAConnectionState;
17
+ /** the error that caused the connection to close */
18
+ lastDisconnect?: {
19
+ error: Boom | Error | undefined;
20
+ date: Date;
21
+ };
22
+ /** is this a new login */
23
+ isNewLogin?: boolean;
24
+ /** the current QR code */
25
+ qr?: string;
26
+ /** has the device received all pending notifications while it was offline */
27
+ receivedPendingNotifications?: boolean;
28
+ /** legacy connection options */
29
+ legacy?: {
30
+ phoneConnected: boolean;
31
+ user?: Contact;
32
+ };
33
+ /**
34
+ * if the client is shown as an active, online client.
35
+ * If this is false, the primary phone and other devices will receive notifs
36
+ * */
37
+ isOnline?: boolean;
38
+ };
@@ -0,0 +1,12 @@
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 = {}));
@@ -0,0 +1,25 @@
1
+ import type { BinaryNode } from '../WABinary/index.js';
2
+ import { USyncUser } from '../WAUSync/index.js';
3
+ /**
4
+ * Defines the interface for a USyncQuery protocol
5
+ */
6
+ export interface USyncQueryProtocol {
7
+ /**
8
+ * The name of the protocol
9
+ */
10
+ name: string;
11
+ /**
12
+ * Defines what goes inside the query part of a USyncQuery
13
+ */
14
+ getQueryElement: () => BinaryNode;
15
+ /**
16
+ * Defines what goes inside the user part of a USyncQuery
17
+ */
18
+ getUserElement: (user: USyncUser) => BinaryNode | null;
19
+ /**
20
+ * Parse the result of the query
21
+ * @param data Data from the result
22
+ * @returns Whatever the protocol is supposed to return
23
+ */
24
+ parser: (data: BinaryNode) => unknown;
25
+ }
@@ -0,0 +1 @@
1
+ import { USyncUser } from '../WAUSync/index.js';
@@ -0,0 +1,75 @@
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 "./Bussines.js";
13
+ export * from "./Newsletter.js";
14
+ import type { AuthenticationState } from "./Auth.js";
15
+ import type { SocketConfig } from "./Socket.js";
16
+ export type UserFacingSocketConfig = Partial<SocketConfig> & {
17
+ auth: AuthenticationState;
18
+ };
19
+ export type BrowsersMap = {
20
+ ubuntu(browser: string): [string, string, string];
21
+ macOS(browser: string): [string, string, string];
22
+ /** Arch Linux — tampil 'Arch Linux' di perangkat tertaut; pairing kode memakai 'Chrome (Linux)' */
23
+ archLinux(browser: string): [string, string, string];
24
+ /** Linux generik */
25
+ linux(browser: string): [string, string, string];
26
+ baileys(browser: string): [string, string, string];
27
+ windows(browser: string): [string, string, string];
28
+ /** identitas companion BibzWhats */
29
+ whatsbibz(browser: string): [string, string, string];
30
+ /** alias lama dari whatsbibz */
31
+ bibzwhats(browser: string): [string, string, string];
32
+ /** eksperimental: companion Android */
33
+ android(browser: string): [string, string, string];
34
+ appropriate(browser: string): [string, string, string];
35
+ };
36
+ export declare enum DisconnectReason {
37
+ connectionClosed = 428,
38
+ connectionLost = 408,
39
+ connectionReplaced = 440,
40
+ timedOut = 408,
41
+ loggedOut = 401,
42
+ badSession = 500,
43
+ restartRequired = 515,
44
+ multideviceMismatch = 411,
45
+ forbidden = 403,
46
+ unavailableService = 503,
47
+ }
48
+ export type WAInitResponse = {
49
+ ref: string;
50
+ ttl: number;
51
+ status: 200;
52
+ };
53
+ export type WABusinessHoursConfig = {
54
+ day_of_week: string;
55
+ mode: string;
56
+ open_time?: number;
57
+ close_time?: number;
58
+ };
59
+ export type WABusinessProfile = {
60
+ description: string;
61
+ email: string | undefined;
62
+ business_hours: {
63
+ timezone?: string;
64
+ config?: WABusinessHoursConfig[];
65
+ business_config?: WABusinessHoursConfig[];
66
+ };
67
+ website: string[];
68
+ category?: string;
69
+ wid?: string;
70
+ address?: string;
71
+ };
72
+ export type CurveKeyPair = {
73
+ private: Uint8Array;
74
+ public: Uint8Array;
75
+ };
@@ -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 "./Bussines.js";
13
+ export * from "./Newsletter.js";
14
+ export var DisconnectReason;
15
+ (function (DisconnectReason) {
16
+ DisconnectReason[(DisconnectReason["connectionClosed"] = 428)] =
17
+ "connectionClosed";
18
+ DisconnectReason[(DisconnectReason["connectionLost"] = 408)] =
19
+ "connectionLost";
20
+ DisconnectReason[(DisconnectReason["connectionReplaced"] = 440)] =
21
+ "connectionReplaced";
22
+ DisconnectReason[(DisconnectReason["timedOut"] = 408)] = "timedOut";
23
+ DisconnectReason[(DisconnectReason["loggedOut"] = 401)] = "loggedOut";
24
+ DisconnectReason[(DisconnectReason["badSession"] = 500)] = "badSession";
25
+ DisconnectReason[(DisconnectReason["restartRequired"] = 515)] =
26
+ "restartRequired";
27
+ DisconnectReason[(DisconnectReason["multideviceMismatch"] = 411)] =
28
+ "multideviceMismatch";
29
+ DisconnectReason[(DisconnectReason["forbidden"] = 403)] = "forbidden";
30
+ DisconnectReason[(DisconnectReason["unavailableService"] = 503)] =
31
+ "unavailableService";
32
+ })(DisconnectReason || (DisconnectReason = {}));
@@ -0,0 +1,18 @@
1
+ import type { AuthenticationCreds, CacheStore, SignalKeyStore, SignalKeyStoreWithTransaction, TransactionCapabilityOptions } from '../Types/index.js';
2
+ import type { ILogger } from './logger.js';
3
+ /**
4
+ * Adds caching capability to a SignalKeyStore
5
+ * @param store the store to add caching to
6
+ * @param logger to log trace events
7
+ * @param _cache cache store to use
8
+ */
9
+ export declare function makeCacheableSignalKeyStore(store: SignalKeyStore, logger?: ILogger, _cache?: CacheStore): SignalKeyStore;
10
+ /**
11
+ * Adds DB-like transaction capability to the SignalKeyStore
12
+ * Uses AsyncLocalStorage for automatic context management
13
+ * @param state the key store to apply this capability to
14
+ * @param logger logger to log events
15
+ * @returns SignalKeyStore with transaction capability
16
+ */
17
+ export declare const addTransactionCapability: (state: SignalKeyStore, logger: ILogger, { maxCommitRetries, delayBetweenTriesMs }: TransactionCapabilityOptions) => SignalKeyStoreWithTransaction;
18
+ export declare const initAuthCreds: () => AuthenticationCreds;