sanka-baileyss 2.3.2 → 2.3.3

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 (158) hide show
  1. package/WAProto/BotMetadata/BotMetadata.d.ts +594 -1
  2. package/WAProto/BotMetadata/BotMetadata.js +1910 -148
  3. package/WAProto/BotMetadata/BotMetadata.proto +36 -0
  4. package/WAProto/E2E/E2E.d.ts +570 -6
  5. package/WAProto/E2E/E2E.js +1591 -26
  6. package/WAProto/E2E/E2E.proto +10 -1
  7. package/WAProto/HistorySync/HistorySync.d.ts +806 -6
  8. package/WAProto/HistorySync/HistorySync.js +2193 -29
  9. package/WAProto/HistorySync/HistorySync.proto +2 -1
  10. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +570 -6
  11. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.js +1591 -26
  12. package/WAProto/StatusAttributions/StatusAttributions.d.ts +2 -1
  13. package/WAProto/StatusAttributions/StatusAttributions.js +7 -0
  14. package/WAProto/StatusAttributions/StatusAttributions.proto +1 -0
  15. package/WAProto/SyncAction/SyncAction.d.ts +230 -0
  16. package/WAProto/SyncAction/SyncAction.js +578 -2
  17. package/WAProto/SyncAction/SyncAction.proto +13 -1
  18. package/WAProto/Web/Web.d.ts +570 -6
  19. package/WAProto/Web/Web.js +1591 -26
  20. package/lib/Defaults/baileys-version.json +2 -2
  21. package/lib/Defaults/index.d.ts +42 -25
  22. package/lib/Defaults/index.js +6 -2
  23. package/lib/Signal/libsignal.d.ts +1 -0
  24. package/lib/Socket/Client/index.js +13 -9
  25. package/lib/Socket/Client/types.d.ts +11 -10
  26. package/lib/Socket/Client/types.js +11 -7
  27. package/lib/Socket/Client/websocket.d.ts +9 -8
  28. package/lib/Socket/Client/websocket.js +52 -47
  29. package/lib/Socket/business.d.ts +185 -182
  30. package/lib/Socket/business.js +258 -249
  31. package/lib/Socket/chats.d.ts +90 -87
  32. package/lib/Socket/chats.js +1095 -888
  33. package/lib/Socket/community.d.ts +131 -0
  34. package/lib/Socket/community.js +369 -0
  35. package/lib/Socket/groups.d.ts +50 -41
  36. package/lib/Socket/groups.js +10 -3
  37. package/lib/Socket/index.d.ts +5 -1
  38. package/lib/Socket/index.js +19 -5
  39. package/lib/Socket/messages-recv.d.ts +6 -2
  40. package/lib/Socket/messages-recv.js +31 -8
  41. package/lib/Socket/messages-send.d.ts +5 -1
  42. package/lib/Socket/messages-send.js +1293 -1351
  43. package/lib/Socket/newsletter.d.ts +142 -135
  44. package/lib/Socket/newsletter.js +274 -230
  45. package/lib/Socket/socket.d.ts +37 -35
  46. package/lib/Socket/usync.d.ts +31 -30
  47. package/lib/Socket/usync.js +74 -62
  48. package/lib/Types/Auth.d.ts +89 -72
  49. package/lib/Types/Auth.js +1 -0
  50. package/lib/Types/Call.d.ts +11 -10
  51. package/lib/Types/Call.js +1 -0
  52. package/lib/Types/Chat.d.ts +85 -62
  53. package/lib/Types/Chat.js +4 -1
  54. package/lib/Types/Contact.js +1 -0
  55. package/lib/Types/Events.d.ts +209 -191
  56. package/lib/Types/Events.js +1 -0
  57. package/lib/Types/GroupMetadata.d.ts +12 -27
  58. package/lib/Types/GroupMetadata.js +1 -0
  59. package/lib/Types/Label.d.ts +41 -39
  60. package/lib/Types/Label.js +24 -21
  61. package/lib/Types/LabelAssociation.d.ts +18 -12
  62. package/lib/Types/LabelAssociation.js +6 -3
  63. package/lib/Types/Message.d.ts +3 -2
  64. package/lib/Types/Message.js +7 -3
  65. package/lib/Types/MexUpdates.d.ts +9 -0
  66. package/lib/Types/MexUpdates.js +18 -0
  67. package/lib/Types/Newsletter.d.ts +84 -67
  68. package/lib/Types/Newsletter.js +30 -23
  69. package/lib/Types/Product.d.ts +70 -56
  70. package/lib/Types/Product.js +1 -0
  71. package/lib/Types/Signal.d.ts +46 -35
  72. package/lib/Types/Signal.js +1 -0
  73. package/lib/Types/Socket.d.ts +105 -101
  74. package/lib/Types/Socket.js +1 -0
  75. package/lib/Types/State.d.ts +37 -23
  76. package/lib/Types/State.js +13 -1
  77. package/lib/Types/USync.d.ts +21 -20
  78. package/lib/Types/USync.js +1 -0
  79. package/lib/Types/index.d.ts +51 -42
  80. package/lib/Types/index.js +25 -19
  81. package/lib/Utils/auth-utils.d.ts +14 -11
  82. package/lib/Utils/auth-utils.js +189 -182
  83. package/lib/Utils/baileys-event-stream.d.ts +12 -10
  84. package/lib/Utils/baileys-event-stream.js +52 -46
  85. package/lib/Utils/business.d.ts +15 -8
  86. package/lib/Utils/business.js +229 -217
  87. package/lib/Utils/chat-utils.d.ts +22 -12
  88. package/lib/Utils/chat-utils.js +57 -27
  89. package/lib/Utils/crypto.d.ts +31 -15
  90. package/lib/Utils/crypto.js +136 -107
  91. package/lib/Utils/decode-wa-message.d.ts +34 -245
  92. package/lib/Utils/decode-wa-message.js +205 -217
  93. package/lib/Utils/event-buffer.d.ts +30 -26
  94. package/lib/Utils/event-buffer.js +519 -515
  95. package/lib/Utils/history.d.ts +2 -8
  96. package/lib/Utils/index.js +13 -9
  97. package/lib/Utils/link-preview.d.ts +16 -14
  98. package/lib/Utils/link-preview.js +100 -92
  99. package/lib/Utils/logger.d.ts +9 -7
  100. package/lib/Utils/logger.js +1 -1
  101. package/lib/Utils/lt-hash.d.ts +10 -8
  102. package/lib/Utils/lt-hash.js +49 -44
  103. package/lib/Utils/make-mutex.d.ts +4 -2
  104. package/lib/Utils/make-mutex.js +43 -39
  105. package/lib/Utils/messages-media.d.ts +75 -50
  106. package/lib/Utils/messages.d.ts +60 -35
  107. package/lib/Utils/messages.js +87 -8
  108. package/lib/Utils/noise-handler.d.ts +13 -12
  109. package/lib/Utils/noise-handler.js +143 -138
  110. package/lib/Utils/process-message.d.ts +32 -24
  111. package/lib/Utils/process-message.js +387 -367
  112. package/lib/Utils/signal.d.ts +24 -15
  113. package/lib/Utils/signal.js +143 -131
  114. package/lib/Utils/use-mongo-file-auth-state.d.ts +3 -2
  115. package/lib/Utils/use-mongo-file-auth-state.js +72 -63
  116. package/lib/Utils/use-multi-file-auth-state.d.ts +9 -8
  117. package/lib/Utils/use-multi-file-auth-state.js +110 -102
  118. package/lib/Utils/use-single-file-auth-state.d.ts +8 -7
  119. package/lib/Utils/use-single-file-auth-state.js +66 -61
  120. package/lib/Utils/validate-connection.d.ts +5 -2
  121. package/lib/Utils/validate-connection.js +7 -6
  122. package/lib/WABinary/constants.d.ts +24 -21
  123. package/lib/WABinary/constants.js +1302 -31
  124. package/lib/WABinary/decode.d.ts +4 -1
  125. package/lib/WABinary/decode.js +267 -234
  126. package/lib/WABinary/encode.d.ts +1 -0
  127. package/lib/WABinary/encode.js +248 -226
  128. package/lib/WABinary/generic-utils.d.ts +13 -1
  129. package/lib/WABinary/generic-utils.js +113 -96
  130. package/lib/WABinary/index.js +13 -9
  131. package/lib/WABinary/jid-utils.d.ts +23 -4
  132. package/lib/WABinary/jid-utils.js +58 -39
  133. package/lib/WABinary/types.d.ts +15 -11
  134. package/lib/WABinary/types.js +1 -0
  135. package/lib/WAM/BinaryInfo.d.ts +14 -14
  136. package/lib/WAM/BinaryInfo.js +11 -8
  137. package/lib/WAM/constants.d.ts +34 -26
  138. package/lib/WAM/constants.js +15358 -15349
  139. package/lib/WAM/encode.d.ts +1 -0
  140. package/lib/WAM/encode.js +153 -144
  141. package/lib/WAM/index.js +13 -9
  142. package/lib/index.js +11 -11
  143. package/package.json +1 -2
  144. package/WASignalGroup/GroupProtocol.js +0 -1771
  145. package/WASignalGroup/ciphertext_message.js +0 -10
  146. package/WASignalGroup/group_cipher.js +0 -103
  147. package/WASignalGroup/group_session_builder.js +0 -39
  148. package/WASignalGroup/index.js +0 -5
  149. package/WASignalGroup/keyhelper.js +0 -17
  150. package/WASignalGroup/protobufs.js +0 -2
  151. package/WASignalGroup/queue_job.js +0 -64
  152. package/WASignalGroup/sender_chain_key.js +0 -38
  153. package/WASignalGroup/sender_key_distribution_message.js +0 -68
  154. package/WASignalGroup/sender_key_message.js +0 -79
  155. package/WASignalGroup/sender_key_name.js +0 -59
  156. package/WASignalGroup/sender_key_record.js +0 -47
  157. package/WASignalGroup/sender_key_state.js +0 -110
  158. package/WASignalGroup/sender_message_key.js +0 -30
@@ -2,35 +2,36 @@ import { Boom } from '@hapi/boom'
2
2
  import { SocketConfig } from '../Types'
3
3
  import { BinaryNode } from '../WABinary'
4
4
  import { USyncQuery } from '../WAUSync'
5
+
5
6
  export declare const makeUSyncSocket: (config: SocketConfig) => {
6
- executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>
7
- type: "md"
8
- ws: import("./Client").WebSocketClient
9
- ev: import("../Types").BaileysEventEmitter & {
10
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void
11
- buffer(): void
12
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>
13
- flush(force?: boolean | undefined): boolean
14
- isBuffering(): boolean
15
- }
16
- authState: {
17
- creds: import("../Types").AuthenticationCreds
18
- keys: import("../Types").SignalKeyStoreWithTransaction
19
- }
20
- signalRepository: import("../Types").SignalRepository
21
- user: import("../Types").Contact | undefined
22
- generateMessageTag: () => string
23
- query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>
24
- waitForMessage: <T_1>(msgId: string, timeoutMs?: number | undefined) => Promise<T_1>
25
- waitForSocketOpen: () => Promise<void>
26
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
27
- sendNode: (frame: BinaryNode) => Promise<void>
28
- logout: (msg?: string | undefined) => Promise<void>
29
- end: (error: Error | undefined) => void
30
- onUnexpectedError: (err: Error | Boom<any>, msg: string) => void
31
- uploadPreKeys: (count?: number) => Promise<void>
32
- uploadPreKeysToServerIfRequired: () => Promise<void>
33
- requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
34
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>
35
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>
7
+ executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>
8
+ type: "md"
9
+ ws: import("./Client").WebSocketClient
10
+ ev: import("../Types").BaileysEventEmitter & {
11
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void
12
+ buffer(): void
13
+ createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>
14
+ flush(force?: boolean | undefined): boolean
15
+ isBuffering(): boolean
16
+ }
17
+ authState: {
18
+ creds: import("../Types").AuthenticationCreds
19
+ keys: import("../Types").SignalKeyStoreWithTransaction
20
+ }
21
+ signalRepository: import("../Types").SignalRepository
22
+ user: import("../Types").Contact | undefined
23
+ generateMessageTag: () => string
24
+ query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>
25
+ waitForMessage: <T_1>(msgId: string, timeoutMs?: number | undefined) => Promise<T_1>
26
+ waitForSocketOpen: () => Promise<void>
27
+ sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
28
+ sendNode: (frame: BinaryNode) => Promise<void>
29
+ logout: (msg?: string | undefined) => Promise<void>
30
+ end: (error: Error | undefined) => void
31
+ onUnexpectedError: (err: Error | Boom<any>, msg: string) => void
32
+ uploadPreKeys: (count?: number) => Promise<void>
33
+ uploadPreKeysToServerIfRequired: () => Promise<void>
34
+ requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
35
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>
36
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>
36
37
  }
@@ -1,71 +1,83 @@
1
1
  "use strict"
2
+
2
3
  Object.defineProperty(exports, "__esModule", { value: true })
4
+
3
5
  const boom_1 = require("@hapi/boom")
4
6
  const WABinary_1 = require("../WABinary")
5
7
  const socket_1 = require("./socket")
8
+
6
9
  const makeUSyncSocket = (config) => {
7
- const sock = socket_1.makeSocket(config)
8
- const { generateMessageTag, query, } = sock
9
- const executeUSyncQuery = async (usyncQuery) => {
10
- if (usyncQuery.protocols.length === 0) {
11
- throw new boom_1.Boom('USyncQuery must have at least one protocol')
12
- }
13
- // todo: validate users, throw WARNING on no valid users
14
- // variable below has only validated users
15
- const validUsers = usyncQuery.users
16
- const userNodes = validUsers.map((user) => {
17
- return {
18
- tag: 'user',
19
- attrs: {
20
- jid: !user.phone ? user.id : undefined,
21
- },
22
- content: usyncQuery.protocols
23
- .map((a) => a.getUserElement(user))
24
- .filter(a => a !== null)
25
- }
26
- })
27
- const listNode = {
28
- tag: 'list',
29
- attrs: {},
30
- content: userNodes
31
- }
32
- const queryNode = {
33
- tag: 'query',
34
- attrs: {},
35
- content: usyncQuery.protocols.map((a) => a.getQueryElement())
36
- }
37
- const iq = {
38
- tag: 'iq',
39
- attrs: {
40
- to: WABinary_1.S_WHATSAPP_NET,
41
- type: 'get',
42
- xmlns: 'usync',
43
- },
44
- content: [
45
- {
46
- tag: 'usync',
47
- attrs: {
48
- context: usyncQuery.context,
49
- mode: usyncQuery.mode,
50
- sid: generateMessageTag(),
51
- last: 'true',
52
- index: '0',
53
- },
54
- content: [
55
- queryNode,
56
- listNode
57
- ]
58
- }
59
- ],
60
- }
61
- const result = await query(iq)
62
- return usyncQuery.parseUSyncQueryResult(result)
63
- }
64
- return {
65
- ...sock,
66
- executeUSyncQuery
67
- }
10
+ const suki = socket_1.makeSocket(config)
11
+ const { generateMessageTag, query, } = suki
12
+
13
+ const executeUSyncQuery = async (usyncQuery) => {
14
+ if (usyncQuery.protocols.length === 0) {
15
+ throw new boom_1.Boom('USyncQuery must have at least one protocol')
16
+ }
17
+
18
+ // todo: validate users, throw WARNING on no valid users
19
+ // variable below has only validated users
20
+ const validUsers = usyncQuery.users
21
+
22
+ const userNodes = validUsers.map((user) => {
23
+ return {
24
+ tag: 'user',
25
+ attrs: {
26
+ jid: !user.phone ? user.id : undefined,
27
+ },
28
+ content: usyncQuery.protocols
29
+ .map((a) => a.getUserElement(user))
30
+ .filter(a => a !== null)
31
+ }
32
+ })
33
+
34
+ const listNode = {
35
+ tag: 'list',
36
+ attrs: {},
37
+ content: userNodes
38
+ }
39
+
40
+ const queryNode = {
41
+ tag: 'query',
42
+ attrs: {},
43
+ content: usyncQuery.protocols.map((a) => a.getQueryElement())
44
+ }
45
+
46
+ const iq = {
47
+ tag: 'iq',
48
+ attrs: {
49
+ to: WABinary_1.S_WHATSAPP_NET,
50
+ type: 'get',
51
+ xmlns: 'usync',
52
+ },
53
+ content: [
54
+ {
55
+ tag: 'usync',
56
+ attrs: {
57
+ context: usyncQuery.context,
58
+ mode: usyncQuery.mode,
59
+ sid: generateMessageTag(),
60
+ last: 'true',
61
+ index: '0',
62
+ },
63
+ content: [
64
+ queryNode,
65
+ listNode
66
+ ]
67
+ }
68
+ ],
69
+ }
70
+
71
+ const result = await query(iq)
72
+
73
+ return usyncQuery.parseUSyncQueryResult(result)
74
+ }
75
+ return {
76
+ ...suki,
77
+ executeUSyncQuery
78
+ }
68
79
  }
80
+
69
81
  module.exports = {
70
- makeUSyncSocket
82
+ makeUSyncSocket
71
83
  }
@@ -1,103 +1,120 @@
1
1
  import type { proto } from '../../WAProto'
2
2
  import type { Contact } from './Contact'
3
3
  import type { MinimalMessage } from './Message'
4
+
4
5
  export type KeyPair = {
5
- public: Uint8Array
6
- private: Uint8Array
6
+ public: Uint8Array
7
+ private: Uint8Array
7
8
  }
9
+
8
10
  export type SignedKeyPair = {
9
- keyPair: KeyPair
10
- signature: Uint8Array
11
- keyId: number
12
- timestampS?: number
11
+ keyPair: KeyPair
12
+ signature: Uint8Array
13
+ keyId: number
14
+ timestampS?: number
13
15
  }
16
+
14
17
  export type ProtocolAddress = {
15
- name: string
16
- deviceId: number
18
+ name: string
19
+ deviceId: number
17
20
  }
21
+
18
22
  export type SignalIdentity = {
19
- identifier: ProtocolAddress
20
- identifierKey: Uint8Array
23
+ identifier: ProtocolAddress
24
+ identifierKey: Uint8Array
21
25
  }
26
+
22
27
  export type LTHashState = {
23
- version: number
24
- hash: Buffer
25
- indexValueMap: {
26
- [indexMacBase64: string]: {
27
- valueMac: Uint8Array | Buffer
28
- }
29
- }
30
- }
28
+ version: number
29
+ hash: Buffer
30
+ indexValueMap: {
31
+ [indexMacBase64: string]: {
32
+ valueMac: Uint8Array | Buffer
33
+ }
34
+ }
35
+ }
36
+
31
37
  export type SignalCreds = {
32
- readonly signedIdentityKey: KeyPair
33
- readonly signedPreKey: SignedKeyPair
34
- readonly registrationId: number
38
+ readonly signedIdentityKey: KeyPair
39
+ readonly signedPreKey: SignedKeyPair
40
+ readonly registrationId: number
35
41
  }
42
+
36
43
  export type AccountSettings = {
37
- /** unarchive chats when a new message is received */
38
- unarchiveChats: boolean
39
- /** the default mode to start new conversations with */
40
- defaultDisappearingMode?: Pick<proto.IConversation, 'ephemeralExpiration' | 'ephemeralSettingTimestamp'>
44
+ /** unarchive chats when a new message is received */
45
+ unarchiveChats: boolean
46
+ /** the default mode to start new conversations with */
47
+ defaultDisappearingMode?: Pick<proto.IConversation, 'ephemeralExpiration' | 'ephemeralSettingTimestamp'>
41
48
  }
49
+
42
50
  export type AuthenticationCreds = SignalCreds & {
43
- readonly noiseKey: KeyPair
44
- readonly pairingEphemeralKeyPair: KeyPair
45
- advSecretKey: string
46
- me?: Contact
47
- account?: proto.IADVSignedDeviceIdentity
48
- signalIdentities?: SignalIdentity[]
49
- myAppStateKeyId?: string
50
- firstUnuploadedPreKeyId: number
51
- nextPreKeyId: number
52
- lastAccountSyncTimestamp?: number
53
- platform?: string
54
- processedHistoryMessages: MinimalMessage[]
55
- /** number of times history & app state has been synced */
56
- accountSyncCounter: number
57
- accountSettings: AccountSettings
58
- registered: boolean
59
- pairingCode: string | undefined
60
- lastPropHash: string | undefined
61
- routingInfo: Buffer | undefined
62
- }
51
+ readonly noiseKey: KeyPair
52
+ readonly pairingEphemeralKeyPair: KeyPair
53
+ advSecretKey: string
54
+ me?: Contact
55
+ account?: proto.IADVSignedDeviceIdentity
56
+ signalIdentities?: SignalIdentity[]
57
+ myAppStateKeyId?: string
58
+ firstUnuploadedPreKeyId: number
59
+ nextPreKeyId: number
60
+ lastAccountSyncTimestamp?: number
61
+ platform?: string
62
+ processedHistoryMessages: MinimalMessage[]
63
+ /** number of times history & app state has been synced */
64
+ accountSyncCounter: number
65
+ accountSettings: AccountSettings
66
+ registered: boolean
67
+ pairingCode: string | undefined
68
+ lastPropHash: string | undefined
69
+ routingInfo: Buffer | undefined
70
+ }
71
+
63
72
  export type SignalDataTypeMap = {
64
- 'pre-key': KeyPair
65
- 'session': Uint8Array
66
- 'sender-key': Uint8Array
67
- 'sender-key-memory': {
68
- [jid: string]: boolean
69
- }
70
- 'app-state-sync-key': proto.Message.IAppStateSyncKeyData
71
- 'app-state-sync-version': LTHashState
72
- }
73
+ 'pre-key': KeyPair
74
+ 'session': Uint8Array
75
+ 'sender-key': Uint8Array
76
+ 'sender-key-memory': {
77
+ [jid: string]: boolean
78
+ }
79
+ 'app-state-sync-key': proto.Message.IAppStateSyncKeyData
80
+ 'app-state-sync-version': LTHashState
81
+ }
82
+
73
83
  export type SignalDataSet = {
74
- [T in keyof SignalDataTypeMap]?: {
75
- [id: string]: SignalDataTypeMap[T] | null
76
- }
84
+ [T in keyof SignalDataTypeMap]?: {
85
+ [id: string]: SignalDataTypeMap[T] | null
86
+ }
77
87
  }
88
+
78
89
  type Awaitable<T> = T | Promise<T>
90
+
79
91
  export type SignalKeyStore = {
80
- get<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Awaitable<{
81
- [id: string]: SignalDataTypeMap[T]
82
- }>
83
- set(data: SignalDataSet): Awaitable<void>
84
- /** clear all the data in the store */
85
- clear?(): Awaitable<void>
86
- }
92
+ get<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Awaitable<{
93
+ [id: string]: SignalDataTypeMap[T]
94
+ }>
95
+ set(data: SignalDataSet): Awaitable<void>
96
+ /** clear all the data in the store */
97
+ clear?(): Awaitable<void>
98
+ }
99
+
87
100
  export type SignalKeyStoreWithTransaction = SignalKeyStore & {
88
- isInTransaction: () => boolean
89
- transaction<T>(exec: () => Promise<T>): Promise<T>
101
+ isInTransaction: () => boolean
102
+ transaction<T>(exec: () => Promise<T>): Promise<T>
90
103
  }
104
+
91
105
  export type TransactionCapabilityOptions = {
92
- maxCommitRetries: number
93
- delayBetweenTriesMs: number
106
+ maxCommitRetries: number
107
+ delayBetweenTriesMs: number
94
108
  }
109
+
95
110
  export type SignalAuthState = {
96
- creds: SignalCreds
97
- keys: SignalKeyStore | SignalKeyStoreWithTransaction
111
+ creds: SignalCreds
112
+ keys: SignalKeyStore | SignalKeyStoreWithTransaction
98
113
  }
114
+
99
115
  export type AuthenticationState = {
100
- creds: AuthenticationCreds
101
- keys: SignalKeyStore
116
+ creds: AuthenticationCreds
117
+ keys: SignalKeyStore
102
118
  }
119
+
103
120
  export {}
package/lib/Types/Auth.js CHANGED
@@ -1,2 +1,3 @@
1
1
  "use strict"
2
+
2
3
  Object.defineProperty(exports, "__esModule", { value: true })
@@ -1,13 +1,14 @@
1
1
  export type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept' | 'terminate'
2
+
2
3
  export type WACallEvent = {
3
- chatId: string
4
- from: string
5
- isGroup?: boolean
6
- groupJid?: string
7
- id: string
8
- date: Date
9
- isVideo?: boolean
10
- status: WACallUpdateType
11
- offline: boolean
12
- latencyMs?: number
4
+ chatId: string
5
+ from: string
6
+ isGroup?: boolean
7
+ groupJid?: string
8
+ id: string
9
+ date: Date
10
+ isVideo?: boolean
11
+ status: WACallUpdateType
12
+ offline: boolean
13
+ latencyMs?: number
13
14
  }
package/lib/Types/Call.js CHANGED
@@ -1,2 +1,3 @@
1
1
  "use strict"
2
+
2
3
  Object.defineProperty(exports, "__esModule", { value: true })
@@ -6,110 +6,133 @@ import type { LabelActionBody } from './Label'
6
6
  import type { ChatLabelAssociationActionBody } from './LabelAssociation'
7
7
  import type { MessageLabelAssociationActionBody } from './LabelAssociation'
8
8
  import type { MinimalMessage, WAMessageKey } from './Message'
9
+
9
10
  /** privacy settings in WhatsApp Web */
10
11
  export type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none'
12
+
11
13
  export type WAPrivacyOnlineValue = 'all' | 'match_last_seen'
14
+
12
15
  export type WAPrivacyGroupAddValue = 'all' | 'contacts' | 'contact_blacklist'
16
+
13
17
  export type WAReadReceiptsValue = 'all' | 'none'
18
+
14
19
  export type WAPrivacyCallValue = 'all' | 'known'
20
+
15
21
  export type WAPrivacyMessagesValue = 'all' | 'contacts'
22
+
16
23
  /** set of statuses visible to other people see updatePresence() in WhatsAppWeb.Send */
17
24
  export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused'
25
+
18
26
  export declare const ALL_WA_PATCH_NAMES: readonly ["critical_block", "critical_unblock_low", "regular_high", "regular_low", "regular"]
27
+
19
28
  export type WAPatchName = typeof ALL_WA_PATCH_NAMES[number]
29
+
20
30
  export type BotListInfo = {
21
- jid: string
22
- personaId: string
31
+ jid: string
32
+ personaId: string
23
33
  }
34
+
24
35
  export interface PresenceData {
25
- lastKnownPresence: WAPresence
26
- lastSeen?: number
36
+ lastKnownPresence: WAPresence
37
+ lastSeen?: number
27
38
  }
39
+
28
40
  export type ChatMutation = {
29
- syncAction: proto.ISyncActionData
30
- index: string[]
41
+ syncAction: proto.ISyncActionData
42
+ index: string[]
31
43
  }
44
+
32
45
  export type WAPatchCreate = {
33
- syncAction: proto.ISyncActionValue
34
- index: string[]
35
- type: WAPatchName
36
- apiVersion: number
37
- operation: proto.SyncdMutation.SyncdOperation
46
+ syncAction: proto.ISyncActionValue
47
+ index: string[]
48
+ type: WAPatchName
49
+ apiVersion: number
50
+ operation: proto.SyncdMutation.SyncdOperation
38
51
  }
52
+
39
53
  export type Chat = proto.IConversation & {
40
- /** unix timestamp of when the last message was received in the chat */
41
- lastMessageRecvTimestamp?: number
54
+ /** unix timestamp of when the last message was received in the chat */
55
+ lastMessageRecvTimestamp?: number
42
56
  }
57
+
43
58
  export type ChatUpdate = Partial<Chat & {
44
- /**
45
- * if specified in the update,
46
- * the EV buffer will check if the condition gets fulfilled before applying the update
47
- * Right now, used to determine when to release an app state sync event
48
- *
49
- * @returns true, if the update should be applied
50
- * false if it can be discarded
51
- * undefined if the condition is not yet fulfilled
52
- * */
53
- conditional: (bufferedData: BufferedEventData) => boolean | undefined
59
+ /**
60
+ * if specified in the update,
61
+ * the EV buffer will check if the condition gets fulfilled before applying the update
62
+ * Right now, used to determine when to release an app state sync event
63
+ *
64
+ * @returns true, if the update should be applied
65
+ * false if it can be discarded
66
+ * undefined if the condition is not yet fulfilled
67
+ * */
68
+ conditional: (bufferedData: BufferedEventData) => boolean | undefined
54
69
  }>
70
+
55
71
  /**
56
- * the last messages in a chat, sorted reverse-chronologically. That is, the latest message should be first in the chat
57
- * for MD modifications, the last message in the array (i.e. the earlist message) must be the last message recv in the chat
58
- * */
72
+ * the last messages in a chat, sorted reverse-chronologically. That is, the latest message should be first in the chat
73
+ * for MD modifications, the last message in the array (i.e. the earlist message) must be the last message recv in the chat
74
+ * */
59
75
  export type LastMessageList = MinimalMessage[] | proto.SyncActionValue.ISyncActionMessageRange
76
+
60
77
  export type ChatModification = {
61
- archive: boolean
62
- lastMessages: LastMessageList
78
+ archive: boolean
79
+ lastMessages: LastMessageList
63
80
  } | {
64
- contact: ContactAction | null
81
+ contact: ContactAction | null
65
82
  } | {
66
- pushNameSetting: string
83
+ pushNameSetting: string
67
84
  } | {
68
- pin: boolean
85
+ pin: boolean
69
86
  } | {
70
- /** mute for duration, or provide timestamp of mute to remove*/
71
- mute: number | null
87
+ /** mute for duration, or provide timestamp of mute to remove*/
88
+ mute: number | null
72
89
  } | {
73
- clear: boolean
90
+ clear: boolean
74
91
  } | {
75
- deleteForMe: {
76
- deleteMedia: boolean
77
- key: WAMessageKey
78
- timestamp: number
79
- }
92
+ deleteForMe: {
93
+ deleteMedia: boolean
94
+ key: WAMessageKey
95
+ timestamp: number
96
+ }
80
97
  } | {
81
- star: {
82
- messages: {
83
- id: string
84
- fromMe?: boolean
85
- }[]
86
- star: boolean
87
- }
98
+ star: {
99
+ messages: {
100
+ id: string
101
+ fromMe?: boolean
102
+ }[]
103
+ star: boolean
104
+ }
88
105
  } | {
89
- markRead: boolean
90
- lastMessages: LastMessageList
106
+ markRead: boolean
107
+ lastMessages: LastMessageList
91
108
  } | {
92
- delete: true
93
- lastMessages: LastMessageList
109
+ delete: true
110
+ lastMessages: LastMessageList
94
111
  } | {
95
- addLabel: LabelActionBody
112
+ contact: proto.SyncActionValue.IContactAction | null
96
113
  } | {
97
- addChatLabel: ChatLabelAssociationActionBody
114
+ disableLinkPreviews: proto.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction
98
115
  } | {
99
- removeChatLabel: ChatLabelAssociationActionBody
116
+ addLabel: LabelActionBody
100
117
  } | {
101
- addMessageLabel: MessageLabelAssociationActionBody
118
+ addChatLabel: ChatLabelAssociationActionBody
102
119
  } | {
103
- removeMessageLabel: MessageLabelAssociationActionBody
120
+ removeChatLabel: ChatLabelAssociationActionBody
121
+ } | {
122
+ addMessageLabel: MessageLabelAssociationActionBody
123
+ } | {
124
+ removeMessageLabel: MessageLabelAssociationActionBody
104
125
  }
126
+
105
127
  export type InitialReceivedChatsState = {
106
- [jid: string]: {
107
- /** the last message received from the other party */
108
- lastMsgRecvTimestamp?: number
109
- /** the absolute last message in the chat */
110
- lastMsgTimestamp: number
111
- }
128
+ [jid: string]: {
129
+ /** the last message received from the other party */
130
+ lastMsgRecvTimestamp?: number
131
+ /** the absolute last message in the chat */
132
+ lastMsgTimestamp: number
133
+ }
112
134
  }
135
+
113
136
  export type InitialAppStateSyncOptions = {
114
- accountSettings: AccountSettings
137
+ accountSettings: AccountSettings
115
138
  }
package/lib/Types/Chat.js CHANGED
@@ -1,6 +1,9 @@
1
1
  "use strict"
2
+
2
3
  Object.defineProperty(exports, "__esModule", { value: true })
4
+
3
5
  const ALL_WA_PATCH_NAMES = ['critical_block', 'critical_unblock_low', 'regular_high', 'regular_low', 'regular']
6
+
4
7
  module.exports = {
5
- ALL_WA_PATCH_NAMES
8
+ ALL_WA_PATCH_NAMES
6
9
  }
@@ -1,2 +1,3 @@
1
1
  "use strict"
2
+
2
3
  Object.defineProperty(exports, "__esModule", { value: true })