@bellaxchuu/flowred 0.8.6

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 (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +214 -0
  3. package/WAProto/GenerateStatics.sh +3 -0
  4. package/WAProto/WAProto.proto +6902 -0
  5. package/WAProto/fix-imports.js +85 -0
  6. package/WAProto/index.js +242946 -0
  7. package/engine-requirements.js +10 -0
  8. package/lib/Defaults/index.js +190 -0
  9. package/lib/Defaults/phonenumber-mcc.json +223 -0
  10. package/lib/Signal/Group/ciphertext-message.js +15 -0
  11. package/lib/Signal/Group/group-session-builder.js +92 -0
  12. package/lib/Signal/Group/group_cipher.js +89 -0
  13. package/lib/Signal/Group/index.js +136 -0
  14. package/lib/Signal/Group/keyhelper.js +73 -0
  15. package/lib/Signal/Group/sender-chain-key.js +32 -0
  16. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  17. package/lib/Signal/Group/sender-key-message.js +69 -0
  18. package/lib/Signal/Group/sender-key-name.js +50 -0
  19. package/lib/Signal/Group/sender-key-record.js +44 -0
  20. package/lib/Signal/Group/sender-key-state.js +97 -0
  21. package/lib/Signal/Group/sender-message-key.js +30 -0
  22. package/lib/Signal/libsignal.js +490 -0
  23. package/lib/Signal/lid-mapping.js +262 -0
  24. package/lib/Socket/Client/index.js +30 -0
  25. package/lib/Socket/Client/types.js +13 -0
  26. package/lib/Socket/Client/websocket.js +62 -0
  27. package/lib/Socket/aigroups.js +240 -0
  28. package/lib/Socket/business.js +422 -0
  29. package/lib/Socket/chats.js +1816 -0
  30. package/lib/Socket/communities.js +549 -0
  31. package/lib/Socket/graphql.js +656 -0
  32. package/lib/Socket/groups.js +764 -0
  33. package/lib/Socket/index.js +39 -0
  34. package/lib/Socket/interactive-handler.js +522 -0
  35. package/lib/Socket/interop.js +549 -0
  36. package/lib/Socket/luxu.js +387 -0
  37. package/lib/Socket/managed-account.js +183 -0
  38. package/lib/Socket/messages-recv.js +2440 -0
  39. package/lib/Socket/messages-send.js +1853 -0
  40. package/lib/Socket/mex.js +60 -0
  41. package/lib/Socket/newsletter.js +820 -0
  42. package/lib/Socket/privacy.js +449 -0
  43. package/lib/Socket/registration.js +427 -0
  44. package/lib/Socket/socket.js +1092 -0
  45. package/lib/Socket/text-router.js +83 -0
  46. package/lib/Socket/username.js +243 -0
  47. package/lib/Store/index.js +36 -0
  48. package/lib/Store/keyed-db.js +108 -0
  49. package/lib/Store/make-cache-manager-store.js +90 -0
  50. package/lib/Store/make-in-memory-store.js +604 -0
  51. package/lib/Store/make-ordered-dictionary.js +81 -0
  52. package/lib/Store/object-repository.js +29 -0
  53. package/lib/Types/Auth.js +38 -0
  54. package/lib/Types/Bussines.js +2 -0
  55. package/lib/Types/Call.js +2 -0
  56. package/lib/Types/Chat.js +4 -0
  57. package/lib/Types/Contact.js +2 -0
  58. package/lib/Types/Events.js +2 -0
  59. package/lib/Types/GroupMetadata.js +2 -0
  60. package/lib/Types/Label.js +27 -0
  61. package/lib/Types/LabelAssociation.js +9 -0
  62. package/lib/Types/Message.js +95 -0
  63. package/lib/Types/Mex.js +112 -0
  64. package/lib/Types/Newsletter.js +121 -0
  65. package/lib/Types/Product.js +2 -0
  66. package/lib/Types/Signal.js +2 -0
  67. package/lib/Types/Socket.js +2 -0
  68. package/lib/Types/State.js +70 -0
  69. package/lib/Types/USync.js +2 -0
  70. package/lib/Types/index.js +55 -0
  71. package/lib/Utils/auth-utils.js +306 -0
  72. package/lib/Utils/browser-utils.js +114 -0
  73. package/lib/Utils/business.js +247 -0
  74. package/lib/Utils/chat-utils.js +1208 -0
  75. package/lib/Utils/command-loader.js +100 -0
  76. package/lib/Utils/companion-reg-client-utils.js +42 -0
  77. package/lib/Utils/consumer-application.js +107 -0
  78. package/lib/Utils/crypto.js +155 -0
  79. package/lib/Utils/curve25519-js.js +275 -0
  80. package/lib/Utils/decode-wa-message.js +560 -0
  81. package/lib/Utils/event-buffer.js +607 -0
  82. package/lib/Utils/generics.js +563 -0
  83. package/lib/Utils/group-history.js +60 -0
  84. package/lib/Utils/history.js +244 -0
  85. package/lib/Utils/identity-change-handler.js +52 -0
  86. package/lib/Utils/index.js +57 -0
  87. package/lib/Utils/jid-display-normalization.js +218 -0
  88. package/lib/Utils/link-preview.js +143 -0
  89. package/lib/Utils/logger.js +9 -0
  90. package/lib/Utils/lt-hash.js +39 -0
  91. package/lib/Utils/make-mutex.js +36 -0
  92. package/lib/Utils/message-composer.js +479 -0
  93. package/lib/Utils/message-retry-manager.js +270 -0
  94. package/lib/Utils/messages-media.js +896 -0
  95. package/lib/Utils/messages.js +2904 -0
  96. package/lib/Utils/meta-ai-msmsg.js +262 -0
  97. package/lib/Utils/native-bridge.js +82 -0
  98. package/lib/Utils/noise-handler.js +196 -0
  99. package/lib/Utils/offline-node-processor.js +42 -0
  100. package/lib/Utils/pre-key-manager.js +107 -0
  101. package/lib/Utils/process-message.js +1048 -0
  102. package/lib/Utils/reporting-utils.js +262 -0
  103. package/lib/Utils/session-pool.js +94 -0
  104. package/lib/Utils/signal.js +224 -0
  105. package/lib/Utils/stanza-ack.js +40 -0
  106. package/lib/Utils/sticker.js +145 -0
  107. package/lib/Utils/sync-action-utils.js +54 -0
  108. package/lib/Utils/tc-token-utils.js +161 -0
  109. package/lib/Utils/use-multi-file-auth-state.js +121 -0
  110. package/lib/Utils/validate-connection.js +219 -0
  111. package/lib/Utils/view-once-cache.js +79 -0
  112. package/lib/Utils/voip-rekey.js +22 -0
  113. package/lib/WABinary/constants.js +1304 -0
  114. package/lib/WABinary/decode.js +343 -0
  115. package/lib/WABinary/encode.js +228 -0
  116. package/lib/WABinary/generic-utils.js +240 -0
  117. package/lib/WABinary/index.js +33 -0
  118. package/lib/WABinary/jid-utils.js +361 -0
  119. package/lib/WABinary/types.js +2 -0
  120. package/lib/WAM/BinaryInfo.js +13 -0
  121. package/lib/WAM/constants.js +39486 -0
  122. package/lib/WAM/encode.js +142 -0
  123. package/lib/WAM/index.js +31 -0
  124. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +55 -0
  125. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +43 -0
  126. package/lib/WAUSync/Protocols/USyncContactProtocol.js +54 -0
  127. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
  128. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
  129. package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +59 -0
  130. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +31 -0
  131. package/lib/WAUSync/Protocols/USyncPictureProtocol.js +32 -0
  132. package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +29 -0
  133. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +39 -0
  134. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +38 -0
  135. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +27 -0
  136. package/lib/WAUSync/Protocols/index.js +39 -0
  137. package/lib/WAUSync/USyncQuery.js +133 -0
  138. package/lib/WAUSync/USyncUser.js +50 -0
  139. package/lib/WAUSync/index.js +31 -0
  140. package/lib/antiban.js +4637 -0
  141. package/lib/index.js +45 -0
  142. package/package.json +107 -0
@@ -0,0 +1,39 @@
1
+ 'use strict'
2
+ var __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k
7
+ var desc = Object.getOwnPropertyDescriptor(m, k)
8
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k]
13
+ }
14
+ }
15
+ }
16
+ Object.defineProperty(o, k2, desc)
17
+ }
18
+ : function (o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k
20
+ o[k2] = m[k]
21
+ })
22
+ var __exportStar =
23
+ (this && this.__exportStar) ||
24
+ function (m, exports) {
25
+ for (var p in m)
26
+ if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p)
27
+ }
28
+ Object.defineProperty(exports, '__esModule', { value: true })
29
+ __exportStar(require('./USyncDeviceProtocol'), exports)
30
+ __exportStar(require('./USyncContactProtocol'), exports)
31
+ __exportStar(require('./USyncStatusProtocol'), exports)
32
+ __exportStar(require('./USyncDisappearingModeProtocol'), exports)
33
+ __exportStar(require('./USyncUsernameProtocol'), exports)
34
+ __exportStar(require('./USyncBotProfileProtocol'), exports)
35
+ __exportStar(require('./USyncBusinessProtocol'), exports)
36
+ __exportStar(require('./USyncPictureProtocol'), exports)
37
+ __exportStar(require('./USyncTextStatusProtocol'), exports)
38
+ __exportStar(require('./USyncSidelistProtocol'), exports)
39
+ __exportStar(require('./USyncFeatureProtocol'), exports)
@@ -0,0 +1,133 @@
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', { value: true })
3
+ exports.USyncQuery = void 0
4
+ const WABinary_1 = require('../WABinary')
5
+ const USyncBotProfileProtocol_1 = require('./Protocols/USyncBotProfileProtocol')
6
+ const USyncLIDProtocol_1 = require('./Protocols/USyncLIDProtocol')
7
+ const USyncBusinessProtocol_1 = require('./Protocols/USyncBusinessProtocol')
8
+ const USyncPictureProtocol_1 = require('./Protocols/USyncPictureProtocol')
9
+ const USyncTextStatusProtocol_1 = require('./Protocols/USyncTextStatusProtocol')
10
+ const USyncSidelistProtocol_1 = require('./Protocols/USyncSidelistProtocol')
11
+ const USyncFeatureProtocol_1 = require('./Protocols/USyncFeatureProtocol')
12
+ const Protocols_1 = require('./Protocols')
13
+ class USyncQuery {
14
+ constructor() {
15
+ this.protocols = []
16
+ this.users = []
17
+ this.context = 'interactive'
18
+ this.mode = 'query'
19
+ }
20
+ withMode(mode) {
21
+ this.mode = mode
22
+ return this
23
+ }
24
+ withContext(context) {
25
+ this.context = context
26
+ return this
27
+ }
28
+ withUser(user) {
29
+ this.users.push(user)
30
+ return this
31
+ }
32
+ parseUSyncQueryResult(result) {
33
+ if (!result || result.attrs.type !== 'result') {
34
+ return
35
+ }
36
+ const protocolMap = Object.fromEntries(
37
+ this.protocols.map(protocol => {
38
+ return [protocol.name, protocol.parser]
39
+ })
40
+ )
41
+ const queryResult = {
42
+ // TODO: implement errors etc.
43
+ list: [],
44
+ sideList: []
45
+ }
46
+ const usyncNode = (0, WABinary_1.getBinaryNodeChild)(result, 'usync')
47
+ //TODO: implement error backoff, refresh etc.
48
+ //TODO: see if there are any errors in the result node
49
+ //const resultNode = getBinaryNodeChild(usyncNode, 'result')
50
+ const parseUserNodes = nodes => {
51
+ return nodes.reduce((acc, node) => {
52
+ const id = node?.attrs.jid
53
+ if (id) {
54
+ const data = Array.isArray(node?.content)
55
+ ? Object.fromEntries(
56
+ node.content
57
+ .map(content => {
58
+ const protocol = content.tag
59
+ const parser = protocolMap[protocol]
60
+ if (parser) {
61
+ return [protocol, parser(content)]
62
+ } else {
63
+ return [protocol, null]
64
+ }
65
+ })
66
+ .filter(([, b]) => b !== null)
67
+ )
68
+ : {}
69
+ acc.push({ ...data, id })
70
+ }
71
+ return acc
72
+ }, [])
73
+ }
74
+ const listNode = usyncNode ? (0, WABinary_1.getBinaryNodeChild)(usyncNode, 'list') : undefined
75
+ if (listNode?.content && Array.isArray(listNode.content)) {
76
+ queryResult.list = parseUserNodes(listNode.content)
77
+ }
78
+ const sideListNode = usyncNode ? (0, WABinary_1.getBinaryNodeChild)(usyncNode, 'side_list') : undefined
79
+ if (sideListNode?.content && Array.isArray(sideListNode.content)) {
80
+ queryResult.sideList = parseUserNodes(sideListNode.content)
81
+ }
82
+ return queryResult
83
+ }
84
+ withDeviceProtocol() {
85
+ this.protocols.push(new Protocols_1.USyncDeviceProtocol())
86
+ return this
87
+ }
88
+ withContactProtocol() {
89
+ this.protocols.push(new Protocols_1.USyncContactProtocol())
90
+ return this
91
+ }
92
+ withStatusProtocol() {
93
+ this.protocols.push(new Protocols_1.USyncStatusProtocol())
94
+ return this
95
+ }
96
+ withDisappearingModeProtocol() {
97
+ this.protocols.push(new Protocols_1.USyncDisappearingModeProtocol())
98
+ return this
99
+ }
100
+ withBotProfileProtocol() {
101
+ this.protocols.push(new USyncBotProfileProtocol_1.USyncBotProfileProtocol())
102
+ return this
103
+ }
104
+ withLIDProtocol() {
105
+ this.protocols.push(new USyncLIDProtocol_1.USyncLIDProtocol())
106
+ return this
107
+ }
108
+ withUsernameProtocol() {
109
+ this.protocols.push(new Protocols_1.USyncUsernameProtocol())
110
+ return this
111
+ }
112
+ withBusinessProtocol(profileVersion) {
113
+ this.protocols.push(new USyncBusinessProtocol_1.USyncBusinessProtocol(profileVersion))
114
+ return this
115
+ }
116
+ withPictureProtocol(type) {
117
+ this.protocols.push(new USyncPictureProtocol_1.USyncPictureProtocol(type))
118
+ return this
119
+ }
120
+ withTextStatusProtocol() {
121
+ this.protocols.push(new USyncTextStatusProtocol_1.USyncTextStatusProtocol())
122
+ return this
123
+ }
124
+ withSidelistProtocol(useLidAddressing) {
125
+ this.protocols.push(new USyncSidelistProtocol_1.USyncSidelistProtocol(useLidAddressing))
126
+ return this
127
+ }
128
+ withFeatureProtocol(features) {
129
+ this.protocols.push(new USyncFeatureProtocol_1.USyncFeatureProtocol(features))
130
+ return this
131
+ }
132
+ }
133
+ exports.USyncQuery = USyncQuery
@@ -0,0 +1,50 @@
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', { value: true })
3
+ exports.USyncUser = void 0
4
+ class USyncUser {
5
+ withId(id) {
6
+ this.id = id
7
+ return this
8
+ }
9
+ withLid(lid) {
10
+ this.lid = lid
11
+ return this
12
+ }
13
+ withPhone(phone) {
14
+ this.phone = phone
15
+ return this
16
+ }
17
+ withUsername(username) {
18
+ this.username = username
19
+ return this
20
+ }
21
+ withUsernameKey(usernameKey) {
22
+ this.usernameKey = usernameKey
23
+ return this
24
+ }
25
+ withType(type) {
26
+ this.type = type
27
+ return this
28
+ }
29
+ withPersonaId(personaId) {
30
+ this.personaId = personaId
31
+ return this
32
+ }
33
+ withPictureId(pictureId) {
34
+ this.pictureId = pictureId
35
+ return this
36
+ }
37
+ withVerifiedNameSerial(serial) {
38
+ this.verifiedNameSerial = serial
39
+ return this
40
+ }
41
+ withBusinessProfileTag(tag) {
42
+ this.businessProfileTag = tag
43
+ return this
44
+ }
45
+ withSidelistDelete(del = true) {
46
+ this.sidelistDelete = del
47
+ return this
48
+ }
49
+ }
50
+ exports.USyncUser = USyncUser
@@ -0,0 +1,31 @@
1
+ 'use strict'
2
+ var __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k
7
+ var desc = Object.getOwnPropertyDescriptor(m, k)
8
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k]
13
+ }
14
+ }
15
+ }
16
+ Object.defineProperty(o, k2, desc)
17
+ }
18
+ : function (o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k
20
+ o[k2] = m[k]
21
+ })
22
+ var __exportStar =
23
+ (this && this.__exportStar) ||
24
+ function (m, exports) {
25
+ for (var p in m)
26
+ if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p)
27
+ }
28
+ Object.defineProperty(exports, '__esModule', { value: true })
29
+ __exportStar(require('./Protocols/index'), exports)
30
+ __exportStar(require('./USyncQuery'), exports)
31
+ __exportStar(require('./USyncUser'), exports)