sanka-baileyss 2.3.2 → 2.3.4
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/BotMetadata/BotMetadata.d.ts +594 -1
- package/WAProto/BotMetadata/BotMetadata.js +1910 -148
- package/WAProto/BotMetadata/BotMetadata.proto +36 -0
- package/WAProto/E2E/E2E.d.ts +570 -6
- package/WAProto/E2E/E2E.js +1591 -26
- package/WAProto/E2E/E2E.proto +10 -1
- package/WAProto/HistorySync/HistorySync.d.ts +806 -6
- package/WAProto/HistorySync/HistorySync.js +2193 -29
- package/WAProto/HistorySync/HistorySync.proto +2 -1
- package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +570 -6
- package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.js +1591 -26
- package/WAProto/StatusAttributions/StatusAttributions.d.ts +2 -1
- package/WAProto/StatusAttributions/StatusAttributions.js +7 -0
- package/WAProto/StatusAttributions/StatusAttributions.proto +1 -0
- package/WAProto/SyncAction/SyncAction.d.ts +230 -0
- package/WAProto/SyncAction/SyncAction.js +578 -2
- package/WAProto/SyncAction/SyncAction.proto +13 -1
- package/WAProto/Web/Web.d.ts +570 -6
- package/WAProto/Web/Web.js +1591 -26
- package/lib/Defaults/baileys-version.json +2 -2
- package/lib/Defaults/index.d.ts +42 -25
- package/lib/Defaults/index.js +6 -2
- package/lib/Signal/Group/sender-key-record.js +23 -28
- package/lib/Signal/libsignal.d.ts +1 -0
- package/lib/Socket/Client/index.js +13 -9
- package/lib/Socket/Client/types.d.ts +11 -10
- package/lib/Socket/Client/types.js +11 -7
- package/lib/Socket/Client/websocket.d.ts +9 -8
- package/lib/Socket/Client/websocket.js +52 -47
- package/lib/Socket/business.d.ts +185 -182
- package/lib/Socket/business.js +258 -249
- package/lib/Socket/chats.d.ts +90 -87
- package/lib/Socket/chats.js +1095 -888
- package/lib/Socket/community.d.ts +131 -0
- package/lib/Socket/community.js +369 -0
- package/lib/Socket/groups.d.ts +50 -41
- package/lib/Socket/groups.js +10 -3
- package/lib/Socket/index.d.ts +5 -1
- package/lib/Socket/index.js +19 -5
- package/lib/Socket/messages-recv.d.ts +6 -2
- package/lib/Socket/messages-recv.js +31 -8
- package/lib/Socket/messages-send.d.ts +5 -1
- package/lib/Socket/messages-send.js +1293 -1351
- package/lib/Socket/newsletter.d.ts +142 -135
- package/lib/Socket/newsletter.js +274 -230
- package/lib/Socket/socket.d.ts +37 -35
- package/lib/Socket/usync.d.ts +31 -30
- package/lib/Socket/usync.js +74 -62
- package/lib/Types/Auth.d.ts +89 -72
- package/lib/Types/Auth.js +1 -0
- package/lib/Types/Call.d.ts +11 -10
- package/lib/Types/Call.js +1 -0
- package/lib/Types/Chat.d.ts +85 -62
- package/lib/Types/Chat.js +4 -1
- package/lib/Types/Contact.js +1 -0
- package/lib/Types/Events.d.ts +209 -191
- package/lib/Types/Events.js +1 -0
- package/lib/Types/GroupMetadata.d.ts +12 -27
- package/lib/Types/GroupMetadata.js +1 -0
- package/lib/Types/Label.d.ts +41 -39
- package/lib/Types/Label.js +24 -21
- package/lib/Types/LabelAssociation.d.ts +18 -12
- package/lib/Types/LabelAssociation.js +6 -3
- package/lib/Types/Message.d.ts +3 -2
- package/lib/Types/Message.js +7 -3
- package/lib/Types/MexUpdates.d.ts +9 -0
- package/lib/Types/MexUpdates.js +18 -0
- package/lib/Types/Newsletter.d.ts +84 -67
- package/lib/Types/Newsletter.js +30 -23
- package/lib/Types/Product.d.ts +70 -56
- package/lib/Types/Product.js +1 -0
- package/lib/Types/Signal.d.ts +46 -35
- package/lib/Types/Signal.js +1 -0
- package/lib/Types/Socket.d.ts +105 -101
- package/lib/Types/Socket.js +1 -0
- package/lib/Types/State.d.ts +37 -23
- package/lib/Types/State.js +13 -1
- package/lib/Types/USync.d.ts +21 -20
- package/lib/Types/USync.js +1 -0
- package/lib/Types/index.d.ts +51 -42
- package/lib/Types/index.js +25 -19
- package/lib/Utils/auth-utils.d.ts +14 -11
- package/lib/Utils/auth-utils.js +189 -182
- package/lib/Utils/baileys-event-stream.d.ts +12 -10
- package/lib/Utils/baileys-event-stream.js +52 -46
- package/lib/Utils/business.d.ts +15 -8
- package/lib/Utils/business.js +229 -217
- package/lib/Utils/chat-utils.d.ts +22 -12
- package/lib/Utils/chat-utils.js +57 -27
- package/lib/Utils/crypto.d.ts +31 -15
- package/lib/Utils/crypto.js +136 -107
- package/lib/Utils/decode-wa-message.d.ts +34 -245
- package/lib/Utils/decode-wa-message.js +205 -217
- package/lib/Utils/event-buffer.d.ts +30 -26
- package/lib/Utils/event-buffer.js +519 -515
- package/lib/Utils/history.d.ts +2 -8
- package/lib/Utils/index.js +13 -9
- package/lib/Utils/link-preview.d.ts +16 -14
- package/lib/Utils/link-preview.js +100 -92
- package/lib/Utils/logger.d.ts +9 -7
- package/lib/Utils/logger.js +1 -1
- package/lib/Utils/lt-hash.d.ts +10 -8
- package/lib/Utils/lt-hash.js +49 -44
- package/lib/Utils/make-mutex.d.ts +4 -2
- package/lib/Utils/make-mutex.js +43 -39
- package/lib/Utils/messages-media.d.ts +75 -50
- package/lib/Utils/messages.d.ts +60 -35
- package/lib/Utils/messages.js +87 -8
- package/lib/Utils/noise-handler.d.ts +13 -12
- package/lib/Utils/noise-handler.js +143 -138
- package/lib/Utils/process-message.d.ts +32 -24
- package/lib/Utils/process-message.js +387 -367
- package/lib/Utils/signal.d.ts +24 -15
- package/lib/Utils/signal.js +143 -131
- package/lib/Utils/use-mongo-file-auth-state.d.ts +3 -2
- package/lib/Utils/use-mongo-file-auth-state.js +72 -63
- package/lib/Utils/use-multi-file-auth-state.d.ts +9 -8
- package/lib/Utils/use-multi-file-auth-state.js +110 -102
- package/lib/Utils/use-single-file-auth-state.d.ts +8 -7
- package/lib/Utils/use-single-file-auth-state.js +66 -61
- package/lib/Utils/validate-connection.d.ts +5 -2
- package/lib/Utils/validate-connection.js +7 -6
- package/lib/WABinary/constants.d.ts +24 -21
- package/lib/WABinary/constants.js +1302 -31
- package/lib/WABinary/decode.d.ts +4 -1
- package/lib/WABinary/decode.js +267 -234
- package/lib/WABinary/encode.d.ts +1 -0
- package/lib/WABinary/encode.js +248 -226
- package/lib/WABinary/generic-utils.d.ts +13 -1
- package/lib/WABinary/generic-utils.js +113 -96
- package/lib/WABinary/index.js +13 -9
- package/lib/WABinary/jid-utils.d.ts +23 -4
- package/lib/WABinary/jid-utils.js +58 -39
- package/lib/WABinary/types.d.ts +15 -11
- package/lib/WABinary/types.js +1 -0
- package/lib/WAM/BinaryInfo.d.ts +14 -14
- package/lib/WAM/BinaryInfo.js +11 -8
- package/lib/WAM/constants.d.ts +34 -26
- package/lib/WAM/constants.js +15358 -15349
- package/lib/WAM/encode.d.ts +1 -0
- package/lib/WAM/encode.js +153 -144
- package/lib/WAM/index.js +13 -9
- package/lib/index.js +11 -11
- package/package.json +1 -66
- package/WASignalGroup/GroupProtocol.js +0 -1771
- package/WASignalGroup/ciphertext_message.js +0 -10
- package/WASignalGroup/group_cipher.js +0 -103
- package/WASignalGroup/group_session_builder.js +0 -39
- package/WASignalGroup/index.js +0 -5
- package/WASignalGroup/keyhelper.js +0 -17
- package/WASignalGroup/protobufs.js +0 -2
- package/WASignalGroup/queue_job.js +0 -64
- package/WASignalGroup/sender_chain_key.js +0 -38
- package/WASignalGroup/sender_key_distribution_message.js +0 -68
- package/WASignalGroup/sender_key_message.js +0 -79
- package/WASignalGroup/sender_key_name.js +0 -59
- package/WASignalGroup/sender_key_record.js +0 -47
- package/WASignalGroup/sender_key_state.js +0 -110
- package/WASignalGroup/sender_message_key.js +0 -30
package/lib/Socket/usync.d.ts
CHANGED
|
@@ -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
|
}
|
package/lib/Socket/usync.js
CHANGED
|
@@ -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
|
|
8
|
-
const { generateMessageTag, query, } =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
tag: '
|
|
39
|
-
attrs: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
}
|
package/lib/Types/Auth.d.ts
CHANGED
|
@@ -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
package/lib/Types/Call.d.ts
CHANGED
|
@@ -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
package/lib/Types/Chat.d.ts
CHANGED
|
@@ -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
|
-
|
|
112
|
+
contact: proto.SyncActionValue.IContactAction | null
|
|
96
113
|
} | {
|
|
97
|
-
|
|
114
|
+
disableLinkPreviews: proto.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction
|
|
98
115
|
} | {
|
|
99
|
-
|
|
116
|
+
addLabel: LabelActionBody
|
|
100
117
|
} | {
|
|
101
|
-
|
|
118
|
+
addChatLabel: ChatLabelAssociationActionBody
|
|
102
119
|
} | {
|
|
103
|
-
|
|
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
|
}
|
package/lib/Types/Contact.js
CHANGED