naya-flore 4.7.1 → 4.7.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/README.md +0 -104
- package/WAProto/WAProto.proto +89 -1195
- package/WAProto/index.d.ts +1256 -13195
- package/WAProto/index.js +11405 -32544
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +0 -231
- package/lib/Defaults/index.js +102 -92
- package/lib/Defaults/phonenumber-mcc.json +221 -221
- package/lib/Signal/libsignal.js +9 -18
- package/lib/Socket/Client/abstract-socket-client.d.ts +2 -0
- package/lib/Socket/Client/index.d.ts +3 -2
- package/lib/Socket/Client/index.js +3 -2
- package/lib/Socket/Client/mobile-socket-client.d.ts +1 -0
- package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
- package/lib/Socket/Client/{websocket.js → web-socket-client.js} +2 -2
- package/lib/Socket/business.d.ts +43 -42
- package/lib/Socket/chats.d.ts +8 -9
- package/lib/Socket/chats.js +34 -41
- package/lib/Socket/groups.d.ts +7 -7
- package/lib/Socket/groups.js +4 -2
- package/lib/Socket/index.d.ts +52 -51
- package/lib/Socket/messages-recv.d.ts +42 -41
- package/lib/Socket/messages-recv.js +127 -190
- package/lib/Socket/messages-send.d.ts +9 -16
- package/lib/Socket/messages-send.js +316 -467
- package/lib/Socket/newsletter.d.ts +28 -26
- package/lib/Socket/newsletter.js +3 -3
- package/lib/Socket/registration.d.ts +52 -49
- package/lib/Socket/registration.js +7 -7
- package/lib/Socket/socket.d.ts +0 -1
- package/lib/Socket/socket.js +23 -49
- package/lib/Socket/usync.d.ts +10 -11
- package/lib/Store/index.d.ts +2 -2
- package/lib/Store/index.js +2 -2
- package/lib/Store/make-cache-manager-store.d.ts +0 -1
- package/lib/Store/make-in-memory-store.js +1 -5
- package/lib/Store/make-ordered-dictionary.d.ts +1 -1
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +7 -12
- package/lib/Types/Events.d.ts +2 -17
- package/lib/Types/GroupMetadata.d.ts +2 -3
- package/lib/Types/Label.d.ts +0 -11
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +10 -170
- package/lib/Types/Newsletter.js +3 -3
- package/lib/Types/Socket.d.ts +4 -7
- package/lib/Types/index.d.ts +0 -9
- package/lib/Types/index.js +1 -1
- package/lib/Utils/auth-utils.js +3 -3
- package/lib/Utils/business.d.ts +1 -1
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +12 -11
- package/lib/Utils/chat-utils.js +26 -42
- package/lib/Utils/crypto.d.ts +16 -15
- package/lib/Utils/crypto.js +23 -35
- package/lib/Utils/decode-wa-message.d.ts +0 -17
- package/lib/Utils/decode-wa-message.js +15 -43
- package/lib/Utils/generics.d.ts +17 -13
- package/lib/Utils/generics.js +15 -25
- package/lib/Utils/history.d.ts +2 -6
- package/lib/Utils/history.js +6 -4
- package/lib/Utils/logger.d.ts +3 -1
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +28 -25
- package/lib/Utils/messages-media.js +47 -38
- package/lib/Utils/messages.js +41 -454
- package/lib/Utils/noise-handler.d.ts +5 -4
- package/lib/Utils/process-message.js +2 -2
- package/lib/Utils/signal.d.ts +1 -2
- package/lib/Utils/signal.js +19 -11
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +3 -11
- package/lib/Utils/validate-connection.d.ts +1 -1
- package/lib/Utils/validate-connection.js +1 -1
- package/lib/WABinary/decode.d.ts +2 -1
- package/lib/WABinary/decode.js +7 -17
- package/lib/WABinary/encode.d.ts +2 -1
- package/lib/WABinary/encode.js +17 -33
- package/lib/WABinary/generic-utils.d.ts +3 -2
- package/lib/WABinary/generic-utils.js +2 -2
- package/lib/WABinary/jid-utils.d.ts +1 -1
- package/lib/WAM/BinaryInfo.d.ts +11 -2
- package/lib/WAM/encode.d.ts +2 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +3 -3
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +8 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
- package/lib/WAUSync/USyncQuery.d.ts +2 -0
- package/lib/WAUSync/USyncQuery.js +10 -0
- package/lib/WAUSync/USyncUser.d.ts +2 -0
- package/lib/WAUSync/USyncUser.js +4 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/package.json +19 -32
- package/lib/Socket/Client/types.d.ts +0 -17
- package/lib/Socket/Client/types.js +0 -13
package/lib/Utils/signal.js
CHANGED
@@ -85,19 +85,27 @@ const parseAndInjectE2ESessions = async (node, repository) => {
|
|
85
85
|
};
|
86
86
|
exports.parseAndInjectE2ESessions = parseAndInjectE2ESessions;
|
87
87
|
const extractDeviceJids = (result, myJid, excludeZeroDevices) => {
|
88
|
+
var _a;
|
88
89
|
const { user: myUser, device: myDevice } = (0, WABinary_1.jidDecode)(myJid);
|
89
90
|
const extracted = [];
|
90
|
-
for (const
|
91
|
-
const
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
(
|
99
|
-
|
100
|
-
|
91
|
+
for (const node of result.content) {
|
92
|
+
const list = (_a = (0, WABinary_1.getBinaryNodeChild)(node, 'list')) === null || _a === void 0 ? void 0 : _a.content;
|
93
|
+
if (list && Array.isArray(list)) {
|
94
|
+
for (const item of list) {
|
95
|
+
const { user } = (0, WABinary_1.jidDecode)(item.attrs.jid);
|
96
|
+
const devicesNode = (0, WABinary_1.getBinaryNodeChild)(item, 'devices');
|
97
|
+
const deviceListNode = (0, WABinary_1.getBinaryNodeChild)(devicesNode, 'device-list');
|
98
|
+
if (Array.isArray(deviceListNode === null || deviceListNode === void 0 ? void 0 : deviceListNode.content)) {
|
99
|
+
for (const { tag, attrs } of deviceListNode.content) {
|
100
|
+
const device = +attrs.id;
|
101
|
+
if (tag === 'device' && // ensure the "device" tag
|
102
|
+
(!excludeZeroDevices || device !== 0) && // if zero devices are not-excluded, or device is non zero
|
103
|
+
(myUser !== user || myDevice !== device) && // either different user or if me user, not this device
|
104
|
+
(device === 0 || !!attrs['key-index']) // ensure that "key-index" is specified for "non-zero" devices, produces a bad req otherwise
|
105
|
+
) {
|
106
|
+
extracted.push({ user, device });
|
107
|
+
}
|
108
|
+
}
|
101
109
|
}
|
102
110
|
}
|
103
111
|
}
|
@@ -1,7 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
3
|
exports.useMultiFileAuthState = void 0;
|
7
4
|
const promises_1 = require("fs/promises");
|
@@ -9,8 +6,6 @@ const path_1 = require("path");
|
|
9
6
|
const WAProto_1 = require("../../WAProto");
|
10
7
|
const auth_utils_1 = require("./auth-utils");
|
11
8
|
const generics_1 = require("./generics");
|
12
|
-
const async_lock_1 = __importDefault(require("async-lock"));
|
13
|
-
const fileLock = new async_lock_1.default({ maxPending: Infinity });
|
14
9
|
/**
|
15
10
|
* stores the full authentication state in a single folder.
|
16
11
|
* Far more efficient than singlefileauthstate
|
@@ -20,13 +15,11 @@ const fileLock = new async_lock_1.default({ maxPending: Infinity });
|
|
20
15
|
* */
|
21
16
|
const useMultiFileAuthState = async (folder) => {
|
22
17
|
const writeData = (data, file) => {
|
23
|
-
|
24
|
-
return fileLock.acquire(filePath, () => (0, promises_1.writeFile)((0, path_1.join)(filePath), JSON.stringify(data, generics_1.BufferJSON.replacer)));
|
18
|
+
return (0, promises_1.writeFile)((0, path_1.join)(folder, fixFileName(file)), JSON.stringify(data, generics_1.BufferJSON.replacer));
|
25
19
|
};
|
26
20
|
const readData = async (file) => {
|
27
21
|
try {
|
28
|
-
const
|
29
|
-
const data = await fileLock.acquire(filePath, () => (0, promises_1.readFile)(filePath, { encoding: 'utf-8' }));
|
22
|
+
const data = await (0, promises_1.readFile)((0, path_1.join)(folder, fixFileName(file)), { encoding: 'utf-8' });
|
30
23
|
return JSON.parse(data, generics_1.BufferJSON.reviver);
|
31
24
|
}
|
32
25
|
catch (error) {
|
@@ -35,8 +28,7 @@ const useMultiFileAuthState = async (folder) => {
|
|
35
28
|
};
|
36
29
|
const removeData = async (file) => {
|
37
30
|
try {
|
38
|
-
|
39
|
-
await fileLock.acquire(filePath, () => (0, promises_1.unlink)(filePath));
|
31
|
+
await (0, promises_1.unlink)((0, path_1.join)(folder, fixFileName(file)));
|
40
32
|
}
|
41
33
|
catch (_a) {
|
42
34
|
}
|
@@ -7,5 +7,5 @@ export declare const generateRegistrationNode: ({ registrationId, signedPreKey,
|
|
7
7
|
export declare const configureSuccessfulPairing: (stanza: BinaryNode, { advSecretKey, signedIdentityKey, signalIdentities }: Pick<AuthenticationCreds, 'advSecretKey' | 'signedIdentityKey' | 'signalIdentities'>) => {
|
8
8
|
creds: Partial<AuthenticationCreds>;
|
9
9
|
reply: BinaryNode;
|
10
|
-
};
|
10
|
+
};
|
11
11
|
export declare const encodeSignedDeviceIdentity: (account: proto.IADVSignedDeviceIdentity, includeSignatureKey: boolean) => Uint8Array;
|
@@ -8,7 +8,7 @@ const Defaults_1 = require("../Defaults");
|
|
8
8
|
const WABinary_1 = require("../WABinary");
|
9
9
|
const crypto_2 = require("./crypto");
|
10
10
|
const generics_1 = require("./generics");
|
11
|
-
const signal_1 = require("./signal");
|
11
|
+
const signal_1 = require("./signal");
|
12
12
|
const getUserAgent = (config) => {
|
13
13
|
var _a, _b;
|
14
14
|
const osVersion = config.mobile ? '15.3.1' : '0.1';
|
package/lib/WABinary/decode.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
/// <reference types="node" />
|
1
2
|
import type { BinaryNode, BinaryNodeCodingOptions } from './types';
|
2
3
|
export declare const decompressingIfRequired: (buffer: Buffer) => Buffer;
|
3
|
-
export declare const decodeDecompressedBinaryNode: (buffer: Buffer, opts: Pick<BinaryNodeCodingOptions,
|
4
|
+
export declare const decodeDecompressedBinaryNode: (buffer: Buffer, opts: Pick<BinaryNodeCodingOptions, 'DOUBLE_BYTE_TOKENS' | 'SINGLE_BYTE_TOKENS' | 'TAGS'>, indexRef?: {
|
4
5
|
index: number;
|
5
6
|
}) => BinaryNode;
|
6
7
|
export declare const decodeBinaryNode: (buff: Buffer) => BinaryNode;
|
package/lib/WABinary/decode.js
CHANGED
@@ -15,23 +15,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
15
15
|
}) : function(o, v) {
|
16
16
|
o["default"] = v;
|
17
17
|
});
|
18
|
-
var __importStar = (this && this.__importStar) ||
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
return ownKeys(o);
|
26
|
-
};
|
27
|
-
return function (mod) {
|
28
|
-
if (mod && mod.__esModule) return mod;
|
29
|
-
var result = {};
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
31
|
-
__setModuleDefault(result, mod);
|
32
|
-
return result;
|
33
|
-
};
|
34
|
-
})();
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
35
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
36
26
|
exports.decodeBinaryNode = exports.decodeDecompressedBinaryNode = exports.decompressingIfRequired = void 0;
|
37
27
|
const zlib_1 = require("zlib");
|
package/lib/WABinary/encode.d.ts
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
+
/// <reference types="node" />
|
1
2
|
import type { BinaryNode, BinaryNodeCodingOptions } from './types';
|
2
|
-
export declare const encodeBinaryNode: (
|
3
|
+
export declare const encodeBinaryNode: ({ tag, attrs, content }: BinaryNode, opts?: Pick<BinaryNodeCodingOptions, 'TAGS' | 'TOKEN_MAP'>, buffer?: number[]) => Buffer;
|
package/lib/WABinary/encode.js
CHANGED
@@ -15,33 +15,18 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
15
15
|
}) : function(o, v) {
|
16
16
|
o["default"] = v;
|
17
17
|
});
|
18
|
-
var __importStar = (this && this.__importStar) ||
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
return ownKeys(o);
|
26
|
-
};
|
27
|
-
return function (mod) {
|
28
|
-
if (mod && mod.__esModule) return mod;
|
29
|
-
var result = {};
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
31
|
-
__setModuleDefault(result, mod);
|
32
|
-
return result;
|
33
|
-
};
|
34
|
-
})();
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
35
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
36
26
|
exports.encodeBinaryNode = void 0;
|
37
27
|
const constants = __importStar(require("./constants"));
|
38
28
|
const jid_utils_1 = require("./jid-utils");
|
39
|
-
const encodeBinaryNode = (
|
40
|
-
const encoded = encodeBinaryNodeInner(node, opts, buffer);
|
41
|
-
return Buffer.from(encoded);
|
42
|
-
};
|
43
|
-
exports.encodeBinaryNode = encodeBinaryNode;
|
44
|
-
const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
29
|
+
const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0]) => {
|
45
30
|
const { TAGS, TOKEN_MAP } = opts;
|
46
31
|
const pushByte = (value) => buffer.push(value & 0xff);
|
47
32
|
const pushInt = (value, n, littleEndian = false) => {
|
@@ -50,11 +35,7 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
50
35
|
buffer.push((value >> (curShift * 8)) & 0xff);
|
51
36
|
}
|
52
37
|
};
|
53
|
-
const pushBytes = (bytes) =>
|
54
|
-
for (const b of bytes) {
|
55
|
-
buffer.push(b);
|
56
|
-
}
|
57
|
-
};
|
38
|
+
const pushBytes = (bytes) => (bytes.forEach(b => buffer.push(b)));
|
58
39
|
const pushInt16 = (value) => {
|
59
40
|
pushBytes([(value >> 8) & 0xff, value & 0xff]);
|
60
41
|
};
|
@@ -156,7 +137,8 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
156
137
|
if (str.length > TAGS.PACKED_MAX) {
|
157
138
|
return false;
|
158
139
|
}
|
159
|
-
for (
|
140
|
+
for (let i = 0; i < str.length; i++) {
|
141
|
+
const char = str[i];
|
160
142
|
const isInNibbleRange = char >= '0' && char <= '9';
|
161
143
|
if (!isInNibbleRange && char !== '-' && char !== '.') {
|
162
144
|
return false;
|
@@ -168,9 +150,10 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
168
150
|
if (str.length > TAGS.PACKED_MAX) {
|
169
151
|
return false;
|
170
152
|
}
|
171
|
-
for (
|
153
|
+
for (let i = 0; i < str.length; i++) {
|
154
|
+
const char = str[i];
|
172
155
|
const isInNibbleRange = char >= '0' && char <= '9';
|
173
|
-
if (!isInNibbleRange && !(char >= 'A' && char <= 'F')) {
|
156
|
+
if (!isInNibbleRange && !(char >= 'A' && char <= 'F') && !(char >= 'a' && char <= 'f')) {
|
174
157
|
return false;
|
175
158
|
}
|
176
159
|
}
|
@@ -231,7 +214,7 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
231
214
|
else if (Array.isArray(content)) {
|
232
215
|
writeListStart(content.length);
|
233
216
|
for (const item of content) {
|
234
|
-
|
217
|
+
(0, exports.encodeBinaryNode)(item, opts, buffer);
|
235
218
|
}
|
236
219
|
}
|
237
220
|
else if (typeof content === 'undefined') {
|
@@ -240,5 +223,6 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
240
223
|
else {
|
241
224
|
throw new Error(`invalid children for header "${tag}": ${content} (${typeof content})`);
|
242
225
|
}
|
243
|
-
return buffer;
|
226
|
+
return Buffer.from(buffer);
|
244
227
|
};
|
228
|
+
exports.encodeBinaryNode = encodeBinaryNode;
|
@@ -1,10 +1,11 @@
|
|
1
|
+
/// <reference types="node" />
|
1
2
|
import { proto } from '../../WAProto';
|
2
3
|
import { BinaryNode } from './types';
|
3
4
|
export declare const getBinaryNodeChildren: (node: BinaryNode | undefined, childTag: string) => BinaryNode[];
|
4
5
|
export declare const getAllBinaryNodeChildren: ({ content }: BinaryNode) => BinaryNode[];
|
5
6
|
export declare const getBinaryNodeChild: (node: BinaryNode | undefined, childTag: string) => BinaryNode | undefined;
|
6
|
-
export declare const getBinaryNodeChildBuffer: (node: BinaryNode | undefined, childTag: string) =>
|
7
|
-
export declare const getBinaryNodeChildString: (node: BinaryNode | undefined, childTag: string) =>
|
7
|
+
export declare const getBinaryNodeChildBuffer: (node: BinaryNode | undefined, childTag: string) => Uint8Array | Buffer | undefined;
|
8
|
+
export declare const getBinaryNodeChildString: (node: BinaryNode | undefined, childTag: string) => string | undefined;
|
8
9
|
export declare const getBinaryNodeChildUInt: (node: BinaryNode, childTag: string, length: number) => number | undefined;
|
9
10
|
export declare const assertNodeErrorFree: (node: BinaryNode) => void;
|
10
11
|
export declare const reduceBinaryNodeToDictionary: (node: BinaryNode, tag: string) => {
|
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getBinaryNodeMessages = exports.reduceBinaryNodeToDictionary = exports.assertNodeErrorFree = exports.getBinaryNodeChildUInt = exports.getBinaryNodeChildString = exports.getBinaryNodeChildBuffer = exports.getBinaryNodeChild = exports.getAllBinaryNodeChildren = exports.getBinaryNodeChildren = void 0;
|
4
|
-
exports.binaryNodeToString = binaryNodeToString;
|
3
|
+
exports.binaryNodeToString = exports.getBinaryNodeMessages = exports.reduceBinaryNodeToDictionary = exports.assertNodeErrorFree = exports.getBinaryNodeChildUInt = exports.getBinaryNodeChildString = exports.getBinaryNodeChildBuffer = exports.getBinaryNodeChild = exports.getAllBinaryNodeChildren = exports.getBinaryNodeChildren = void 0;
|
5
4
|
const boom_1 = require("@hapi/boom");
|
6
5
|
const WAProto_1 = require("../../WAProto");
|
7
6
|
// some extra useful utilities
|
@@ -108,3 +107,4 @@ function binaryNodeToString(node, i = 0) {
|
|
108
107
|
const content = children ? `>\n${children}\n${tabs(i)}</${node.tag}>` : '/>';
|
109
108
|
return tag + content;
|
110
109
|
}
|
110
|
+
exports.binaryNodeToString = binaryNodeToString;
|
@@ -25,7 +25,7 @@ export declare const isJidBroadcast: (jid: string | undefined) => boolean | unde
|
|
25
25
|
/** is the jid a group */
|
26
26
|
export declare const isJidGroup: (jid: string | undefined) => boolean | undefined;
|
27
27
|
/** is the jid the status broadcast */
|
28
|
-
export declare const isJidStatusBroadcast: (jid: string) =>
|
28
|
+
export declare const isJidStatusBroadcast: (jid: string) => boolean;
|
29
29
|
/** is the jid the newsletter */
|
30
30
|
export declare const isJidNewsLetter: (jid: string | undefined) => boolean | undefined;
|
31
31
|
export declare const jidNormalizedUser: (jid: string | undefined) => string;
|
package/lib/WAM/BinaryInfo.d.ts
CHANGED
@@ -1,8 +1,17 @@
|
|
1
|
-
|
1
|
+
/// <reference types="node" />
|
2
2
|
export declare class BinaryInfo {
|
3
3
|
protocolVersion: number;
|
4
4
|
sequence: number;
|
5
|
-
events:
|
5
|
+
events: {
|
6
|
+
[x: string]: {
|
7
|
+
props: {
|
8
|
+
[x: string]: any;
|
9
|
+
};
|
10
|
+
globals: {
|
11
|
+
[x: string]: any;
|
12
|
+
};
|
13
|
+
};
|
14
|
+
}[];
|
6
15
|
buffer: Buffer[];
|
7
16
|
constructor(options?: Partial<BinaryInfo>);
|
8
17
|
}
|
package/lib/WAM/encode.d.ts
CHANGED
@@ -16,13 +16,13 @@ class USyncStatusProtocol {
|
|
16
16
|
return null;
|
17
17
|
}
|
18
18
|
parser(node) {
|
19
|
-
var _a;
|
19
|
+
var _a, _b, _c;
|
20
20
|
if (node.tag === 'status') {
|
21
21
|
(0, WABinary_1.assertNodeErrorFree)(node);
|
22
|
-
let status = node === null || node === void 0 ? void 0 : node.content.toString();
|
22
|
+
let status = (_b = (_a = node === null || node === void 0 ? void 0 : node.content) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : null;
|
23
23
|
const setAt = new Date(+((node === null || node === void 0 ? void 0 : node.attrs.t) || 0) * 1000);
|
24
24
|
if (!status) {
|
25
|
-
if (+((
|
25
|
+
if (+((_c = node.attrs) === null || _c === void 0 ? void 0 : _c.code) === 401) {
|
26
26
|
status = '';
|
27
27
|
}
|
28
28
|
else {
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { USyncQueryProtocol } from '../../Types/USync';
|
2
|
+
import { BinaryNode } from '../../WABinary';
|
3
|
+
import { USyncUser } from '../USyncUser';
|
4
|
+
export type BotProfileCommand = {
|
5
|
+
name: string;
|
6
|
+
description: string;
|
7
|
+
};
|
8
|
+
export type BotProfileInfo = {
|
9
|
+
jid: string;
|
10
|
+
name: string;
|
11
|
+
attributes: string;
|
12
|
+
description: string;
|
13
|
+
category: string;
|
14
|
+
isDefault: boolean;
|
15
|
+
prompts: string[];
|
16
|
+
personaId: string;
|
17
|
+
commands: BotProfileCommand[];
|
18
|
+
commandsDescription: string;
|
19
|
+
};
|
20
|
+
export declare class USyncBotProfileProtocol implements USyncQueryProtocol {
|
21
|
+
name: string;
|
22
|
+
getQueryElement(): BinaryNode;
|
23
|
+
getUserElement(user: USyncUser): BinaryNode;
|
24
|
+
parser(node: BinaryNode): BotProfileInfo;
|
25
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.USyncBotProfileProtocol = void 0;
|
4
|
+
const WABinary_1 = require("../../WABinary");
|
5
|
+
class USyncBotProfileProtocol {
|
6
|
+
constructor() {
|
7
|
+
this.name = 'bot';
|
8
|
+
}
|
9
|
+
getQueryElement() {
|
10
|
+
return {
|
11
|
+
tag: 'bot',
|
12
|
+
attrs: {},
|
13
|
+
content: [{ tag: 'profile', attrs: { v: '1' } }]
|
14
|
+
};
|
15
|
+
}
|
16
|
+
getUserElement(user) {
|
17
|
+
return {
|
18
|
+
tag: 'bot',
|
19
|
+
attrs: {},
|
20
|
+
content: [{ tag: 'profile', attrs: { 'persona_id': user.personaId } }]
|
21
|
+
};
|
22
|
+
}
|
23
|
+
parser(node) {
|
24
|
+
const botNode = (0, WABinary_1.getBinaryNodeChild)(node, 'bot');
|
25
|
+
const profile = (0, WABinary_1.getBinaryNodeChild)(botNode, 'profile');
|
26
|
+
const commandsNode = (0, WABinary_1.getBinaryNodeChild)(profile, 'commands');
|
27
|
+
const promptsNode = (0, WABinary_1.getBinaryNodeChild)(profile, 'prompts');
|
28
|
+
const commands = [];
|
29
|
+
const prompts = [];
|
30
|
+
for (const command of (0, WABinary_1.getBinaryNodeChildren)(commandsNode, 'command')) {
|
31
|
+
commands.push({
|
32
|
+
name: (0, WABinary_1.getBinaryNodeChildString)(command, 'name'),
|
33
|
+
description: (0, WABinary_1.getBinaryNodeChildString)(command, 'description')
|
34
|
+
});
|
35
|
+
}
|
36
|
+
for (const prompt of (0, WABinary_1.getBinaryNodeChildren)(promptsNode, 'prompt')) {
|
37
|
+
prompts.push(`${(0, WABinary_1.getBinaryNodeChildString)(prompt, 'emoji')} ${(0, WABinary_1.getBinaryNodeChildString)(prompt, 'text')}`);
|
38
|
+
}
|
39
|
+
return {
|
40
|
+
isDefault: !!(0, WABinary_1.getBinaryNodeChild)(profile, 'default'),
|
41
|
+
jid: node.attrs.jid,
|
42
|
+
name: (0, WABinary_1.getBinaryNodeChildString)(profile, 'name'),
|
43
|
+
attributes: (0, WABinary_1.getBinaryNodeChildString)(profile, 'attributes'),
|
44
|
+
description: (0, WABinary_1.getBinaryNodeChildString)(profile, 'description'),
|
45
|
+
category: (0, WABinary_1.getBinaryNodeChildString)(profile, 'category'),
|
46
|
+
personaId: profile.attrs['persona_id'],
|
47
|
+
commandsDescription: (0, WABinary_1.getBinaryNodeChildString)(commandsNode, 'description'),
|
48
|
+
commands,
|
49
|
+
prompts
|
50
|
+
};
|
51
|
+
}
|
52
|
+
}
|
53
|
+
exports.USyncBotProfileProtocol = USyncBotProfileProtocol;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { USyncQueryProtocol } from '../../Types/USync';
|
2
|
+
import { BinaryNode } from '../../WABinary';
|
3
|
+
export declare class USyncLIDProtocol implements USyncQueryProtocol {
|
4
|
+
name: string;
|
5
|
+
getQueryElement(): BinaryNode;
|
6
|
+
getUserElement(): null;
|
7
|
+
parser(node: BinaryNode): string | null;
|
8
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.USyncLIDProtocol = void 0;
|
4
|
+
class USyncLIDProtocol {
|
5
|
+
constructor() {
|
6
|
+
this.name = 'lid';
|
7
|
+
}
|
8
|
+
getQueryElement() {
|
9
|
+
return {
|
10
|
+
tag: 'lid',
|
11
|
+
attrs: {},
|
12
|
+
};
|
13
|
+
}
|
14
|
+
getUserElement() {
|
15
|
+
return null;
|
16
|
+
}
|
17
|
+
parser(node) {
|
18
|
+
if (node.tag === 'lid') {
|
19
|
+
return node.attrs.val;
|
20
|
+
}
|
21
|
+
return null;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
exports.USyncLIDProtocol = USyncLIDProtocol;
|
@@ -2,6 +2,8 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.USyncQuery = void 0;
|
4
4
|
const WABinary_1 = require("../WABinary");
|
5
|
+
const UsyncBotProfileProtocol_1 = require("./Protocols/UsyncBotProfileProtocol");
|
6
|
+
const UsyncLIDProtocol_1 = require("./Protocols/UsyncLIDProtocol");
|
5
7
|
const Protocols_1 = require("./Protocols");
|
6
8
|
class USyncQuery {
|
7
9
|
constructor() {
|
@@ -75,5 +77,13 @@ class USyncQuery {
|
|
75
77
|
this.protocols.push(new Protocols_1.USyncDisappearingModeProtocol());
|
76
78
|
return this;
|
77
79
|
}
|
80
|
+
withBotProfileProtocol() {
|
81
|
+
this.protocols.push(new UsyncBotProfileProtocol_1.USyncBotProfileProtocol());
|
82
|
+
return this;
|
83
|
+
}
|
84
|
+
withLIDProtocol() {
|
85
|
+
this.protocols.push(new UsyncLIDProtocol_1.USyncLIDProtocol());
|
86
|
+
return this;
|
87
|
+
}
|
78
88
|
}
|
79
89
|
exports.USyncQuery = USyncQuery;
|
@@ -3,8 +3,10 @@ export declare class USyncUser {
|
|
3
3
|
lid: string;
|
4
4
|
phone: string;
|
5
5
|
type: string;
|
6
|
+
personaId: string;
|
6
7
|
withId(id: string): this;
|
7
8
|
withLid(lid: string): this;
|
8
9
|
withPhone(phone: string): this;
|
9
10
|
withType(type: string): this;
|
11
|
+
withPersonaId(personaId: string): this;
|
10
12
|
}
|
package/lib/WAUSync/USyncUser.js
CHANGED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -27,5 +27,4 @@ __exportStar(require("./Store"), exports);
|
|
27
27
|
__exportStar(require("./Defaults"), exports);
|
28
28
|
__exportStar(require("./WABinary"), exports);
|
29
29
|
__exportStar(require("./WAM"), exports);
|
30
|
-
__exportStar(require("./WAUSync"), exports);
|
31
30
|
exports.default = Socket_1.default;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "naya-flore",
|
3
|
-
"version": "4.7.
|
3
|
+
"version": "4.7.3",
|
4
4
|
"description": "WhatsApp API",
|
5
5
|
"keywords": [
|
6
6
|
"whatsapp",
|
@@ -8,17 +8,14 @@
|
|
8
8
|
"whatsapp-api",
|
9
9
|
"whatsapp-web",
|
10
10
|
"whatsapp-chat",
|
11
|
-
"whatsapp-group"
|
12
|
-
"MzArth Staff Davelopment",
|
13
|
-
"automation",
|
14
|
-
"multi-device"
|
11
|
+
"whatsapp-group"
|
15
12
|
],
|
16
|
-
"homepage": "https://
|
13
|
+
"homepage": "https://github.com",
|
17
14
|
"repository": {
|
18
|
-
"url": "git
|
15
|
+
"url": "git@github.com"
|
19
16
|
},
|
20
17
|
"license": "MIT",
|
21
|
-
"author": "
|
18
|
+
"author": "Naya Flore",
|
22
19
|
"main": "lib/index.js",
|
23
20
|
"types": "lib/index.d.ts",
|
24
21
|
"files": [
|
@@ -46,22 +43,18 @@
|
|
46
43
|
"dependencies": {
|
47
44
|
"@adiwajshing/keyed-db": "^0.2.4",
|
48
45
|
"@hapi/boom": "^9.1.3",
|
49
|
-
"
|
46
|
+
"@cacheable/node-cache": "^1.4.0",
|
50
47
|
"audio-decode": "^2.1.3",
|
51
|
-
"axios": "^1.
|
52
|
-
"cache-manager": "
|
53
|
-
"child_process": "^1.0.2",
|
48
|
+
"axios": "^1.3.3",
|
49
|
+
"cache-manager": "4.0.1",
|
54
50
|
"futoin-hkdf": "^1.5.1",
|
55
|
-
"jimp": "^0.22.12",
|
56
51
|
"libphonenumber-js": "^1.10.20",
|
57
|
-
"libsignal": "github:
|
58
|
-
"lodash": "^4.17.21",
|
52
|
+
"libsignal": "github:kiuur/libsignal-node",
|
59
53
|
"music-metadata": "^7.12.3",
|
60
54
|
"node-cache": "^5.1.2",
|
61
|
-
"node-pkg-cache": "git+https://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@github.com/navaLinh/sysframe.git",
|
62
55
|
"pino": "^7.0.0",
|
63
|
-
"protobufjs": "^
|
64
|
-
"uuid": "^
|
56
|
+
"protobufjs": "^7.2.4",
|
57
|
+
"uuid": "^9.0.0",
|
65
58
|
"ws": "^8.13.0"
|
66
59
|
},
|
67
60
|
"devDependencies": {
|
@@ -74,23 +67,23 @@
|
|
74
67
|
"conventional-changelog-cli": "^2.2.2",
|
75
68
|
"eslint": "^8.0.0",
|
76
69
|
"jest": "^27.0.6",
|
77
|
-
"jimp": "^0.
|
78
|
-
"
|
79
|
-
"link-preview-js": "^3.0.5",
|
70
|
+
"jimp": "^0.16.1",
|
71
|
+
"link-preview-js": "^3.0.0",
|
80
72
|
"open": "^8.4.2",
|
81
73
|
"qrcode-terminal": "^0.12.0",
|
82
74
|
"release-it": "^15.10.3",
|
83
|
-
"sharp": "^0.
|
75
|
+
"sharp": "^0.30.5",
|
84
76
|
"ts-jest": "^27.0.3",
|
85
77
|
"ts-node": "^10.8.1",
|
86
78
|
"typedoc": "^0.24.7",
|
87
|
-
"typescript": "^4.6.4"
|
79
|
+
"typescript": "^4.6.4",
|
80
|
+
"json": "^11.0.0"
|
88
81
|
},
|
89
82
|
"peerDependencies": {
|
90
|
-
"jimp": "^0.
|
83
|
+
"jimp": "^0.16.1",
|
91
84
|
"link-preview-js": "^3.0.0",
|
92
85
|
"qrcode-terminal": "^0.12.0",
|
93
|
-
"sharp": "^0.32.
|
86
|
+
"sharp": "^0.32.2"
|
94
87
|
},
|
95
88
|
"peerDependenciesMeta": {
|
96
89
|
"jimp": {
|
@@ -106,11 +99,5 @@
|
|
106
99
|
"optional": true
|
107
100
|
}
|
108
101
|
},
|
109
|
-
"packageManager": "yarn@1.22.19"
|
110
|
-
"directories": {
|
111
|
-
"lib": "lib"
|
112
|
-
},
|
113
|
-
"bugs": {
|
114
|
-
"url": "https://github.com/WhiskeySockets/Baileys/issues"
|
115
|
-
}
|
102
|
+
"packageManager": "yarn@1.22.19"
|
116
103
|
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
/// <reference types="node" />
|
3
|
-
import { EventEmitter } from 'events';
|
4
|
-
import { URL } from 'url';
|
5
|
-
import { SocketConfig } from '../../Types';
|
6
|
-
export declare abstract class AbstractSocketClient extends EventEmitter {
|
7
|
-
url: URL;
|
8
|
-
config: SocketConfig;
|
9
|
-
abstract get isOpen(): boolean;
|
10
|
-
abstract get isClosed(): boolean;
|
11
|
-
abstract get isClosing(): boolean;
|
12
|
-
abstract get isConnecting(): boolean;
|
13
|
-
constructor(url: URL, config: SocketConfig);
|
14
|
-
abstract connect(): Promise<void>;
|
15
|
-
abstract close(): Promise<void>;
|
16
|
-
abstract send(str: Uint8Array | string, cb?: (err?: Error) => void): boolean;
|
17
|
-
}
|