@d0v3riz/baileys 6.7.21 → 6.7.22
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/GenerateStatics.sh +2 -3
- package/WAProto/index.js +4138 -4136
- package/lib/Defaults/index.d.ts +2 -3
- package/lib/Defaults/index.js +40 -36
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -1
- package/lib/Signal/Group/ciphertext-message.js +5 -2
- package/lib/Signal/Group/group-session-builder.d.ts +3 -4
- package/lib/Signal/Group/group-session-builder.js +41 -7
- package/lib/Signal/Group/group_cipher.d.ts +2 -3
- package/lib/Signal/Group/group_cipher.js +16 -14
- package/lib/Signal/Group/index.d.ts +11 -12
- package/lib/Signal/Group/index.js +57 -12
- package/lib/Signal/Group/keyhelper.d.ts +1 -2
- package/lib/Signal/Group/keyhelper.js +44 -8
- package/lib/Signal/Group/queue-job.d.ts +0 -2
- package/lib/Signal/Group/queue-job.js +5 -5
- package/lib/Signal/Group/sender-chain-key.d.ts +1 -2
- package/lib/Signal/Group/sender-chain-key.js +9 -7
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +1 -2
- package/lib/Signal/Group/sender-key-distribution-message.js +9 -6
- package/lib/Signal/Group/sender-key-message.d.ts +1 -2
- package/lib/Signal/Group/sender-key-message.js +12 -10
- package/lib/Signal/Group/sender-key-name.d.ts +0 -1
- package/lib/Signal/Group/sender-key-name.js +5 -2
- package/lib/Signal/Group/sender-key-record.d.ts +1 -2
- package/lib/Signal/Group/sender-key-record.js +12 -9
- package/lib/Signal/Group/sender-key-state.d.ts +2 -3
- package/lib/Signal/Group/sender-key-state.js +9 -6
- package/lib/Signal/Group/sender-message-key.d.ts +0 -1
- package/lib/Signal/Group/sender-message-key.js +7 -5
- package/lib/Signal/libsignal.d.ts +2 -3
- package/lib/Signal/libsignal.js +55 -22
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +18 -3
- package/lib/Socket/Client/types.d.ts +1 -2
- package/lib/Socket/Client/types.js +6 -4
- package/lib/Socket/Client/websocket.d.ts +1 -2
- package/lib/Socket/Client/websocket.js +26 -14
- package/lib/Socket/business.d.ts +64 -66
- package/lib/Socket/business.js +37 -32
- package/lib/Socket/chats.d.ts +19 -21
- package/lib/Socket/chats.js +141 -176
- package/lib/Socket/groups.d.ts +35 -37
- package/lib/Socket/groups.js +63 -56
- package/lib/Socket/index.d.ts +70 -102
- package/lib/Socket/index.js +9 -16
- package/lib/Socket/messages-recv.d.ts +49 -51
- package/lib/Socket/messages-recv.js +173 -180
- package/lib/Socket/messages-send.d.ts +46 -48
- package/lib/Socket/messages-send.js +84 -75
- package/lib/Socket/mex.d.ts +1 -2
- package/lib/Socket/mex.js +16 -12
- package/lib/Socket/newsletter.d.ts +44 -46
- package/lib/Socket/newsletter.js +27 -23
- package/lib/Socket/socket.d.ts +12 -13
- package/lib/Socket/socket.js +115 -135
- package/lib/Socket/usync.d.ts +14 -15
- package/lib/Socket/usync.js +11 -9
- package/lib/Types/Auth.d.ts +3 -4
- package/lib/Types/Auth.js +2 -2
- package/lib/Types/Call.d.ts +0 -1
- package/lib/Types/Call.js +2 -2
- package/lib/Types/Chat.d.ts +7 -10
- package/lib/Types/Chat.js +4 -2
- package/lib/Types/Contact.d.ts +0 -1
- package/lib/Types/Contact.js +2 -2
- package/lib/Types/Events.d.ts +10 -11
- package/lib/Types/Events.js +2 -2
- package/lib/Types/GroupMetadata.d.ts +2 -3
- package/lib/Types/GroupMetadata.js +2 -2
- package/lib/Types/Label.d.ts +0 -1
- package/lib/Types/Label.js +5 -3
- package/lib/Types/LabelAssociation.d.ts +0 -1
- package/lib/Types/LabelAssociation.js +5 -3
- package/lib/Types/Message.d.ts +7 -9
- package/lib/Types/Message.js +7 -7
- package/lib/Types/Newsletter.d.ts +0 -1
- package/lib/Types/Newsletter.js +7 -5
- package/lib/Types/Product.d.ts +1 -2
- package/lib/Types/Product.js +2 -2
- package/lib/Types/Signal.d.ts +1 -2
- package/lib/Types/Signal.js +2 -2
- package/lib/Types/Socket.d.ts +7 -8
- package/lib/Types/Socket.js +2 -3
- package/lib/Types/State.d.ts +2 -14
- package/lib/Types/State.js +2 -13
- package/lib/Types/USync.d.ts +2 -3
- package/lib/Types/USync.js +2 -2
- package/lib/Types/index.d.ts +14 -15
- package/lib/Types/index.js +31 -15
- package/lib/Utils/auth-utils.d.ts +2 -3
- package/lib/Utils/auth-utils.js +34 -25
- package/lib/Utils/baileys-event-stream.d.ts +1 -2
- package/lib/Utils/baileys-event-stream.js +22 -15
- package/lib/Utils/business.d.ts +2 -3
- package/lib/Utils/business.js +70 -61
- package/lib/Utils/chat-utils.d.ts +7 -8
- package/lib/Utils/chat-utils.js +137 -130
- package/lib/Utils/crypto.d.ts +1 -2
- package/lib/Utils/crypto.js +86 -37
- package/lib/Utils/decode-wa-message.d.ts +4 -5
- package/lib/Utils/decode-wa-message.js +44 -38
- package/lib/Utils/event-buffer.d.ts +4 -4
- package/lib/Utils/event-buffer.js +50 -37
- package/lib/Utils/generics.d.ts +8 -9
- package/lib/Utils/generics.js +114 -87
- package/lib/Utils/history.d.ts +3 -4
- package/lib/Utils/history.js +40 -32
- package/lib/Utils/index.d.ts +17 -18
- package/lib/Utils/index.js +33 -18
- package/lib/Utils/link-preview.d.ts +3 -4
- package/lib/Utils/link-preview.js +47 -10
- package/lib/Utils/logger.d.ts +6 -8
- package/lib/Utils/logger.js +7 -3
- package/lib/Utils/lt-hash.d.ts +8 -9
- package/lib/Utils/lt-hash.js +26 -23
- package/lib/Utils/make-mutex.d.ts +0 -1
- package/lib/Utils/make-mutex.js +9 -5
- package/lib/Utils/messages-media.d.ts +10 -11
- package/lib/Utils/messages-media.js +203 -141
- package/lib/Utils/messages.d.ts +6 -7
- package/lib/Utils/messages.js +199 -190
- package/lib/Utils/noise-handler.d.ts +4 -5
- package/lib/Utils/noise-handler.js +26 -22
- package/lib/Utils/process-message.d.ts +4 -5
- package/lib/Utils/process-message.js +104 -95
- package/lib/Utils/signal.d.ts +4 -5
- package/lib/Utils/signal.js +52 -47
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -2
- package/lib/Utils/use-multi-file-auth-state.js +26 -23
- package/lib/Utils/validate-connection.d.ts +3 -4
- package/lib/Utils/validate-connection.js +58 -52
- package/lib/WABinary/constants.d.ts +0 -1
- package/lib/WABinary/constants.js +11 -9
- package/lib/WABinary/decode.d.ts +1 -2
- package/lib/WABinary/decode.js +51 -13
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +41 -5
- package/lib/WABinary/generic-utils.d.ts +3 -4
- package/lib/WABinary/generic-utils.js +38 -30
- package/lib/WABinary/index.d.ts +5 -6
- package/lib/WABinary/index.js +21 -6
- package/lib/WABinary/jid-utils.d.ts +0 -1
- package/lib/WABinary/jid-utils.js +35 -21
- package/lib/WABinary/types.d.ts +1 -2
- package/lib/WABinary/types.js +2 -2
- package/lib/WAM/BinaryInfo.d.ts +1 -2
- package/lib/WAM/BinaryInfo.js +5 -2
- package/lib/WAM/constants.d.ts +0 -1
- package/lib/WAM/constants.js +6 -4
- package/lib/WAM/encode.d.ts +1 -2
- package/lib/WAM/encode.js +14 -12
- package/lib/WAM/index.d.ts +3 -4
- package/lib/WAM/index.js +19 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +9 -6
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +12 -9
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +9 -6
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +11 -7
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +21 -19
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +5 -2
- package/lib/WAUSync/Protocols/index.d.ts +4 -5
- package/lib/WAUSync/Protocols/index.js +20 -5
- package/lib/WAUSync/USyncQuery.d.ts +3 -4
- package/lib/WAUSync/USyncQuery.js +20 -18
- package/lib/WAUSync/USyncUser.d.ts +5 -6
- package/lib/WAUSync/USyncUser.js +5 -2
- package/lib/WAUSync/index.d.ts +3 -4
- package/lib/WAUSync/index.js +19 -4
- package/lib/index.d.ts +8 -9
- package/lib/index.js +30 -11
- package/package.json +26 -26
- package/WAProto/fix-imports.js +0 -29
- package/lib/Defaults/index.d.ts.map +0 -1
- package/lib/Defaults/index.js.map +0 -1
- package/lib/Signal/Group/ciphertext-message.d.ts.map +0 -1
- package/lib/Signal/Group/ciphertext-message.js.map +0 -1
- package/lib/Signal/Group/group-session-builder.d.ts.map +0 -1
- package/lib/Signal/Group/group-session-builder.js.map +0 -1
- package/lib/Signal/Group/group_cipher.d.ts.map +0 -1
- package/lib/Signal/Group/group_cipher.js.map +0 -1
- package/lib/Signal/Group/index.d.ts.map +0 -1
- package/lib/Signal/Group/index.js.map +0 -1
- package/lib/Signal/Group/keyhelper.d.ts.map +0 -1
- package/lib/Signal/Group/keyhelper.js.map +0 -1
- package/lib/Signal/Group/queue-job.d.ts.map +0 -1
- package/lib/Signal/Group/queue-job.js.map +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-chain-key.js.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-name.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-name.js.map +0 -1
- package/lib/Signal/Group/sender-key-record.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-record.js.map +0 -1
- package/lib/Signal/Group/sender-key-state.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-state.js.map +0 -1
- package/lib/Signal/Group/sender-message-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-message-key.js.map +0 -1
- package/lib/Signal/libsignal.d.ts.map +0 -1
- package/lib/Signal/libsignal.js.map +0 -1
- package/lib/Socket/Client/index.d.ts.map +0 -1
- package/lib/Socket/Client/index.js.map +0 -1
- package/lib/Socket/Client/types.d.ts.map +0 -1
- package/lib/Socket/Client/types.js.map +0 -1
- package/lib/Socket/Client/websocket.d.ts.map +0 -1
- package/lib/Socket/Client/websocket.js.map +0 -1
- package/lib/Socket/business.d.ts.map +0 -1
- package/lib/Socket/business.js.map +0 -1
- package/lib/Socket/chats.d.ts.map +0 -1
- package/lib/Socket/chats.js.map +0 -1
- package/lib/Socket/communities.d.ts +0 -219
- package/lib/Socket/communities.d.ts.map +0 -1
- package/lib/Socket/communities.js +0 -351
- package/lib/Socket/communities.js.map +0 -1
- package/lib/Socket/groups.d.ts.map +0 -1
- package/lib/Socket/groups.js.map +0 -1
- package/lib/Socket/index.d.ts.map +0 -1
- package/lib/Socket/index.js.map +0 -1
- package/lib/Socket/messages-recv.d.ts.map +0 -1
- package/lib/Socket/messages-recv.js.map +0 -1
- package/lib/Socket/messages-send.d.ts.map +0 -1
- package/lib/Socket/messages-send.js.map +0 -1
- package/lib/Socket/mex.d.ts.map +0 -1
- package/lib/Socket/mex.js.map +0 -1
- package/lib/Socket/newsletter.d.ts.map +0 -1
- package/lib/Socket/newsletter.js.map +0 -1
- package/lib/Socket/socket.d.ts.map +0 -1
- package/lib/Socket/socket.js.map +0 -1
- package/lib/Socket/usync.d.ts.map +0 -1
- package/lib/Socket/usync.js.map +0 -1
- package/lib/Types/Auth.d.ts.map +0 -1
- package/lib/Types/Auth.js.map +0 -1
- package/lib/Types/Call.d.ts.map +0 -1
- package/lib/Types/Call.js.map +0 -1
- package/lib/Types/Chat.d.ts.map +0 -1
- package/lib/Types/Chat.js.map +0 -1
- package/lib/Types/Contact.d.ts.map +0 -1
- package/lib/Types/Contact.js.map +0 -1
- package/lib/Types/Events.d.ts.map +0 -1
- package/lib/Types/Events.js.map +0 -1
- package/lib/Types/GroupMetadata.d.ts.map +0 -1
- package/lib/Types/GroupMetadata.js.map +0 -1
- package/lib/Types/Label.d.ts.map +0 -1
- package/lib/Types/Label.js.map +0 -1
- package/lib/Types/LabelAssociation.d.ts.map +0 -1
- package/lib/Types/LabelAssociation.js.map +0 -1
- package/lib/Types/Message.d.ts.map +0 -1
- package/lib/Types/Message.js.map +0 -1
- package/lib/Types/Newsletter.d.ts.map +0 -1
- package/lib/Types/Newsletter.js.map +0 -1
- package/lib/Types/Product.d.ts.map +0 -1
- package/lib/Types/Product.js.map +0 -1
- package/lib/Types/Signal.d.ts.map +0 -1
- package/lib/Types/Signal.js.map +0 -1
- package/lib/Types/Socket.d.ts.map +0 -1
- package/lib/Types/Socket.js.map +0 -1
- package/lib/Types/State.d.ts.map +0 -1
- package/lib/Types/State.js.map +0 -1
- package/lib/Types/USync.d.ts.map +0 -1
- package/lib/Types/USync.js.map +0 -1
- package/lib/Types/index.d.ts.map +0 -1
- package/lib/Types/index.js.map +0 -1
- package/lib/Utils/auth-utils.d.ts.map +0 -1
- package/lib/Utils/auth-utils.js.map +0 -1
- package/lib/Utils/baileys-event-stream.d.ts.map +0 -1
- package/lib/Utils/baileys-event-stream.js.map +0 -1
- package/lib/Utils/business.d.ts.map +0 -1
- package/lib/Utils/business.js.map +0 -1
- package/lib/Utils/chat-utils.d.ts.map +0 -1
- package/lib/Utils/chat-utils.js.map +0 -1
- package/lib/Utils/crypto.d.ts.map +0 -1
- package/lib/Utils/crypto.js.map +0 -1
- package/lib/Utils/decode-wa-message.d.ts.map +0 -1
- package/lib/Utils/decode-wa-message.js.map +0 -1
- package/lib/Utils/event-buffer.d.ts.map +0 -1
- package/lib/Utils/event-buffer.js.map +0 -1
- package/lib/Utils/generics.d.ts.map +0 -1
- package/lib/Utils/generics.js.map +0 -1
- package/lib/Utils/history.d.ts.map +0 -1
- package/lib/Utils/history.js.map +0 -1
- package/lib/Utils/index.d.ts.map +0 -1
- package/lib/Utils/index.js.map +0 -1
- package/lib/Utils/link-preview.d.ts.map +0 -1
- package/lib/Utils/link-preview.js.map +0 -1
- package/lib/Utils/logger.d.ts.map +0 -1
- package/lib/Utils/logger.js.map +0 -1
- package/lib/Utils/lt-hash.d.ts.map +0 -1
- package/lib/Utils/lt-hash.js.map +0 -1
- package/lib/Utils/make-mutex.d.ts.map +0 -1
- package/lib/Utils/make-mutex.js.map +0 -1
- package/lib/Utils/messages-media.d.ts.map +0 -1
- package/lib/Utils/messages-media.js.map +0 -1
- package/lib/Utils/messages.d.ts.map +0 -1
- package/lib/Utils/messages.js.map +0 -1
- package/lib/Utils/noise-handler.d.ts.map +0 -1
- package/lib/Utils/noise-handler.js.map +0 -1
- package/lib/Utils/process-message.d.ts.map +0 -1
- package/lib/Utils/process-message.js.map +0 -1
- package/lib/Utils/signal.d.ts.map +0 -1
- package/lib/Utils/signal.js.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.js.map +0 -1
- package/lib/Utils/validate-connection.d.ts.map +0 -1
- package/lib/Utils/validate-connection.js.map +0 -1
- package/lib/WABinary/constants.d.ts.map +0 -1
- package/lib/WABinary/constants.js.map +0 -1
- package/lib/WABinary/decode.d.ts.map +0 -1
- package/lib/WABinary/decode.js.map +0 -1
- package/lib/WABinary/encode.d.ts.map +0 -1
- package/lib/WABinary/encode.js.map +0 -1
- package/lib/WABinary/generic-utils.d.ts.map +0 -1
- package/lib/WABinary/generic-utils.js.map +0 -1
- package/lib/WABinary/index.d.ts.map +0 -1
- package/lib/WABinary/index.js.map +0 -1
- package/lib/WABinary/jid-utils.d.ts.map +0 -1
- package/lib/WABinary/jid-utils.js.map +0 -1
- package/lib/WABinary/types.d.ts.map +0 -1
- package/lib/WABinary/types.js.map +0 -1
- package/lib/WAM/BinaryInfo.d.ts.map +0 -1
- package/lib/WAM/BinaryInfo.js.map +0 -1
- package/lib/WAM/constants.d.ts.map +0 -1
- package/lib/WAM/constants.js.map +0 -1
- package/lib/WAM/encode.d.ts.map +0 -1
- package/lib/WAM/encode.js.map +0 -1
- package/lib/WAM/index.d.ts.map +0 -1
- package/lib/WAM/index.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/index.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/index.js.map +0 -1
- package/lib/WAUSync/USyncQuery.d.ts.map +0 -1
- package/lib/WAUSync/USyncQuery.js.map +0 -1
- package/lib/WAUSync/USyncUser.d.ts.map +0 -1
- package/lib/WAUSync/USyncUser.js.map +0 -1
- package/lib/WAUSync/index.d.ts.map +0 -1
- package/lib/WAUSync/index.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
package/lib/Defaults/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { proto } from '../../WAProto
|
|
2
|
-
import type { MediaType, SocketConfig } from '../Types
|
|
1
|
+
import { proto } from '../../WAProto';
|
|
2
|
+
import type { MediaType, SocketConfig } from '../Types';
|
|
3
3
|
export declare const UNAUTHORIZED_CODES: number[];
|
|
4
4
|
export declare const DEFAULT_ORIGIN = "https://web.whatsapp.com";
|
|
5
5
|
export declare const DEF_CALLBACK_PREFIX = "CB:";
|
|
@@ -49,4 +49,3 @@ export declare const DEFAULT_CACHE_TTLS: {
|
|
|
49
49
|
CALL_OFFER: number;
|
|
50
50
|
USER_DEVICES: number;
|
|
51
51
|
};
|
|
52
|
-
//# sourceMappingURL=index.d.ts.map
|
package/lib/Defaults/index.js
CHANGED
|
@@ -1,38 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DEFAULT_CACHE_TTLS = exports.INITIAL_PREKEY_COUNT = exports.MIN_PREKEY_COUNT = exports.MEDIA_KEYS = exports.MEDIA_HKDF_KEY_MAPPING = exports.MEDIA_PATH_MAP = exports.DEFAULT_CONNECTION_CONFIG = exports.PROCESSABLE_HISTORY_TYPES = exports.WA_CERT_DETAILS = exports.URL_REGEX = exports.NOISE_WA_HEADER = exports.KEY_BUNDLE_TYPE = exports.DICT_VERSION = exports.NOISE_MODE = exports.WA_DEFAULT_EPHEMERAL = exports.PHONE_CONNECTION_CB = exports.DEF_TAG_PREFIX = exports.DEF_CALLBACK_PREFIX = exports.DEFAULT_ORIGIN = exports.UNAUTHORIZED_CODES = void 0;
|
|
7
|
+
const WAProto_1 = require("../../WAProto");
|
|
8
|
+
const libsignal_1 = require("../Signal/libsignal");
|
|
9
|
+
const Utils_1 = require("../Utils");
|
|
10
|
+
const logger_1 = __importDefault(require("../Utils/logger"));
|
|
11
|
+
const baileys_version_json_1 = require("./baileys-version.json");
|
|
12
|
+
exports.UNAUTHORIZED_CODES = [401, 403, 419];
|
|
13
|
+
exports.DEFAULT_ORIGIN = 'https://web.whatsapp.com';
|
|
14
|
+
exports.DEF_CALLBACK_PREFIX = 'CB:';
|
|
15
|
+
exports.DEF_TAG_PREFIX = 'TAG:';
|
|
16
|
+
exports.PHONE_CONNECTION_CB = 'CB:Pong';
|
|
17
|
+
exports.WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60;
|
|
18
|
+
exports.NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0';
|
|
19
|
+
exports.DICT_VERSION = 3;
|
|
20
|
+
exports.KEY_BUNDLE_TYPE = Buffer.from([5]);
|
|
21
|
+
exports.NOISE_WA_HEADER = Buffer.from([87, 65, 6, exports.DICT_VERSION]); // last is "DICT_VERSION"
|
|
17
22
|
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
exports.URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g;
|
|
24
|
+
exports.WA_CERT_DETAILS = {
|
|
20
25
|
SERIAL: 0
|
|
21
26
|
};
|
|
22
|
-
|
|
23
|
-
proto.Message.HistorySyncNotification.HistorySyncType.INITIAL_BOOTSTRAP,
|
|
24
|
-
proto.Message.HistorySyncNotification.HistorySyncType.PUSH_NAME,
|
|
25
|
-
proto.Message.HistorySyncNotification.HistorySyncType.RECENT,
|
|
26
|
-
proto.Message.HistorySyncNotification.HistorySyncType.FULL,
|
|
27
|
-
proto.Message.HistorySyncNotification.HistorySyncType.ON_DEMAND
|
|
27
|
+
exports.PROCESSABLE_HISTORY_TYPES = [
|
|
28
|
+
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.INITIAL_BOOTSTRAP,
|
|
29
|
+
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.PUSH_NAME,
|
|
30
|
+
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.RECENT,
|
|
31
|
+
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.FULL,
|
|
32
|
+
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.ON_DEMAND
|
|
28
33
|
];
|
|
29
|
-
|
|
30
|
-
version: version,
|
|
31
|
-
browser: Browsers.ubuntu('Chrome'),
|
|
34
|
+
exports.DEFAULT_CONNECTION_CONFIG = {
|
|
35
|
+
version: baileys_version_json_1.version,
|
|
36
|
+
browser: Utils_1.Browsers.ubuntu('Chrome'),
|
|
32
37
|
waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
|
|
33
38
|
connectTimeoutMs: 20000,
|
|
34
39
|
keepAliveIntervalMs: 30000,
|
|
35
|
-
logger:
|
|
40
|
+
logger: logger_1.default.child({ class: 'baileys' }),
|
|
36
41
|
emitOwnEvents: true,
|
|
37
42
|
defaultQueryTimeoutMs: 60000,
|
|
38
43
|
customUploadHosts: [],
|
|
@@ -56,9 +61,9 @@ export const DEFAULT_CONNECTION_CONFIG = {
|
|
|
56
61
|
countryCode: 'US',
|
|
57
62
|
getMessage: async () => undefined,
|
|
58
63
|
cachedGroupMetadata: async () => undefined,
|
|
59
|
-
makeSignalRepository: makeLibSignalRepository
|
|
64
|
+
makeSignalRepository: libsignal_1.makeLibSignalRepository
|
|
60
65
|
};
|
|
61
|
-
|
|
66
|
+
exports.MEDIA_PATH_MAP = {
|
|
62
67
|
image: '/mms/image',
|
|
63
68
|
video: '/mms/video',
|
|
64
69
|
document: '/mms/document',
|
|
@@ -69,7 +74,7 @@ export const MEDIA_PATH_MAP = {
|
|
|
69
74
|
'md-app-state': '',
|
|
70
75
|
'md-msg-hist': '/mms/md-app-state'
|
|
71
76
|
};
|
|
72
|
-
|
|
77
|
+
exports.MEDIA_HKDF_KEY_MAPPING = {
|
|
73
78
|
audio: 'Audio',
|
|
74
79
|
document: 'Document',
|
|
75
80
|
gif: 'Video',
|
|
@@ -89,13 +94,12 @@ export const MEDIA_HKDF_KEY_MAPPING = {
|
|
|
89
94
|
'payment-bg-image': 'Payment Background',
|
|
90
95
|
ptv: 'Video'
|
|
91
96
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
exports.MEDIA_KEYS = Object.keys(exports.MEDIA_PATH_MAP);
|
|
98
|
+
exports.MIN_PREKEY_COUNT = 5;
|
|
99
|
+
exports.INITIAL_PREKEY_COUNT = 30;
|
|
100
|
+
exports.DEFAULT_CACHE_TTLS = {
|
|
96
101
|
SIGNAL_STORE: 5 * 60, // 5 minutes
|
|
97
102
|
MSG_RETRY: 60 * 60, // 1 hour
|
|
98
103
|
CALL_OFFER: 5 * 60, // 5 minutes
|
|
99
104
|
USER_DEVICES: 5 * 60 // 5 minutes
|
|
100
105
|
};
|
|
101
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CiphertextMessage = void 0;
|
|
4
|
+
class CiphertextMessage {
|
|
2
5
|
constructor() {
|
|
3
6
|
this.UNSUPPORTED_VERSION = 1;
|
|
4
7
|
this.CURRENT_VERSION = 3;
|
|
@@ -9,4 +12,4 @@ export class CiphertextMessage {
|
|
|
9
12
|
this.ENCRYPTED_MESSAGE_OVERHEAD = 53;
|
|
10
13
|
}
|
|
11
14
|
}
|
|
12
|
-
|
|
15
|
+
exports.CiphertextMessage = CiphertextMessage;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SenderKeyDistributionMessage } from './sender-key-distribution-message
|
|
2
|
-
import { SenderKeyName } from './sender-key-name
|
|
3
|
-
import { SenderKeyRecord } from './sender-key-record
|
|
1
|
+
import { SenderKeyDistributionMessage } from './sender-key-distribution-message';
|
|
2
|
+
import { SenderKeyName } from './sender-key-name';
|
|
3
|
+
import { SenderKeyRecord } from './sender-key-record';
|
|
4
4
|
interface SenderKeyStore {
|
|
5
5
|
loadSenderKey(senderKeyName: SenderKeyName): Promise<SenderKeyRecord>;
|
|
6
6
|
storeSenderKey(senderKeyName: SenderKeyName, record: SenderKeyRecord): Promise<void>;
|
|
@@ -12,4 +12,3 @@ export declare class GroupSessionBuilder {
|
|
|
12
12
|
create(senderKeyName: SenderKeyName): Promise<SenderKeyDistributionMessage>;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
15
|
-
//# sourceMappingURL=group-session-builder.d.ts.map
|
|
@@ -1,8 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.GroupSessionBuilder = void 0;
|
|
37
|
+
const keyhelper = __importStar(require("./keyhelper"));
|
|
38
|
+
const sender_key_distribution_message_1 = require("./sender-key-distribution-message");
|
|
39
|
+
class GroupSessionBuilder {
|
|
6
40
|
constructor(senderKeyStore) {
|
|
7
41
|
this.senderKeyStore = senderKeyStore;
|
|
8
42
|
}
|
|
@@ -24,7 +58,7 @@ export class GroupSessionBuilder {
|
|
|
24
58
|
if (!state) {
|
|
25
59
|
throw new Error('No session state available');
|
|
26
60
|
}
|
|
27
|
-
return new SenderKeyDistributionMessage(state.getKeyId(), state.getSenderChainKey().getIteration(), state.getSenderChainKey().getSeed(), state.getSigningKeyPublic());
|
|
61
|
+
return new sender_key_distribution_message_1.SenderKeyDistributionMessage(state.getKeyId(), state.getSenderChainKey().getIteration(), state.getSenderChainKey().getSeed(), state.getSigningKeyPublic());
|
|
28
62
|
}
|
|
29
63
|
}
|
|
30
|
-
|
|
64
|
+
exports.GroupSessionBuilder = GroupSessionBuilder;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SenderKeyName } from './sender-key-name
|
|
2
|
-
import { SenderKeyRecord } from './sender-key-record
|
|
1
|
+
import { SenderKeyName } from './sender-key-name';
|
|
2
|
+
import { SenderKeyRecord } from './sender-key-record';
|
|
3
3
|
export interface SenderKeyStore {
|
|
4
4
|
loadSenderKey(senderKeyName: SenderKeyName): Promise<SenderKeyRecord>;
|
|
5
5
|
storeSenderKey(senderKeyName: SenderKeyName, record: SenderKeyRecord): Promise<void>;
|
|
@@ -15,4 +15,3 @@ export declare class GroupCipher {
|
|
|
15
15
|
private getPlainText;
|
|
16
16
|
private getCipherText;
|
|
17
17
|
}
|
|
18
|
-
//# sourceMappingURL=group_cipher.d.ts.map
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GroupCipher = void 0;
|
|
7
|
+
const crypto_1 = require("libsignal/src/crypto");
|
|
8
|
+
const queue_job_1 = __importDefault(require("./queue-job"));
|
|
9
|
+
const sender_key_message_1 = require("./sender-key-message");
|
|
10
|
+
class GroupCipher {
|
|
9
11
|
constructor(senderKeyStore, senderKeyName) {
|
|
10
12
|
this.senderKeyStore = senderKeyStore;
|
|
11
13
|
this.senderKeyName = senderKeyName;
|
|
12
14
|
}
|
|
13
15
|
queueJob(awaitable) {
|
|
14
|
-
return
|
|
16
|
+
return (0, queue_job_1.default)(this.senderKeyName.toString(), awaitable);
|
|
15
17
|
}
|
|
16
18
|
async encrypt(paddedPlaintext) {
|
|
17
19
|
return await this.queueJob(async () => {
|
|
@@ -26,7 +28,7 @@ export class GroupCipher {
|
|
|
26
28
|
const iteration = senderKeyState.getSenderChainKey().getIteration();
|
|
27
29
|
const senderKey = this.getSenderKey(senderKeyState, iteration === 0 ? 0 : iteration + 1);
|
|
28
30
|
const ciphertext = await this.getCipherText(senderKey.getIv(), senderKey.getCipherKey(), paddedPlaintext);
|
|
29
|
-
const senderKeyMessage = new SenderKeyMessage(senderKeyState.getKeyId(), senderKey.getIteration(), ciphertext, senderKeyState.getSigningKeyPrivate());
|
|
31
|
+
const senderKeyMessage = new sender_key_message_1.SenderKeyMessage(senderKeyState.getKeyId(), senderKey.getIteration(), ciphertext, senderKeyState.getSigningKeyPrivate());
|
|
30
32
|
await this.senderKeyStore.storeSenderKey(this.senderKeyName, record);
|
|
31
33
|
return senderKeyMessage.serialize();
|
|
32
34
|
});
|
|
@@ -37,7 +39,7 @@ export class GroupCipher {
|
|
|
37
39
|
if (!record) {
|
|
38
40
|
throw new Error('No SenderKeyRecord found for decryption');
|
|
39
41
|
}
|
|
40
|
-
const senderKeyMessage = new SenderKeyMessage(null, null, null, null, senderKeyMessageBytes);
|
|
42
|
+
const senderKeyMessage = new sender_key_message_1.SenderKeyMessage(null, null, null, null, senderKeyMessageBytes);
|
|
41
43
|
const senderKeyState = record.getSenderKeyState(senderKeyMessage.getKeyId());
|
|
42
44
|
if (!senderKeyState) {
|
|
43
45
|
throw new Error('No session found to decrypt message');
|
|
@@ -73,7 +75,7 @@ export class GroupCipher {
|
|
|
73
75
|
}
|
|
74
76
|
async getPlainText(iv, key, ciphertext) {
|
|
75
77
|
try {
|
|
76
|
-
return decrypt(key, ciphertext, iv);
|
|
78
|
+
return (0, crypto_1.decrypt)(key, ciphertext, iv);
|
|
77
79
|
}
|
|
78
80
|
catch (e) {
|
|
79
81
|
throw new Error('InvalidMessageException');
|
|
@@ -84,11 +86,11 @@ export class GroupCipher {
|
|
|
84
86
|
const ivBuffer = typeof iv === 'string' ? Buffer.from(iv, 'base64') : iv;
|
|
85
87
|
const keyBuffer = typeof key === 'string' ? Buffer.from(key, 'base64') : key;
|
|
86
88
|
const plaintextBuffer = typeof plaintext === 'string' ? Buffer.from(plaintext) : plaintext;
|
|
87
|
-
return encrypt(keyBuffer, plaintextBuffer, ivBuffer);
|
|
89
|
+
return (0, crypto_1.encrypt)(keyBuffer, plaintextBuffer, ivBuffer);
|
|
88
90
|
}
|
|
89
91
|
catch (e) {
|
|
90
92
|
throw new Error('InvalidMessageException');
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
|
-
|
|
96
|
+
exports.GroupCipher = GroupCipher;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export { GroupSessionBuilder } from './group-session-builder
|
|
2
|
-
export { SenderKeyDistributionMessage } from './sender-key-distribution-message
|
|
3
|
-
export { SenderKeyRecord } from './sender-key-record
|
|
4
|
-
export { SenderKeyName } from './sender-key-name
|
|
5
|
-
export { GroupCipher } from './group_cipher
|
|
6
|
-
export { SenderKeyState } from './sender-key-state
|
|
7
|
-
export { SenderKeyMessage } from './sender-key-message
|
|
8
|
-
export { SenderMessageKey } from './sender-message-key
|
|
9
|
-
export { SenderChainKey } from './sender-chain-key
|
|
10
|
-
export { CiphertextMessage } from './ciphertext-message
|
|
11
|
-
export * as keyhelper from './keyhelper
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export { GroupSessionBuilder } from './group-session-builder';
|
|
2
|
+
export { SenderKeyDistributionMessage } from './sender-key-distribution-message';
|
|
3
|
+
export { SenderKeyRecord } from './sender-key-record';
|
|
4
|
+
export { SenderKeyName } from './sender-key-name';
|
|
5
|
+
export { GroupCipher } from './group_cipher';
|
|
6
|
+
export { SenderKeyState } from './sender-key-state';
|
|
7
|
+
export { SenderKeyMessage } from './sender-key-message';
|
|
8
|
+
export { SenderMessageKey } from './sender-message-key';
|
|
9
|
+
export { SenderChainKey } from './sender-chain-key';
|
|
10
|
+
export { CiphertextMessage } from './ciphertext-message';
|
|
11
|
+
export * as keyhelper from './keyhelper';
|
|
@@ -1,12 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.keyhelper = exports.CiphertextMessage = exports.SenderChainKey = exports.SenderMessageKey = exports.SenderKeyMessage = exports.SenderKeyState = exports.GroupCipher = exports.SenderKeyName = exports.SenderKeyRecord = exports.SenderKeyDistributionMessage = exports.GroupSessionBuilder = void 0;
|
|
37
|
+
var group_session_builder_1 = require("./group-session-builder");
|
|
38
|
+
Object.defineProperty(exports, "GroupSessionBuilder", { enumerable: true, get: function () { return group_session_builder_1.GroupSessionBuilder; } });
|
|
39
|
+
var sender_key_distribution_message_1 = require("./sender-key-distribution-message");
|
|
40
|
+
Object.defineProperty(exports, "SenderKeyDistributionMessage", { enumerable: true, get: function () { return sender_key_distribution_message_1.SenderKeyDistributionMessage; } });
|
|
41
|
+
var sender_key_record_1 = require("./sender-key-record");
|
|
42
|
+
Object.defineProperty(exports, "SenderKeyRecord", { enumerable: true, get: function () { return sender_key_record_1.SenderKeyRecord; } });
|
|
43
|
+
var sender_key_name_1 = require("./sender-key-name");
|
|
44
|
+
Object.defineProperty(exports, "SenderKeyName", { enumerable: true, get: function () { return sender_key_name_1.SenderKeyName; } });
|
|
45
|
+
var group_cipher_1 = require("./group_cipher");
|
|
46
|
+
Object.defineProperty(exports, "GroupCipher", { enumerable: true, get: function () { return group_cipher_1.GroupCipher; } });
|
|
47
|
+
var sender_key_state_1 = require("./sender-key-state");
|
|
48
|
+
Object.defineProperty(exports, "SenderKeyState", { enumerable: true, get: function () { return sender_key_state_1.SenderKeyState; } });
|
|
49
|
+
var sender_key_message_1 = require("./sender-key-message");
|
|
50
|
+
Object.defineProperty(exports, "SenderKeyMessage", { enumerable: true, get: function () { return sender_key_message_1.SenderKeyMessage; } });
|
|
51
|
+
var sender_message_key_1 = require("./sender-message-key");
|
|
52
|
+
Object.defineProperty(exports, "SenderMessageKey", { enumerable: true, get: function () { return sender_message_key_1.SenderMessageKey; } });
|
|
53
|
+
var sender_chain_key_1 = require("./sender-chain-key");
|
|
54
|
+
Object.defineProperty(exports, "SenderChainKey", { enumerable: true, get: function () { return sender_chain_key_1.SenderChainKey; } });
|
|
55
|
+
var ciphertext_message_1 = require("./ciphertext-message");
|
|
56
|
+
Object.defineProperty(exports, "CiphertextMessage", { enumerable: true, get: function () { return ciphertext_message_1.CiphertextMessage; } });
|
|
57
|
+
exports.keyhelper = __importStar(require("./keyhelper"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generateKeyPair } from 'libsignal/src/curve
|
|
1
|
+
import { generateKeyPair } from 'libsignal/src/curve';
|
|
2
2
|
type KeyPairType = ReturnType<typeof generateKeyPair>;
|
|
3
3
|
export declare function generateSenderKey(): Buffer;
|
|
4
4
|
export declare function generateSenderKeyId(): number;
|
|
@@ -8,4 +8,3 @@ export interface SigningKeyPair {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function generateSenderSigningKey(key?: KeyPairType): SigningKeyPair;
|
|
10
10
|
export {};
|
|
11
|
-
//# sourceMappingURL=keyhelper.d.ts.map
|
|
@@ -1,19 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.generateSenderKey = generateSenderKey;
|
|
37
|
+
exports.generateSenderKeyId = generateSenderKeyId;
|
|
38
|
+
exports.generateSenderSigningKey = generateSenderSigningKey;
|
|
39
|
+
const nodeCrypto = __importStar(require("crypto"));
|
|
40
|
+
const curve_1 = require("libsignal/src/curve");
|
|
41
|
+
function generateSenderKey() {
|
|
5
42
|
return nodeCrypto.randomBytes(32);
|
|
6
43
|
}
|
|
7
|
-
|
|
44
|
+
function generateSenderKeyId() {
|
|
8
45
|
return nodeCrypto.randomInt(2147483647);
|
|
9
46
|
}
|
|
10
|
-
|
|
47
|
+
function generateSenderSigningKey(key) {
|
|
11
48
|
if (!key) {
|
|
12
|
-
key = generateKeyPair();
|
|
49
|
+
key = (0, curve_1.generateKeyPair)();
|
|
13
50
|
}
|
|
14
51
|
return {
|
|
15
52
|
public: Buffer.from(key.pubKey),
|
|
16
53
|
private: Buffer.from(key.privKey)
|
|
17
54
|
};
|
|
18
55
|
}
|
|
19
|
-
//# sourceMappingURL=keyhelper.js.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = queueJob;
|
|
1
4
|
const _queueAsyncBuckets = new Map();
|
|
2
|
-
export function cleanupQueues() {
|
|
3
|
-
_queueAsyncBuckets.clear();
|
|
4
|
-
}
|
|
5
5
|
const _gcLimit = 10000;
|
|
6
6
|
async function _asyncQueueExecutor(queue, cleanup) {
|
|
7
7
|
let offt = 0;
|
|
8
|
+
// eslint-disable-next-line no-constant-condition
|
|
8
9
|
while (true) {
|
|
9
10
|
const limit = Math.min(queue.length, _gcLimit);
|
|
10
11
|
for (let i = offt; i < limit; i++) {
|
|
@@ -31,7 +32,7 @@ async function _asyncQueueExecutor(queue, cleanup) {
|
|
|
31
32
|
}
|
|
32
33
|
cleanup();
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
function queueJob(bucket, awaitable) {
|
|
35
36
|
// Skip name assignment since it's readonly in strict mode
|
|
36
37
|
if (typeof bucket !== 'string') {
|
|
37
38
|
console.warn('Unhandled bucket type (for naming):', typeof bucket, bucket);
|
|
@@ -54,4 +55,3 @@ export default function queueJob(bucket, awaitable) {
|
|
|
54
55
|
}
|
|
55
56
|
return job;
|
|
56
57
|
}
|
|
57
|
-
//# sourceMappingURL=queue-job.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SenderMessageKey } from './sender-message-key
|
|
1
|
+
import { SenderMessageKey } from './sender-message-key';
|
|
2
2
|
export declare class SenderChainKey {
|
|
3
3
|
private readonly MESSAGE_KEY_SEED;
|
|
4
4
|
private readonly CHAIN_KEY_SEED;
|
|
@@ -11,4 +11,3 @@ export declare class SenderChainKey {
|
|
|
11
11
|
getSeed(): Uint8Array;
|
|
12
12
|
private getDerivative;
|
|
13
13
|
}
|
|
14
|
-
//# sourceMappingURL=sender-chain-key.d.ts.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SenderChainKey = void 0;
|
|
4
|
+
const crypto_1 = require("libsignal/src/crypto");
|
|
5
|
+
const sender_message_key_1 = require("./sender-message-key");
|
|
6
|
+
class SenderChainKey {
|
|
5
7
|
constructor(iteration, chainKey) {
|
|
6
8
|
this.MESSAGE_KEY_SEED = Buffer.from([0x01]);
|
|
7
9
|
this.CHAIN_KEY_SEED = Buffer.from([0x02]);
|
|
@@ -17,7 +19,7 @@ export class SenderChainKey {
|
|
|
17
19
|
return this.iteration;
|
|
18
20
|
}
|
|
19
21
|
getSenderMessageKey() {
|
|
20
|
-
return new SenderMessageKey(this.iteration, this.getDerivative(this.MESSAGE_KEY_SEED, this.chainKey));
|
|
22
|
+
return new sender_message_key_1.SenderMessageKey(this.iteration, this.getDerivative(this.MESSAGE_KEY_SEED, this.chainKey));
|
|
21
23
|
}
|
|
22
24
|
getNext() {
|
|
23
25
|
return new SenderChainKey(this.iteration + 1, this.getDerivative(this.CHAIN_KEY_SEED, this.chainKey));
|
|
@@ -26,7 +28,7 @@ export class SenderChainKey {
|
|
|
26
28
|
return this.chainKey;
|
|
27
29
|
}
|
|
28
30
|
getDerivative(seed, key) {
|
|
29
|
-
return calculateMAC(key, seed);
|
|
31
|
+
return (0, crypto_1.calculateMAC)(key, seed);
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
|
-
|
|
34
|
+
exports.SenderChainKey = SenderChainKey;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CiphertextMessage } from './ciphertext-message
|
|
1
|
+
import { CiphertextMessage } from './ciphertext-message';
|
|
2
2
|
export declare class SenderKeyDistributionMessage extends CiphertextMessage {
|
|
3
3
|
private readonly id;
|
|
4
4
|
private readonly iteration;
|
|
@@ -14,4 +14,3 @@ export declare class SenderKeyDistributionMessage extends CiphertextMessage {
|
|
|
14
14
|
getSignatureKey(): Uint8Array;
|
|
15
15
|
getId(): number;
|
|
16
16
|
}
|
|
17
|
-
//# sourceMappingURL=sender-key-distribution-message.d.ts.map
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SenderKeyDistributionMessage = void 0;
|
|
4
|
+
const WAProto_1 = require("../../../WAProto");
|
|
5
|
+
const ciphertext_message_1 = require("./ciphertext-message");
|
|
6
|
+
class SenderKeyDistributionMessage extends ciphertext_message_1.CiphertextMessage {
|
|
4
7
|
constructor(id, iteration, chainKey, signatureKey, serialized) {
|
|
5
8
|
super();
|
|
6
9
|
if (serialized) {
|
|
7
10
|
try {
|
|
8
11
|
const message = serialized.slice(1);
|
|
9
|
-
const distributionMessage = proto.SenderKeyDistributionMessage.decode(message).toJSON();
|
|
12
|
+
const distributionMessage = WAProto_1.proto.SenderKeyDistributionMessage.decode(message).toJSON();
|
|
10
13
|
this.serialized = serialized;
|
|
11
14
|
this.id = distributionMessage.id;
|
|
12
15
|
this.iteration = distributionMessage.iteration;
|
|
@@ -29,7 +32,7 @@ export class SenderKeyDistributionMessage extends CiphertextMessage {
|
|
|
29
32
|
this.iteration = iteration;
|
|
30
33
|
this.chainKey = chainKey;
|
|
31
34
|
this.signatureKey = signatureKey;
|
|
32
|
-
const message = proto.SenderKeyDistributionMessage.encode(proto.SenderKeyDistributionMessage.create({
|
|
35
|
+
const message = WAProto_1.proto.SenderKeyDistributionMessage.encode(WAProto_1.proto.SenderKeyDistributionMessage.create({
|
|
33
36
|
id,
|
|
34
37
|
iteration,
|
|
35
38
|
chainKey,
|
|
@@ -60,4 +63,4 @@ export class SenderKeyDistributionMessage extends CiphertextMessage {
|
|
|
60
63
|
return this.id;
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
|
-
|
|
66
|
+
exports.SenderKeyDistributionMessage = SenderKeyDistributionMessage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CiphertextMessage } from './ciphertext-message
|
|
1
|
+
import { CiphertextMessage } from './ciphertext-message';
|
|
2
2
|
export declare class SenderKeyMessage extends CiphertextMessage {
|
|
3
3
|
private readonly SIGNATURE_LENGTH;
|
|
4
4
|
private readonly messageVersion;
|
|
@@ -16,4 +16,3 @@ export declare class SenderKeyMessage extends CiphertextMessage {
|
|
|
16
16
|
serialize(): Uint8Array;
|
|
17
17
|
getType(): number;
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=sender-key-message.d.ts.map
|