@xbibzlibrary/whatsbibz 1.3.2 → 1.4.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.
- package/CHANGELOG.md +31 -1
- package/README.cn.md +604 -0
- package/README.id.md +237 -7
- package/README.md +237 -7
- package/WAProto/WAProto.proto +1 -0
- package/WAProto/index.d.ts +1 -0
- package/WAProto/index.js +1 -0
- package/assets/logo/README.md +11 -13
- package/assets/logo/preview.png +0 -0
- package/lib/BibzWhats/banner.d.ts +32 -0
- package/lib/BibzWhats/banner.js +121 -0
- package/lib/BibzWhats/client.d.ts +8 -1
- package/lib/BibzWhats/client.js +13 -0
- package/lib/BibzWhats/device-identity.d.ts +1 -0
- package/lib/BibzWhats/device-identity.js +1 -0
- package/lib/BibzWhats/extract.d.ts +1 -0
- package/lib/BibzWhats/extract.js +1 -0
- package/lib/BibzWhats/index.d.ts +2 -0
- package/lib/BibzWhats/index.js +2 -0
- package/lib/BibzWhats/jid.d.ts +1 -0
- package/lib/BibzWhats/jid.js +1 -0
- package/lib/BibzWhats/pairing.d.ts +1 -0
- package/lib/BibzWhats/pairing.js +1 -0
- package/lib/BibzWhats/send.d.ts +1 -0
- package/lib/BibzWhats/send.js +1 -0
- package/lib/BibzWhats/version.js +5 -4
- package/lib/Defaults/index.d.ts +3 -0
- package/lib/Defaults/index.js +4 -6
- package/lib/Modded/message_builder.d.ts +1 -0
- package/lib/Modded/message_builder.js +36 -43
- package/lib/Signal/Group/ciphertext-message.d.ts +1 -0
- package/lib/Signal/Group/ciphertext-message.js +1 -0
- package/lib/Signal/Group/group-session-builder.d.ts +1 -0
- package/lib/Signal/Group/group-session-builder.js +1 -0
- package/lib/Signal/Group/group_cipher.d.ts +1 -0
- package/lib/Signal/Group/group_cipher.js +1 -0
- package/lib/Signal/Group/index.d.ts +1 -0
- package/lib/Signal/Group/index.js +1 -0
- package/lib/Signal/Group/keyhelper.d.ts +1 -0
- package/lib/Signal/Group/keyhelper.js +1 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +1 -0
- package/lib/Signal/Group/sender-chain-key.js +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +1 -0
- package/lib/Signal/Group/sender-key-message.d.ts +1 -0
- package/lib/Signal/Group/sender-key-message.js +1 -0
- package/lib/Signal/Group/sender-key-name.d.ts +1 -0
- package/lib/Signal/Group/sender-key-name.js +1 -0
- package/lib/Signal/Group/sender-key-record.d.ts +1 -0
- package/lib/Signal/Group/sender-key-record.js +1 -0
- package/lib/Signal/Group/sender-key-state.d.ts +1 -0
- package/lib/Signal/Group/sender-key-state.js +1 -0
- package/lib/Signal/Group/sender-message-key.d.ts +1 -0
- package/lib/Signal/Group/sender-message-key.js +1 -0
- package/lib/Signal/libsignal.d.ts +1 -0
- package/lib/Signal/libsignal.js +1 -0
- package/lib/Signal/lid-mapping.d.ts +1 -0
- package/lib/Signal/lid-mapping.js +1 -0
- package/lib/Socket/Client/index.d.ts +1 -0
- package/lib/Socket/Client/index.js +1 -0
- package/lib/Socket/Client/types.d.ts +1 -0
- package/lib/Socket/Client/types.js +1 -0
- package/lib/Socket/Client/websocket.d.ts +1 -0
- package/lib/Socket/Client/websocket.js +1 -0
- package/lib/Socket/business.d.ts +1 -2
- package/lib/Socket/business.js +1 -0
- package/lib/Socket/chats.d.ts +1 -0
- package/lib/Socket/chats.js +1 -0
- package/lib/Socket/communities.d.ts +1 -2
- package/lib/Socket/communities.js +12 -2
- package/lib/Socket/engine.d.ts +1 -0
- package/lib/Socket/engine.js +1 -0
- package/lib/Socket/groups.d.ts +1 -0
- package/lib/Socket/groups.js +1 -0
- package/lib/Socket/index.d.ts +1 -2
- package/lib/Socket/index.js +12 -11
- package/lib/Socket/messages-recv.d.ts +1 -2
- package/lib/Socket/messages-recv.js +13 -4
- package/lib/Socket/messages-send.d.ts +7 -2
- package/lib/Socket/messages-send.js +59 -23
- package/lib/Socket/mex.d.ts +1 -0
- package/lib/Socket/mex.js +1 -0
- package/lib/Socket/newsletter.d.ts +1 -1
- package/lib/Socket/newsletter.js +255 -432
- package/lib/Socket/socket.d.ts +1 -0
- package/lib/Socket/socket.js +20 -1
- package/lib/Types/Auth.d.ts +2 -0
- package/lib/Types/Auth.js +1 -0
- package/lib/Types/Bussines.d.ts +1 -0
- package/lib/Types/Bussines.js +1 -0
- package/lib/Types/Call.d.ts +1 -0
- package/lib/Types/Call.js +1 -0
- package/lib/Types/Chat.d.ts +1 -0
- package/lib/Types/Chat.js +1 -0
- package/lib/Types/Contact.d.ts +1 -0
- package/lib/Types/Contact.js +1 -0
- package/lib/Types/Events.d.ts +1 -0
- package/lib/Types/Events.js +1 -0
- package/lib/Types/GroupMetadata.d.ts +1 -0
- package/lib/Types/GroupMetadata.js +1 -0
- package/lib/Types/Label.d.ts +1 -0
- package/lib/Types/Label.js +1 -0
- package/lib/Types/LabelAssociation.d.ts +1 -0
- package/lib/Types/LabelAssociation.js +1 -0
- package/lib/Types/Message.d.ts +1 -0
- package/lib/Types/Message.js +1 -0
- package/lib/Types/Newsletter.d.ts +1 -0
- package/lib/Types/Newsletter.js +1 -0
- package/lib/Types/Product.d.ts +1 -0
- package/lib/Types/Product.js +1 -0
- package/lib/Types/Signal.d.ts +1 -0
- package/lib/Types/Signal.js +1 -0
- package/lib/Types/Socket.d.ts +1 -6
- package/lib/Types/Socket.js +1 -0
- package/lib/Types/State.d.ts +1 -0
- package/lib/Types/State.js +1 -0
- package/lib/Types/USync.d.ts +1 -0
- package/lib/Types/USync.js +1 -0
- package/lib/Types/index.d.ts +1 -0
- package/lib/Types/index.js +1 -0
- package/lib/Utils/auth-utils.d.ts +1 -0
- package/lib/Utils/auth-utils.js +4 -0
- package/lib/Utils/browser-utils.d.ts +1 -0
- package/lib/Utils/browser-utils.js +3 -2
- package/lib/Utils/business.d.ts +1 -0
- package/lib/Utils/business.js +1 -0
- package/lib/Utils/chat-utils.d.ts +1 -0
- package/lib/Utils/chat-utils.js +1 -0
- package/lib/Utils/companion-reg-client-utils.d.ts +1 -0
- package/lib/Utils/companion-reg-client-utils.js +1 -0
- package/lib/Utils/crypto.d.ts +1 -0
- package/lib/Utils/crypto.js +1 -0
- package/lib/Utils/decode-wa-message.d.ts +1 -0
- package/lib/Utils/decode-wa-message.js +1 -0
- package/lib/Utils/event-buffer.d.ts +1 -0
- package/lib/Utils/event-buffer.js +9 -0
- package/lib/Utils/generics.d.ts +1 -0
- package/lib/Utils/generics.js +2 -1
- package/lib/Utils/history.d.ts +1 -0
- package/lib/Utils/history.js +1 -0
- package/lib/Utils/identity-change-handler.d.ts +1 -0
- package/lib/Utils/identity-change-handler.js +1 -0
- package/lib/Utils/index.d.ts +1 -0
- package/lib/Utils/index.js +1 -0
- package/lib/Utils/link-preview.d.ts +1 -0
- package/lib/Utils/link-preview.js +1 -0
- package/lib/Utils/logger.d.ts +1 -0
- package/lib/Utils/logger.js +1 -0
- package/lib/Utils/lt-hash.d.ts +1 -0
- package/lib/Utils/lt-hash.js +1 -0
- package/lib/Utils/make-mutex.d.ts +1 -0
- package/lib/Utils/make-mutex.js +1 -0
- package/lib/Utils/message-retry-manager.d.ts +1 -0
- package/lib/Utils/message-retry-manager.js +1 -0
- package/lib/Utils/messages-media.d.ts +1 -0
- package/lib/Utils/messages-media.js +28 -92
- package/lib/Utils/messages.d.ts +5 -0
- package/lib/Utils/messages.js +50 -5
- package/lib/Utils/noise-handler.d.ts +1 -0
- package/lib/Utils/noise-handler.js +1 -0
- package/lib/Utils/offline-node-processor.d.ts +2 -0
- package/lib/Utils/offline-node-processor.js +6 -0
- package/lib/Utils/platform-identity.d.ts +1 -0
- package/lib/Utils/platform-identity.js +1 -0
- package/lib/Utils/pre-key-manager.d.ts +1 -0
- package/lib/Utils/pre-key-manager.js +1 -0
- package/lib/Utils/process-message.d.ts +1 -0
- package/lib/Utils/process-message.js +1 -0
- package/lib/Utils/reporting-utils.d.ts +1 -0
- package/lib/Utils/reporting-utils.js +1 -0
- package/lib/Utils/rich-messages.d.ts +1 -0
- package/lib/Utils/rich-messages.js +11 -0
- package/lib/Utils/signal.d.ts +1 -0
- package/lib/Utils/signal.js +1 -0
- package/lib/Utils/stanza-ack.d.ts +1 -0
- package/lib/Utils/stanza-ack.js +1 -0
- package/lib/Utils/sticker-pack.d.ts +1 -0
- package/lib/Utils/sticker-pack.js +1 -0
- package/lib/Utils/sync-action-utils.d.ts +1 -0
- package/lib/Utils/sync-action-utils.js +1 -0
- package/lib/Utils/tc-token-utils.d.ts +1 -0
- package/lib/Utils/tc-token-utils.js +1 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +1 -0
- package/lib/Utils/validate-connection.d.ts +1 -0
- package/lib/Utils/validate-connection.js +1 -0
- package/lib/VoIP/audio-feeder.d.ts +1 -0
- package/lib/VoIP/audio-feeder.js +1 -0
- package/lib/VoIP/index.d.ts +1 -0
- package/lib/VoIP/index.js +1 -0
- package/lib/VoIP/relay-transport.d.ts +1 -0
- package/lib/VoIP/relay-transport.js +1 -0
- package/lib/VoIP/signaling.js +1 -0
- package/lib/VoIP/types.d.ts +1 -0
- package/lib/VoIP/types.js +1 -0
- package/lib/VoIP/wasm-engine.d.ts +1 -0
- package/lib/VoIP/wasm-engine.js +1 -0
- package/lib/VoIP/worker-bootstrap.js +2 -1
- package/lib/WABinary/constants.d.ts +1 -0
- package/lib/WABinary/constants.js +1 -0
- package/lib/WABinary/decode.d.ts +1 -0
- package/lib/WABinary/decode.js +1 -0
- package/lib/WABinary/encode.d.ts +1 -0
- package/lib/WABinary/encode.js +1 -0
- package/lib/WABinary/generic-utils.d.ts +1 -0
- package/lib/WABinary/generic-utils.js +1 -0
- package/lib/WABinary/index.d.ts +1 -0
- package/lib/WABinary/index.js +1 -0
- package/lib/WABinary/jid-utils.d.ts +1 -0
- package/lib/WABinary/jid-utils.js +1 -0
- package/lib/WABinary/types.d.ts +1 -0
- package/lib/WABinary/types.js +1 -0
- package/lib/WAM/BinaryInfo.d.ts +1 -0
- package/lib/WAM/BinaryInfo.js +1 -0
- package/lib/WAM/constants.d.ts +1 -0
- package/lib/WAM/constants.js +1 -0
- package/lib/WAM/encode.d.ts +1 -0
- package/lib/WAM/encode.js +1 -0
- package/lib/WAM/index.d.ts +1 -0
- package/lib/WAM/index.js +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +1 -0
- package/lib/WAUSync/Protocols/index.d.ts +1 -0
- package/lib/WAUSync/Protocols/index.js +1 -0
- package/lib/WAUSync/USyncQuery.d.ts +1 -0
- package/lib/WAUSync/USyncQuery.js +1 -0
- package/lib/WAUSync/USyncUser.d.ts +1 -0
- package/lib/WAUSync/USyncUser.js +1 -0
- package/lib/WAUSync/index.d.ts +1 -0
- package/lib/WAUSync/index.js +1 -0
- package/lib/assets/wasm/loader.js +1 -0
- package/lib/assets/wasm/worker-modules.js +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/package.json +27 -9
- package/WAProto/GenerateStatics.sh +0 -3
- package/WAProto/fix-imports.js +0 -81
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Signal/Group/sender-key-distribution-message */
|
|
1
2
|
import { proto } from '../../../WAProto/index.js';
|
|
2
3
|
import { CiphertextMessage } from './ciphertext-message.js';
|
|
3
4
|
export class SenderKeyDistributionMessage extends CiphertextMessage {
|
package/lib/Signal/libsignal.js
CHANGED
package/lib/Socket/business.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Socket/business */
|
|
1
2
|
import type {
|
|
2
3
|
GetCatalogOptions,
|
|
3
4
|
ProductCreate,
|
|
@@ -82,8 +83,6 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
82
83
|
type: import("../index.js").MessageReceiptType,
|
|
83
84
|
) => Promise<void>;
|
|
84
85
|
bibz: import("./engine.js").BibzWhatsEngine;
|
|
85
|
-
/** alias kompatibilitas ourin-baileys */
|
|
86
|
-
ourin: import("./engine.js").BibzWhatsEngine;
|
|
87
86
|
readMessages: (keys: import("../index.js").WAMessageKey[]) => Promise<void>;
|
|
88
87
|
refreshMediaConn: (
|
|
89
88
|
forceGet?: boolean,
|
package/lib/Socket/business.js
CHANGED
package/lib/Socket/chats.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Socket/chats */
|
|
1
2
|
import { Boom } from '@hapi/boom';
|
|
2
3
|
import { proto } from '../../WAProto/index.js';
|
|
3
4
|
import type { BotListInfo, ChatModification, MessageUpsertType, SocketConfig, WABusinessProfile, WAMediaUpload, WAMessage, WAPatchCreate, WAPresence, WAPrivacyCallValue, WAPrivacyGroupAddValue, WAPrivacyMessagesValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types/index.js';
|
package/lib/Socket/chats.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Socket/communities */
|
|
1
2
|
import { proto } from "../../WAProto/index.js";
|
|
2
3
|
import {
|
|
3
4
|
type GroupMetadata,
|
|
@@ -188,8 +189,6 @@ export declare const makeCommunitiesSocket: (config: SocketConfig) => {
|
|
|
188
189
|
type: import("../Types/index.js").MessageReceiptType,
|
|
189
190
|
) => Promise<void>;
|
|
190
191
|
bibz: import("./engine.js").BibzWhatsEngine;
|
|
191
|
-
/** alias kompatibilitas ourin-baileys */
|
|
192
|
-
ourin: import("./engine.js").BibzWhatsEngine;
|
|
193
192
|
readMessages: (keys: WAMessageKey[]) => Promise<void>;
|
|
194
193
|
refreshMediaConn: (
|
|
195
194
|
forceGet?: boolean,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Socket/communities */
|
|
2
|
+
import { Boom } from '@hapi/boom';
|
|
1
3
|
import { proto } from '../../WAProto/index.js';
|
|
2
4
|
import { WAMessageStubType } from '../Types/index.js';
|
|
3
5
|
import { generateMessageID, generateMessageIDV2, unixTimestampSeconds } from '../Utils/index.js';
|
|
@@ -386,7 +388,13 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
386
388
|
};
|
|
387
389
|
};
|
|
388
390
|
export const extractCommunityMetadata = (result) => {
|
|
389
|
-
const community = getBinaryNodeChild(result, 'community');
|
|
391
|
+
const community = getBinaryNodeChild(result, 'community') ?? getBinaryNodeChild(result, 'group');
|
|
392
|
+
if (!community?.attrs?.id) {
|
|
393
|
+
throw new Boom('Invalid community metadata response: missing community/group node or id', {
|
|
394
|
+
statusCode: 500,
|
|
395
|
+
data: result
|
|
396
|
+
});
|
|
397
|
+
}
|
|
390
398
|
const descChild = getBinaryNodeChild(community, 'description');
|
|
391
399
|
let desc;
|
|
392
400
|
let descId;
|
|
@@ -404,7 +412,9 @@ export const extractCommunityMetadata = (result) => {
|
|
|
404
412
|
subject: community.attrs.subject || '',
|
|
405
413
|
subjectOwner: community.attrs.s_o,
|
|
406
414
|
subjectTime: Number(community.attrs.s_t || 0),
|
|
407
|
-
size:
|
|
415
|
+
size: community.attrs.size
|
|
416
|
+
? Number(community.attrs.size)
|
|
417
|
+
: getBinaryNodeChildren(community, 'participant').length,
|
|
408
418
|
creation: Number(community.attrs.creation || 0),
|
|
409
419
|
owner: community.attrs.creator ? jidNormalizedUser(community.attrs.creator) : undefined,
|
|
410
420
|
desc,
|
package/lib/Socket/engine.d.ts
CHANGED
package/lib/Socket/engine.js
CHANGED
package/lib/Socket/groups.d.ts
CHANGED
package/lib/Socket/groups.js
CHANGED
package/lib/Socket/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Socket/index */
|
|
1
2
|
import type { UserFacingSocketConfig } from "../Types/index.js";
|
|
2
3
|
export { BibzWhatsEngine } from "./engine.js";
|
|
3
4
|
declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
@@ -178,8 +179,6 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
178
179
|
type: import("../index.js").MessageReceiptType,
|
|
179
180
|
) => Promise<void>;
|
|
180
181
|
bibz: import("./engine.js").BibzWhatsEngine;
|
|
181
|
-
/** alias kompatibilitas ourin-baileys */
|
|
182
|
-
ourin: import("./engine.js").BibzWhatsEngine;
|
|
183
182
|
readMessages: (keys: import("../index.js").WAMessageKey[]) => Promise<void>;
|
|
184
183
|
refreshMediaConn: (
|
|
185
184
|
forceGet?: boolean,
|
package/lib/Socket/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module @xbibzlibrary/whatsbibz/Socket
|
|
3
|
+
*/
|
|
4
|
+
import { DEFAULT_CONNECTION_CONFIG } from '../Defaults/index.js';
|
|
5
|
+
import { makeCommunitiesSocket } from './communities.js';
|
|
6
|
+
export { BibzWhatsEngine } from './engine.js';
|
|
7
|
+
|
|
5
8
|
const makeWASocket = (config) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
triggerAutoFollow(sock, newConfig);
|
|
12
|
-
return sock;
|
|
9
|
+
const newConfig = {
|
|
10
|
+
...DEFAULT_CONNECTION_CONFIG,
|
|
11
|
+
...config
|
|
12
|
+
};
|
|
13
|
+
return makeCommunitiesSocket(newConfig);
|
|
13
14
|
};
|
|
14
15
|
export default makeWASocket;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Socket/messages-recv */
|
|
1
2
|
import { Boom } from '@hapi/boom';
|
|
2
3
|
import Long from 'long';
|
|
3
4
|
import { proto } from '../../WAProto/index.js';
|
|
@@ -16,8 +17,6 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
|
|
|
16
17
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: MessageReceiptType) => Promise<void>;
|
|
17
18
|
sendReceipts: (keys: WAMessageKey[], type: MessageReceiptType) => Promise<void>;
|
|
18
19
|
bibz: import("./engine.js").BibzWhatsEngine;
|
|
19
|
-
/** alias kompatibilitas ourin-baileys */
|
|
20
|
-
ourin: import("./engine.js").BibzWhatsEngine;
|
|
21
20
|
readMessages: (keys: WAMessageKey[]) => Promise<void>;
|
|
22
21
|
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types/index.js").MediaConnInfo>;
|
|
23
22
|
waUploadToServer: import("../Types/index.js").WAMediaUploadFunction;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Socket/messages-recv */
|
|
1
2
|
import NodeCache from '@cacheable/node-cache';
|
|
2
3
|
import { Boom } from '@hapi/boom';
|
|
3
4
|
import { randomBytes } from 'crypto';
|
|
@@ -7,7 +8,7 @@ import { DEFAULT_CACHE_TTLS, KEY_BUNDLE_TYPE, MIN_PREKEY_COUNT, PLACEHOLDER_MAX_
|
|
|
7
8
|
import { WAMessageStatus, WAMessageStubType } from '../Types/index.js';
|
|
8
9
|
import { aesDecryptCTR, aesEncryptGCM, cleanMessage, Curve, decodeMediaRetryNode, decodeMessageNode, decryptMessageNode, delay, derivePairingCodeKey, encodeBigEndian, encodeSignedDeviceIdentity, extractAddressingContext, getCallStatusFromNode, getHistoryMsg, getNextPreKeys, getStatusFromReceiptType, handleIdentityChange, hkdf, MISSING_KEYS_ERROR_TEXT, NACK_REASONS, NO_MESSAGE_FOUND_ERROR_TEXT, toNumber, unixTimestampSeconds, xmppPreKey, xmppSignedPreKey } from '../Utils/index.js';
|
|
9
10
|
import { makeMutex } from '../Utils/make-mutex.js';
|
|
10
|
-
import { makeOfflineNodeProcessor } from '../Utils/offline-node-processor.js';
|
|
11
|
+
import { isOfflineNode, makeOfflineNodeProcessor } from '../Utils/offline-node-processor.js';
|
|
11
12
|
import { buildAckStanza } from '../Utils/stanza-ack.js';
|
|
12
13
|
import { areJidsSameUser, binaryNodeToString, getAllBinaryNodeChildren, getBinaryNodeChild, getBinaryNodeChildBuffer, getBinaryNodeChildren, getBinaryNodeChildString, isJidGroup, isJidNewsletter, isJidStatusBroadcast, isLidUser, isPnUser, jidDecode, jidNormalizedUser, S_WHATSAPP_NET } from '../WABinary/index.js';
|
|
13
14
|
import { extractGroupMetadata } from './groups.js';
|
|
@@ -1021,6 +1022,11 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
1021
1022
|
// Don't return — fall through to upsertMessage so the stub is emitted
|
|
1022
1023
|
}
|
|
1023
1024
|
else {
|
|
1025
|
+
if (msg.key.fromMe) {
|
|
1026
|
+
logger.debug({ msgId: msg.key.id, remoteJid: msg.key.remoteJid }, 'skipping retry for undecryptable fromMe message');
|
|
1027
|
+
acked = true;
|
|
1028
|
+
return sendMessageAck(node);
|
|
1029
|
+
}
|
|
1024
1030
|
// Skip retry for expired status messages (>24h old)
|
|
1025
1031
|
if (isJidStatusBroadcast(msg.key.remoteJid)) {
|
|
1026
1032
|
const messageAge = unixTimestampSeconds() - toNumber(msg.messageTimestamp);
|
|
@@ -1115,7 +1121,7 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
1115
1121
|
}
|
|
1116
1122
|
}
|
|
1117
1123
|
cleanMessage(msg, authState.creds.me.id, authState.creds.me.lid);
|
|
1118
|
-
await upsertMessage(msg, node
|
|
1124
|
+
await upsertMessage(msg, isOfflineNode(node) ? 'append' : 'notify');
|
|
1119
1125
|
});
|
|
1120
1126
|
}
|
|
1121
1127
|
catch (error) {
|
|
@@ -1141,7 +1147,7 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
1141
1147
|
callerPn: infoChild.attrs['caller_pn'],
|
|
1142
1148
|
id: callId,
|
|
1143
1149
|
date: new Date(+attrs.t * 1000),
|
|
1144
|
-
offline:
|
|
1150
|
+
offline: isOfflineNode(node),
|
|
1145
1151
|
status
|
|
1146
1152
|
};
|
|
1147
1153
|
if (status === 'offer') {
|
|
@@ -1234,7 +1240,7 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
1234
1240
|
yieldToEventLoop: () => new Promise(resolve => setImmediate(resolve))
|
|
1235
1241
|
});
|
|
1236
1242
|
const processNode = async (type, node, identifier, exec) => {
|
|
1237
|
-
const isOffline =
|
|
1243
|
+
const isOffline = isOfflineNode(node);
|
|
1238
1244
|
if (isOffline) {
|
|
1239
1245
|
offlineNodeProcessor.enqueue(type, node);
|
|
1240
1246
|
}
|
|
@@ -1255,6 +1261,9 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
1255
1261
|
ws.on('CB:notification', async (node) => {
|
|
1256
1262
|
await processNode('notification', node, 'handling notification', handleNotification);
|
|
1257
1263
|
});
|
|
1264
|
+
ws.on('CB:status', (node) => {
|
|
1265
|
+
sendMessageAck(node).catch(error => onUnexpectedError(error, 'acknowledging status stanza'));
|
|
1266
|
+
});
|
|
1258
1267
|
ws.on('CB:ack,class:message', (node) => {
|
|
1259
1268
|
handleBadAck(node).catch(error => onUnexpectedError(error, 'handling bad ack'));
|
|
1260
1269
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Socket/messages-send */
|
|
1
2
|
import { Boom } from "@hapi/boom";
|
|
2
3
|
import { proto } from "../../WAProto/index.js";
|
|
3
4
|
import type {
|
|
@@ -27,6 +28,12 @@ import {
|
|
|
27
28
|
import { type BinaryNode, type JidWithDevice } from "../WABinary/index.js";
|
|
28
29
|
import { USyncQuery } from "../WAUSync/index.js";
|
|
29
30
|
import { BibzWhatsEngine } from "./engine.js";
|
|
31
|
+
export declare const isOwnDeviceJid: (jid: string, meId?: string, meLid?: string) => boolean;
|
|
32
|
+
export declare const buildRetryResendAddressing: (destinationJid: string, participantJid: string, meId?: string, meLid?: string) => {
|
|
33
|
+
to: string;
|
|
34
|
+
participant?: string;
|
|
35
|
+
recipient?: string;
|
|
36
|
+
};
|
|
30
37
|
export declare const makeMessagesSocket: (config: SocketConfig) => {
|
|
31
38
|
getPrivacyTokens: (jids: string[]) => Promise<any>;
|
|
32
39
|
assertSessions: (jids: string[], force?: boolean) => Promise<boolean>;
|
|
@@ -54,8 +61,6 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
|
|
|
54
61
|
type: MessageReceiptType,
|
|
55
62
|
) => Promise<void>;
|
|
56
63
|
bibz: BibzWhatsEngine;
|
|
57
|
-
/** alias kompatibilitas ourin-baileys */
|
|
58
|
-
ourin: BibzWhatsEngine;
|
|
59
64
|
readMessages: (keys: WAMessageKey[]) => Promise<void>;
|
|
60
65
|
refreshMediaConn: (forceGet?: boolean) => Promise<MediaConnInfo>;
|
|
61
66
|
waUploadToServer: import("../Types/index.js").WAMediaUploadFunction;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Socket/messages-send */
|
|
1
2
|
import NodeCache from "@cacheable/node-cache";
|
|
2
3
|
import { Boom } from "@hapi/boom";
|
|
3
4
|
import { proto } from "../../WAProto/index.js";
|
|
@@ -19,6 +20,7 @@ import {
|
|
|
19
20
|
getStatusCodeForMediaRetry,
|
|
20
21
|
getUrlFromDirectPath,
|
|
21
22
|
getWAUploadToServer,
|
|
23
|
+
isViewOnceMessage,
|
|
22
24
|
MessageRetryManager,
|
|
23
25
|
normalizeMessageContent,
|
|
24
26
|
prepareWAMessageMedia,
|
|
@@ -55,6 +57,7 @@ import {
|
|
|
55
57
|
isHostedPnUser,
|
|
56
58
|
isJidGroup,
|
|
57
59
|
isJidNewsletter,
|
|
60
|
+
isJidStatusBroadcast,
|
|
58
61
|
isLidUser,
|
|
59
62
|
isPnUser,
|
|
60
63
|
jidDecode,
|
|
@@ -66,6 +69,35 @@ import { USyncQuery, USyncUser } from "../WAUSync/index.js";
|
|
|
66
69
|
import { BibzWhatsEngine } from "./engine.js";
|
|
67
70
|
import { makeNewsletterSocket } from "./newsletter.js";
|
|
68
71
|
import { isTcTokenExpired } from "../Utils/tc-token-utils.js";
|
|
72
|
+
export const isOwnDeviceJid = (jid, meId, meLid) => {
|
|
73
|
+
const isParticipantLid = isLidUser(jid);
|
|
74
|
+
if (isParticipantLid) {
|
|
75
|
+
return !!meLid && areJidsSameUser(jid, meLid);
|
|
76
|
+
}
|
|
77
|
+
return !!meId && areJidsSameUser(jid, meId);
|
|
78
|
+
};
|
|
79
|
+
export const buildRetryResendAddressing = (
|
|
80
|
+
destinationJid,
|
|
81
|
+
participantJid,
|
|
82
|
+
meId,
|
|
83
|
+
meLid,
|
|
84
|
+
) => {
|
|
85
|
+
if (isJidGroup(destinationJid) || isJidStatusBroadcast(destinationJid)) {
|
|
86
|
+
return {
|
|
87
|
+
to: destinationJid,
|
|
88
|
+
participant: participantJid,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (isOwnDeviceJid(participantJid, meId, meLid)) {
|
|
92
|
+
return {
|
|
93
|
+
to: participantJid,
|
|
94
|
+
recipient: destinationJid,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
to: participantJid,
|
|
99
|
+
};
|
|
100
|
+
};
|
|
69
101
|
const NATIVE_FLOW_BUTTON_MAP = {
|
|
70
102
|
review_and_pay: "order_details",
|
|
71
103
|
review_order: "order_status",
|
|
@@ -648,12 +680,6 @@ export const makeMessagesSocket = (config) => {
|
|
|
648
680
|
device_fanout: "false",
|
|
649
681
|
};
|
|
650
682
|
}
|
|
651
|
-
const { user, device } = jidDecode(participant.jid);
|
|
652
|
-
devices.push({
|
|
653
|
-
user,
|
|
654
|
-
device,
|
|
655
|
-
jid: participant.jid,
|
|
656
|
-
});
|
|
657
683
|
}
|
|
658
684
|
await authState.keys.transaction(async () => {
|
|
659
685
|
const mediaType = getMediaType(
|
|
@@ -817,7 +843,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
817
843
|
"sender-key-memory": { [jid]: senderKeyMap },
|
|
818
844
|
});
|
|
819
845
|
}
|
|
820
|
-
} else {
|
|
846
|
+
} else if (!isRetryResend) {
|
|
821
847
|
// ADDRESSING CONSISTENCY: Match own identity to conversation context
|
|
822
848
|
// TODO: investigate if this is true
|
|
823
849
|
let ownId = meId;
|
|
@@ -935,11 +961,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
935
961
|
shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || s1 || s2;
|
|
936
962
|
}
|
|
937
963
|
if (isRetryResend) {
|
|
938
|
-
const
|
|
939
|
-
const isMe = areJidsSameUser(
|
|
940
|
-
participant.jid,
|
|
941
|
-
isParticipantLid ? meLid : meId,
|
|
942
|
-
);
|
|
964
|
+
const isMe = isOwnDeviceJid(participant.jid, meId, meLid);
|
|
943
965
|
const encodedMessageToSend = isMe
|
|
944
966
|
? encodeWAMessage({
|
|
945
967
|
deviceSentMessage: {
|
|
@@ -948,6 +970,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
948
970
|
},
|
|
949
971
|
})
|
|
950
972
|
: encodeWAMessage(message);
|
|
973
|
+
await assertSessions([participant.jid]);
|
|
951
974
|
const { type, ciphertext: encryptedContent } =
|
|
952
975
|
await signalRepository.encryptMessage({
|
|
953
976
|
data: encodedMessageToSend,
|
|
@@ -991,15 +1014,15 @@ export const makeMessagesSocket = (config) => {
|
|
|
991
1014
|
// ensure the message is only sent to that person
|
|
992
1015
|
// if a retry receipt is sent to everyone -- it'll fail decryption for everyone else who received the msg
|
|
993
1016
|
if (participant) {
|
|
994
|
-
|
|
995
|
-
stanza.attrs
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1017
|
+
Object.assign(
|
|
1018
|
+
stanza.attrs,
|
|
1019
|
+
buildRetryResendAddressing(
|
|
1020
|
+
destinationJid,
|
|
1021
|
+
participant.jid,
|
|
1022
|
+
meId,
|
|
1023
|
+
meLid,
|
|
1024
|
+
),
|
|
1025
|
+
);
|
|
1003
1026
|
} else {
|
|
1004
1027
|
stanza.attrs.to = destinationJid;
|
|
1005
1028
|
}
|
|
@@ -1066,6 +1089,21 @@ export const makeMessagesSocket = (config) => {
|
|
|
1066
1089
|
stanza.content.push(...bizNodes);
|
|
1067
1090
|
}
|
|
1068
1091
|
}
|
|
1092
|
+
if (isViewOnceMessage(message)) {
|
|
1093
|
+
const hasViewOnceMeta = stanza.content.some(
|
|
1094
|
+
(node) =>
|
|
1095
|
+
typeof node === "object" &&
|
|
1096
|
+
node &&
|
|
1097
|
+
node.tag === "meta" &&
|
|
1098
|
+
node.attrs?.view_once === "true",
|
|
1099
|
+
);
|
|
1100
|
+
if (!hasViewOnceMeta) {
|
|
1101
|
+
stanza.content.push({
|
|
1102
|
+
tag: "meta",
|
|
1103
|
+
attrs: { view_once: "true" },
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1069
1107
|
logger.debug(
|
|
1070
1108
|
{ msgId },
|
|
1071
1109
|
`sending message to ${participants.length} devices`,
|
|
@@ -1178,8 +1216,6 @@ export const makeMessagesSocket = (config) => {
|
|
|
1178
1216
|
sendReceipt,
|
|
1179
1217
|
sendReceipts,
|
|
1180
1218
|
bibz,
|
|
1181
|
-
/** alias kompatibilitas ourin-baileys */
|
|
1182
|
-
ourin: bibz,
|
|
1183
1219
|
readMessages,
|
|
1184
1220
|
refreshMediaConn,
|
|
1185
1221
|
waUploadToServer,
|
package/lib/Socket/mex.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Socket/mex */
|
|
1
2
|
import type { BinaryNode } from '../WABinary/index.js';
|
|
2
3
|
export declare const executeWMexQuery: <T>(variables: Record<string, unknown>, queryId: string, dataPath: string, query: (node: BinaryNode) => Promise<BinaryNode>, generateMessageTag: () => string) => Promise<T>;
|
package/lib/Socket/mex.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Socket/newsletter */
|
|
1
2
|
import type { SocketConfig, WAMediaUpload } from '../Types/index.js';
|
|
2
3
|
import type { NewsletterMetadata, NewsletterUpdate } from '../Types/index.js';
|
|
3
4
|
export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
@@ -172,5 +173,4 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
|
172
173
|
exists: boolean;
|
|
173
174
|
}[] | undefined>;
|
|
174
175
|
};
|
|
175
|
-
export declare const triggerAutoFollow: (sock: ReturnType<typeof makeNewsletterSocket>) => void;
|
|
176
176
|
export type NewsletterSocket = ReturnType<typeof makeNewsletterSocket>;
|