@mrlegendbot/baileys 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/fix-imports.js +85 -0
- package/WAProto/index.d.ts +14017 -0
- package/WAProto/index.js +97691 -2
- package/lib/Defaults/index.d.ts +75 -0
- package/lib/Defaults/index.js +92 -89
- package/lib/Menu/index.d.ts +42 -0
- package/lib/Menu/index.js +283 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.js +10 -9
- package/lib/Signal/Group/group-session-builder.d.ts +15 -0
- package/lib/Signal/Group/group-session-builder.js +22 -21
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.js +69 -75
- package/lib/Signal/Group/index.d.ts +12 -0
- package/lib/Signal/Group/index.js +1 -0
- package/lib/Signal/Group/keyhelper.d.ts +11 -0
- package/lib/Signal/Group/keyhelper.js +10 -9
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.js +22 -21
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +60 -51
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.js +62 -56
- package/lib/Signal/Group/sender-key-name.d.ts +18 -0
- package/lib/Signal/Group/sender-key-name.js +40 -38
- package/lib/Signal/Group/sender-key-record.d.ts +31 -0
- package/lib/Signal/Group/sender-key-record.js +34 -33
- package/lib/Signal/Group/sender-key-state.d.ts +39 -0
- package/lib/Signal/Group/sender-key-state.js +76 -72
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.js +23 -22
- package/lib/Signal/libsignal.d.ts +5 -0
- package/lib/Signal/libsignal.js +405 -506
- package/lib/Signal/lid-mapping.d.ts +23 -0
- package/lib/Signal/lid-mapping.js +258 -276
- package/lib/Socket/Client/index.d.ts +3 -0
- package/lib/Socket/Client/index.js +1 -0
- package/lib/Socket/Client/types.d.ts +16 -0
- package/lib/Socket/Client/types.js +7 -6
- package/lib/Socket/Client/websocket.d.ts +13 -0
- package/lib/Socket/Client/websocket.js +49 -48
- package/lib/Socket/business.d.ts +217 -0
- package/lib/Socket/business.js +369 -349
- package/lib/Socket/chats.d.ts +125 -0
- package/lib/Socket/chats.js +1148 -1172
- package/lib/Socket/communities.d.ts +273 -0
- package/lib/Socket/communities.js +413 -473
- package/lib/Socket/groups.d.ts +161 -0
- package/lib/Socket/groups.js +331 -387
- package/lib/Socket/index.d.ts +267 -0
- package/lib/Socket/index.js +19 -6
- package/lib/Socket/messages-recv.d.ts +203 -0
- package/lib/Socket/messages-recv.js +1719 -1782
- package/lib/Socket/messages-send.d.ts +199 -0
- package/lib/Socket/messages-send.js +2451 -1555
- package/lib/Socket/mex.d.ts +3 -0
- package/lib/Socket/mex.js +35 -40
- package/lib/Socket/newsletter.d.ts +170 -0
- package/lib/Socket/newsletter.js +191 -239
- package/lib/Socket/socket.d.ts +59 -0
- package/lib/Socket/socket.js +923 -992
- package/lib/Types/Auth.d.ts +117 -0
- package/lib/Types/Auth.js +1 -0
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Bussines.js +1 -0
- package/lib/Types/Call.d.ts +15 -0
- package/lib/Types/Call.js +1 -0
- package/lib/Types/Chat.d.ts +124 -0
- package/lib/Types/Chat.js +8 -1
- package/lib/Types/Contact.d.ts +26 -0
- package/lib/Types/Contact.js +1 -0
- package/lib/Types/Events.d.ts +256 -0
- package/lib/Types/Events.js +2 -1
- package/lib/Types/GroupMetadata.d.ts +71 -0
- package/lib/Types/GroupMetadata.js +1 -0
- package/lib/Types/Label.d.ts +47 -0
- package/lib/Types/Label.js +22 -20
- package/lib/Types/LabelAssociation.d.ts +30 -0
- package/lib/Types/LabelAssociation.js +4 -2
- package/lib/Types/Message.d.ts +320 -0
- package/lib/Types/Message.js +5 -3
- package/lib/Types/Mex.d.ts +141 -0
- package/lib/Types/Mex.js +31 -26
- package/lib/Types/Product.d.ts +79 -0
- package/lib/Types/Product.js +1 -0
- package/lib/Types/Signal.d.ts +87 -0
- package/lib/Types/Signal.js +2 -1
- package/lib/Types/Socket.d.ts +136 -0
- package/lib/Types/Socket.js +3 -2
- package/lib/Types/State.d.ts +97 -0
- package/lib/Types/State.js +52 -4
- package/lib/Types/USync.d.ts +26 -0
- package/lib/Types/USync.js +1 -0
- package/lib/Types/index.d.ts +66 -0
- package/lib/Types/index.js +11 -10
- package/lib/Utils/auth-utils.d.ts +24 -0
- package/lib/Utils/auth-utils.js +277 -240
- package/lib/Utils/browser-utils.d.ts +4 -0
- package/lib/Utils/browser-utils.js +23 -20
- package/lib/Utils/business.d.ts +23 -0
- package/lib/Utils/business.js +204 -200
- package/lib/Utils/chat-utils.d.ts +100 -0
- package/lib/Utils/chat-utils.js +810 -836
- package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
- package/lib/Utils/companion-reg-client-utils.js +25 -23
- package/lib/Utils/crypto.d.ts +37 -0
- package/lib/Utils/crypto.js +86 -70
- package/lib/Utils/decode-wa-message.d.ts +66 -0
- package/lib/Utils/decode-wa-message.js +284 -277
- package/lib/Utils/event-buffer.d.ts +36 -0
- package/lib/Utils/event-buffer.js +595 -592
- package/lib/Utils/generics.d.ts +92 -0
- package/lib/Utils/generics.js +335 -312
- package/lib/Utils/history.d.ts +24 -0
- package/lib/Utils/history.js +115 -123
- package/lib/Utils/identity-change-handler.d.ts +44 -0
- package/lib/Utils/identity-change-handler.js +50 -0
- package/lib/Utils/index.d.ts +22 -0
- package/lib/Utils/index.js +2 -1
- package/lib/Utils/link-preview.d.ts +21 -0
- package/lib/Utils/link-preview.js +73 -74
- package/lib/Utils/logger.d.ts +12 -0
- package/lib/Utils/logger.js +2 -3
- package/lib/Utils/lt-hash.d.ts +8 -0
- package/lib/Utils/lt-hash.js +6 -0
- package/lib/Utils/make-mutex.d.ts +9 -0
- package/lib/Utils/make-mutex.js +27 -27
- package/lib/Utils/message-retry-manager.d.ts +115 -0
- package/lib/Utils/message-retry-manager.js +254 -213
- package/lib/Utils/messages-media.d.ts +133 -0
- package/lib/Utils/messages-media.js +715 -741
- package/lib/Utils/messages.d.ts +91 -0
- package/lib/Utils/messages.js +827 -791
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/noise-handler.js +187 -215
- package/lib/Utils/offline-node-processor.d.ts +17 -0
- package/lib/Utils/offline-node-processor.js +40 -0
- package/lib/Utils/pre-key-manager.d.ts +28 -0
- package/lib/Utils/pre-key-manager.js +98 -69
- package/lib/Utils/process-message.d.ts +60 -0
- package/lib/Utils/process-message.js +586 -617
- package/lib/Utils/reporting-utils.d.ts +11 -0
- package/lib/Utils/reporting-utils.js +234 -553
- package/lib/Utils/signal.d.ts +47 -0
- package/lib/Utils/signal.js +170 -217
- package/lib/Utils/stanza-ack.d.ts +11 -0
- package/lib/Utils/stanza-ack.js +35 -27
- package/lib/Utils/sync-action-utils.d.ts +19 -0
- package/lib/Utils/sync-action-utils.js +41 -37
- package/lib/Utils/tc-token-utils.d.ts +37 -0
- package/lib/Utils/tc-token-utils.js +141 -120
- package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
- package/lib/Utils/use-multi-file-auth-state.js +105 -87
- package/lib/Utils/validate-connection.d.ts +11 -0
- package/lib/Utils/validate-connection.js +188 -190
- package/lib/WABinary/constants.d.ts +28 -0
- package/lib/WABinary/constants.js +1294 -28
- package/lib/WABinary/decode.d.ts +7 -0
- package/lib/WABinary/decode.js +249 -245
- package/lib/WABinary/encode.d.ts +3 -0
- package/lib/WABinary/encode.js +206 -201
- package/lib/WABinary/generic-utils.d.ts +15 -0
- package/lib/WABinary/generic-utils.js +89 -86
- package/lib/WABinary/index.d.ts +6 -0
- package/lib/WABinary/index.js +1 -0
- package/lib/WABinary/jid-utils.d.ts +48 -0
- package/lib/WABinary/jid-utils.js +77 -68
- package/lib/WABinary/types.d.ts +19 -0
- package/lib/WABinary/types.js +1 -0
- package/lib/WAM/BinaryInfo.d.ts +9 -0
- package/lib/WAM/BinaryInfo.js +8 -7
- package/lib/WAM/constants.d.ts +40 -0
- package/lib/WAM/constants.js +22853 -19892
- package/lib/WAM/encode.d.ts +3 -0
- package/lib/WAM/encode.js +132 -121
- package/lib/WAM/index.d.ts +4 -0
- package/lib/WAM/index.js +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +43 -46
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +48 -47
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +23 -22
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +33 -30
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +20 -19
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +44 -53
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -24
- package/lib/WAUSync/Protocols/index.d.ts +6 -0
- package/lib/WAUSync/Protocols/index.js +1 -0
- package/lib/WAUSync/USyncQuery.d.ts +30 -0
- package/lib/WAUSync/USyncQuery.js +88 -79
- package/lib/WAUSync/USyncUser.d.ts +17 -0
- package/lib/WAUSync/USyncUser.js +29 -28
- package/lib/WAUSync/index.d.ts +4 -0
- package/lib/WAUSync/index.js +1 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +2 -2
- package/package.json +86 -22
- package/README.upstream.md +0 -1312
- package/WAProto/WAProto.json +0 -1
- package/WAProto/WAProto.proto +0 -6275
- package/WAProto/compiler.js +0 -550
- package/lib/Store/index.js +0 -8
- package/lib/Store/keyed-db.js +0 -108
- package/lib/Store/make-cache-manager-store.js +0 -70
- package/lib/Store/make-in-memory-store.js +0 -417
- package/lib/Store/make-ordered-dictionary.js +0 -69
- package/lib/Store/object-repository.js +0 -27
- package/lib/Utils/use-sqlite-auth-state.js +0 -162
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { proto } from '../../WAProto/index.js';
|
|
2
|
+
import type { SocketConfig } from '../Types/index.js';
|
|
3
|
+
export declare const UNAUTHORIZED_CODES: number[];
|
|
4
|
+
export declare const DEFAULT_ORIGIN = "https://web.whatsapp.com";
|
|
5
|
+
export declare const CALL_VIDEO_PREFIX = "https://call.whatsapp.com/video/";
|
|
6
|
+
export declare const CALL_AUDIO_PREFIX = "https://call.whatsapp.com/voice/";
|
|
7
|
+
export declare const DEF_CALLBACK_PREFIX = "CB:";
|
|
8
|
+
export declare const DEF_TAG_PREFIX = "TAG:";
|
|
9
|
+
export declare const PHONE_CONNECTION_CB = "CB:Pong";
|
|
10
|
+
export declare const WA_ADV_ACCOUNT_SIG_PREFIX: Buffer<ArrayBuffer>;
|
|
11
|
+
export declare const WA_ADV_DEVICE_SIG_PREFIX: Buffer<ArrayBuffer>;
|
|
12
|
+
export declare const WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX: Buffer<ArrayBuffer>;
|
|
13
|
+
export declare const WA_ADV_HOSTED_DEVICE_SIG_PREFIX: Buffer<ArrayBuffer>;
|
|
14
|
+
export declare const WA_DEFAULT_EPHEMERAL: number;
|
|
15
|
+
/** Status messages older than 24 hours are considered expired */
|
|
16
|
+
export declare const STATUS_EXPIRY_SECONDS: number;
|
|
17
|
+
/** WA Web enforces a 14-day maximum age for placeholder resend requests */
|
|
18
|
+
export declare const PLACEHOLDER_MAX_AGE_SECONDS: number;
|
|
19
|
+
export declare const NOISE_MODE = "Noise_XX_25519_AESGCM_SHA256\0\0\0\0";
|
|
20
|
+
export declare const DICT_VERSION = 3;
|
|
21
|
+
export declare const KEY_BUNDLE_TYPE: Buffer<ArrayBuffer>;
|
|
22
|
+
export declare const NOISE_WA_HEADER: Buffer<ArrayBuffer>;
|
|
23
|
+
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
|
24
|
+
export declare const URL_REGEX: RegExp;
|
|
25
|
+
export declare const WA_CERT_DETAILS: {
|
|
26
|
+
SERIAL: number;
|
|
27
|
+
ISSUER: string;
|
|
28
|
+
PUBLIC_KEY: Buffer<ArrayBuffer>;
|
|
29
|
+
};
|
|
30
|
+
export declare const PROCESSABLE_HISTORY_TYPES: proto.HistorySync.HistorySyncType[];
|
|
31
|
+
export declare const DEFAULT_CACHE_TTLS: {
|
|
32
|
+
SIGNAL_STORE: number;
|
|
33
|
+
MSG_RETRY: number;
|
|
34
|
+
CALL_OFFER: number;
|
|
35
|
+
USER_DEVICES: number;
|
|
36
|
+
};
|
|
37
|
+
export declare const DEFAULT_CONNECTION_CONFIG: SocketConfig;
|
|
38
|
+
export declare const MEDIA_PATH_MAP: {
|
|
39
|
+
[T in MediaType]?: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const MEDIA_HKDF_KEY_MAPPING: {
|
|
42
|
+
audio: string;
|
|
43
|
+
document: string;
|
|
44
|
+
gif: string;
|
|
45
|
+
image: string;
|
|
46
|
+
ppic: string;
|
|
47
|
+
product: string;
|
|
48
|
+
ptt: string;
|
|
49
|
+
sticker: string;
|
|
50
|
+
video: string;
|
|
51
|
+
'thumbnail-document': string;
|
|
52
|
+
'thumbnail-image': string;
|
|
53
|
+
'thumbnail-video': string;
|
|
54
|
+
'thumbnail-link': string;
|
|
55
|
+
'md-msg-hist': string;
|
|
56
|
+
'md-app-state': string;
|
|
57
|
+
'product-catalog-image': string;
|
|
58
|
+
'payment-bg-image': string;
|
|
59
|
+
ptv: string;
|
|
60
|
+
'biz-cover-photo': string;
|
|
61
|
+
};
|
|
62
|
+
export type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING;
|
|
63
|
+
export declare const MEDIA_KEYS: MediaType[];
|
|
64
|
+
/** 120s timeout for history sync stall detection, same as WA Web's handleChunkProgress / restartPausedTimer (g = 120) */
|
|
65
|
+
export declare const HISTORY_SYNC_PAUSED_TIMEOUT_MS = 120000;
|
|
66
|
+
export declare const MIN_PREKEY_COUNT = 5;
|
|
67
|
+
export declare const INITIAL_PREKEY_COUNT = 812;
|
|
68
|
+
export declare const UPLOAD_TIMEOUT = 30000;
|
|
69
|
+
export declare const TimeMs: {
|
|
70
|
+
Minute: number;
|
|
71
|
+
Hour: number;
|
|
72
|
+
Day: number;
|
|
73
|
+
Week: number;
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/Defaults/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createRequire } from 'module';
|
|
3
|
-
import { proto } from '../../WAProto/compiler.js';
|
|
1
|
+
import { proto } from '../../WAProto/index.js';
|
|
4
2
|
import { makeLibSignalRepository } from '../Signal/libsignal.js';
|
|
5
3
|
import { Browsers } from '../Utils/browser-utils.js';
|
|
6
4
|
import logger from '../Utils/logger.js';
|
|
7
|
-
const version = [2, 3000,
|
|
5
|
+
const version = [2, 3000, 1043857760];
|
|
8
6
|
export const UNAUTHORIZED_CODES = [401, 403, 419];
|
|
9
7
|
export const DEFAULT_ORIGIN = 'https://web.whatsapp.com';
|
|
10
8
|
export const CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
|
|
@@ -17,110 +15,115 @@ export const WA_ADV_DEVICE_SIG_PREFIX = Buffer.from([6, 1]);
|
|
|
17
15
|
export const WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = Buffer.from([6, 5]);
|
|
18
16
|
export const WA_ADV_HOSTED_DEVICE_SIG_PREFIX = Buffer.from([6, 6]);
|
|
19
17
|
export const WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60;
|
|
18
|
+
/** Status messages older than 24 hours are considered expired */
|
|
20
19
|
export const STATUS_EXPIRY_SECONDS = 24 * 60 * 60;
|
|
20
|
+
/** WA Web enforces a 14-day maximum age for placeholder resend requests */
|
|
21
21
|
export const PLACEHOLDER_MAX_AGE_SECONDS = 14 * 24 * 60 * 60;
|
|
22
22
|
export const NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0';
|
|
23
23
|
export const DICT_VERSION = 3;
|
|
24
24
|
export const KEY_BUNDLE_TYPE = Buffer.from([5]);
|
|
25
|
-
export const NOISE_WA_HEADER = Buffer.from([87, 65, 6, DICT_VERSION]);
|
|
25
|
+
export const NOISE_WA_HEADER = Buffer.from([87, 65, 6, DICT_VERSION]); // last is "DICT_VERSION"
|
|
26
|
+
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
|
26
27
|
export const URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g;
|
|
27
28
|
export const WA_CERT_DETAILS = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
SERIAL: 0,
|
|
30
|
+
ISSUER: 'WhatsAppLongTerm1',
|
|
31
|
+
PUBLIC_KEY: Buffer.from('142375574d0a587166aae71ebe516437c4a28b73e3695c6ce1f7f9545da8ee6b', 'hex')
|
|
31
32
|
};
|
|
32
|
-
export const PROCESSABLE_HISTORY_TYPES = [
|
|
33
|
+
export const PROCESSABLE_HISTORY_TYPES = [
|
|
34
|
+
proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP,
|
|
35
|
+
proto.HistorySync.HistorySyncType.PUSH_NAME,
|
|
36
|
+
proto.HistorySync.HistorySyncType.RECENT,
|
|
37
|
+
proto.HistorySync.HistorySyncType.FULL,
|
|
38
|
+
proto.HistorySync.HistorySyncType.ON_DEMAND,
|
|
39
|
+
proto.HistorySync.HistorySyncType.NON_BLOCKING_DATA,
|
|
40
|
+
proto.HistorySync.HistorySyncType.INITIAL_STATUS_V3
|
|
41
|
+
];
|
|
33
42
|
export const DEFAULT_CACHE_TTLS = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
SIGNAL_STORE: 5 * 60, // 5 minutes
|
|
44
|
+
MSG_RETRY: 60 * 60, // 1 hour
|
|
45
|
+
CALL_OFFER: 5 * 60, // 5 minutes
|
|
46
|
+
USER_DEVICES: 5 * 60 // 5 minutes
|
|
38
47
|
};
|
|
39
48
|
export const DEFAULT_CONNECTION_CONFIG = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
appStateMacVerification: {
|
|
75
|
-
patch: false,
|
|
76
|
-
snapshot: false
|
|
77
|
-
},
|
|
78
|
-
countryCode: 'US',
|
|
79
|
-
getMessage: async () => undefined,
|
|
80
|
-
cachedGroupMetadata: async () => undefined,
|
|
81
|
-
makeSignalRepository: makeLibSignalRepository
|
|
49
|
+
version: version,
|
|
50
|
+
browser: Browsers.macOS('Chrome'),
|
|
51
|
+
waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
|
|
52
|
+
connectTimeoutMs: 20000,
|
|
53
|
+
keepAliveIntervalMs: 30000,
|
|
54
|
+
logger: logger.child({ class: 'baileys' }),
|
|
55
|
+
emitOwnEvents: true,
|
|
56
|
+
defaultQueryTimeoutMs: 60000,
|
|
57
|
+
customUploadHosts: [],
|
|
58
|
+
retryRequestDelayMs: 250,
|
|
59
|
+
maxMsgRetryCount: 5,
|
|
60
|
+
fireInitQueries: true,
|
|
61
|
+
auth: undefined,
|
|
62
|
+
markOnlineOnConnect: true,
|
|
63
|
+
syncFullHistory: true,
|
|
64
|
+
patchMessageBeforeSending: msg => msg,
|
|
65
|
+
shouldSyncHistoryMessage: ({ syncType }) => {
|
|
66
|
+
return syncType !== proto.HistorySync.HistorySyncType.FULL;
|
|
67
|
+
},
|
|
68
|
+
shouldIgnoreJid: () => false,
|
|
69
|
+
linkPreviewImageThumbnailWidth: 192,
|
|
70
|
+
transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
|
|
71
|
+
generateHighQualityLinkPreview: false,
|
|
72
|
+
enableAutoSessionRecreation: true,
|
|
73
|
+
enableRecentMessageCache: true,
|
|
74
|
+
options: {},
|
|
75
|
+
appStateMacVerification: {
|
|
76
|
+
patch: false,
|
|
77
|
+
snapshot: false
|
|
78
|
+
},
|
|
79
|
+
countryCode: 'US',
|
|
80
|
+
getMessage: async () => undefined,
|
|
81
|
+
cachedGroupMetadata: async () => undefined,
|
|
82
|
+
makeSignalRepository: makeLibSignalRepository
|
|
82
83
|
};
|
|
83
84
|
export const MEDIA_PATH_MAP = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
image: '/mms/image',
|
|
86
|
+
video: '/mms/video',
|
|
87
|
+
document: '/mms/document',
|
|
88
|
+
audio: '/mms/audio',
|
|
89
|
+
sticker: '/mms/image',
|
|
90
|
+
'thumbnail-link': '/mms/image',
|
|
91
|
+
'product-catalog-image': '/product/image',
|
|
92
|
+
'md-app-state': '',
|
|
93
|
+
'md-msg-hist': '/mms/md-app-state',
|
|
94
|
+
'biz-cover-photo': '/pps/biz-cover-photo'
|
|
94
95
|
};
|
|
95
96
|
export const MEDIA_HKDF_KEY_MAPPING = {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
97
|
+
audio: 'Audio',
|
|
98
|
+
document: 'Document',
|
|
99
|
+
gif: 'Video',
|
|
100
|
+
image: 'Image',
|
|
101
|
+
ppic: '',
|
|
102
|
+
product: 'Image',
|
|
103
|
+
ptt: 'Audio',
|
|
104
|
+
sticker: 'Image',
|
|
105
|
+
video: 'Video',
|
|
106
|
+
'thumbnail-document': 'Document Thumbnail',
|
|
107
|
+
'thumbnail-image': 'Image Thumbnail',
|
|
108
|
+
'thumbnail-video': 'Video Thumbnail',
|
|
109
|
+
'thumbnail-link': 'Link Thumbnail',
|
|
110
|
+
'md-msg-hist': 'History',
|
|
111
|
+
'md-app-state': 'App State',
|
|
112
|
+
'product-catalog-image': '',
|
|
113
|
+
'payment-bg-image': 'Payment Background',
|
|
114
|
+
ptv: 'Video',
|
|
115
|
+
'biz-cover-photo': 'Image'
|
|
115
116
|
};
|
|
116
117
|
export const MEDIA_KEYS = Object.keys(MEDIA_PATH_MAP);
|
|
118
|
+
/** 120s timeout for history sync stall detection, same as WA Web's handleChunkProgress / restartPausedTimer (g = 120) */
|
|
117
119
|
export const HISTORY_SYNC_PAUSED_TIMEOUT_MS = 120000;
|
|
118
120
|
export const MIN_PREKEY_COUNT = 5;
|
|
119
121
|
export const INITIAL_PREKEY_COUNT = 812;
|
|
120
|
-
export const UPLOAD_TIMEOUT = 30000;
|
|
122
|
+
export const UPLOAD_TIMEOUT = 30000; // 30 seconds
|
|
121
123
|
export const TimeMs = {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
Minute: 60 * 1000,
|
|
125
|
+
Hour: 60 * 60 * 1000,
|
|
126
|
+
Day: 24 * 60 * 60 * 1000,
|
|
127
|
+
Week: 7 * 24 * 60 * 60 * 1000
|
|
126
128
|
};
|
|
129
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { proto } from '../../WAProto/index.js';
|
|
2
|
+
|
|
3
|
+
export interface MenuNativeFlowOptions {
|
|
4
|
+
text?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
footer?: string;
|
|
7
|
+
buttons?: any[];
|
|
8
|
+
image?: Buffer | { url: string };
|
|
9
|
+
mentions?: string[];
|
|
10
|
+
quoted?: proto.IWebMessageInfo;
|
|
11
|
+
contextInfo?: any;
|
|
12
|
+
}
|
|
13
|
+
export interface MenuPollOptions {
|
|
14
|
+
name?: string;
|
|
15
|
+
values?: string[];
|
|
16
|
+
selectableCount?: number;
|
|
17
|
+
mentions?: string[];
|
|
18
|
+
quoted?: proto.IWebMessageInfo;
|
|
19
|
+
}
|
|
20
|
+
export interface RichMenuOptions {
|
|
21
|
+
header?: any;
|
|
22
|
+
body?: any;
|
|
23
|
+
footer?: any;
|
|
24
|
+
contextInfo?: any;
|
|
25
|
+
}
|
|
26
|
+
export function sendNativeFlowMenu(sock: any, jid: string, options?: MenuNativeFlowOptions): Promise<any>;
|
|
27
|
+
export function sendPollMenu(sock: any, jid: string, options?: MenuPollOptions): Promise<any>;
|
|
28
|
+
export function sendRichMenu(sock: any, jid: string, options?: RichMenuOptions): Promise<any>;
|
|
29
|
+
export function sendRowMenu(sock: any, jid: string, options?: RichMenuOptions): Promise<any>;
|
|
30
|
+
export function sendCarouselMenu(sock: any, jid: string, options?: RichMenuOptions): Promise<any>;
|
|
31
|
+
export function sendButtonMenu(sock: any, jid: string, options?: RichMenuOptions): Promise<any>;
|
|
32
|
+
export function sendListMenu(sock: any, jid: string, options?: any): Promise<any>;
|
|
33
|
+
export function menuQuickReply(displayText: string, id: string, extra?: any): any;
|
|
34
|
+
export function menuList(displayText: string, sections?: any[]): any;
|
|
35
|
+
export function menuUrl(displayText: string, url: string): any;
|
|
36
|
+
export function menuCopy(displayText: string, id: string, copyCode: string): any;
|
|
37
|
+
export function menuCall(displayText: string, phoneNumber: string): any;
|
|
38
|
+
export const createMenuButton: typeof menuQuickReply;
|
|
39
|
+
export const createMenuList: typeof menuList;
|
|
40
|
+
export const createMenuUrl: typeof menuUrl;
|
|
41
|
+
export const createMenuCopy: typeof menuCopy;
|
|
42
|
+
export const createMenuCall: typeof menuCall;
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { generateWAMessageFromContent, prepareWAMessageMedia } from '../Utils/messages.js'
|
|
2
|
+
import { proto } from '../../WAProto/index.js'
|
|
3
|
+
|
|
4
|
+
const asButton = (display_text, id, extra = {}) => ({
|
|
5
|
+
name: 'quick_reply',
|
|
6
|
+
buttonParamsJson: JSON.stringify({ display_text, id, ...extra })
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
const asList = (display_text, sections = []) => ({
|
|
10
|
+
name: 'single_select',
|
|
11
|
+
buttonParamsJson: JSON.stringify({ title: display_text, sections })
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const asUrl = (display_text, url) => ({
|
|
15
|
+
name: 'cta_url',
|
|
16
|
+
buttonParamsJson: JSON.stringify({ display_text, url })
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const asCopy = (display_text, id, copy_code) => ({
|
|
20
|
+
name: 'cta_copy',
|
|
21
|
+
buttonParamsJson: JSON.stringify({ display_text, id, copy_code })
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const asCall = (display_text, phone_number) => ({
|
|
25
|
+
name: 'cta_call',
|
|
26
|
+
buttonParamsJson: JSON.stringify({
|
|
27
|
+
display_text,
|
|
28
|
+
id: `call_${phone_number}`,
|
|
29
|
+
phone_number
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const nativeFlowNode = () => [{
|
|
34
|
+
tag: 'biz',
|
|
35
|
+
attrs: {},
|
|
36
|
+
content: [{
|
|
37
|
+
tag: 'interactive',
|
|
38
|
+
attrs: { type: 'native_flow', v: '1' },
|
|
39
|
+
content: [{ tag: 'native_flow', attrs: { name: 'mixed', v: '9' } }]
|
|
40
|
+
}]
|
|
41
|
+
}]
|
|
42
|
+
|
|
43
|
+
export async function sendNativeFlowMenu(sock, jid, {
|
|
44
|
+
text = '',
|
|
45
|
+
title,
|
|
46
|
+
footer = '',
|
|
47
|
+
buttons = [],
|
|
48
|
+
image,
|
|
49
|
+
mentions = [],
|
|
50
|
+
quoted,
|
|
51
|
+
contextInfo = {}
|
|
52
|
+
} = {}) {
|
|
53
|
+
|
|
54
|
+
let header = {}
|
|
55
|
+
if (image) {
|
|
56
|
+
header = await prepareWAMessageMedia(
|
|
57
|
+
{ image: Buffer.isBuffer(image) ? image : image },
|
|
58
|
+
{ upload: sock.waUploadToServer }
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const message = generateWAMessageFromContent(jid, {
|
|
63
|
+
viewOnceMessage: {
|
|
64
|
+
message: {
|
|
65
|
+
messageContextInfo: {
|
|
66
|
+
deviceListMetadata: {},
|
|
67
|
+
deviceListMetadataVersion: 2
|
|
68
|
+
},
|
|
69
|
+
interactiveMessage: proto.Message.InteractiveMessage.create({
|
|
70
|
+
contextInfo: { ...contextInfo, mentionedJid: mentions.length ? mentions : undefined },
|
|
71
|
+
header: (title || image) ? proto.Message.InteractiveMessage.Header.create({
|
|
72
|
+
...header,
|
|
73
|
+
title: image ? undefined : title,
|
|
74
|
+
hasMediaAttachment: !!image
|
|
75
|
+
}) : undefined,
|
|
76
|
+
body: proto.Message.InteractiveMessage.Body.create({ text }),
|
|
77
|
+
footer: proto.Message.InteractiveMessage.Footer.create({ text: footer }),
|
|
78
|
+
nativeFlowMessage: proto.Message.InteractiveMessage.NativeFlowMessage.create({ buttons })
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}, { quoted, userJid: sock.user?.id })
|
|
83
|
+
|
|
84
|
+
await sock.relayMessage(jid, message.message, {
|
|
85
|
+
messageId: message.key.id,
|
|
86
|
+
additionalNodes: nativeFlowNode()
|
|
87
|
+
})
|
|
88
|
+
return message
|
|
89
|
+
}
|
|
90
|
+
export async function sendPollMenu(sock, jid, {
|
|
91
|
+
name = '',
|
|
92
|
+
values = [],
|
|
93
|
+
selectableCount = 1,
|
|
94
|
+
mentions = [],
|
|
95
|
+
quoted
|
|
96
|
+
} = {}) {
|
|
97
|
+
const message = await sock.sendMessage(jid, {
|
|
98
|
+
poll: { name, values, selectableCount },
|
|
99
|
+
mentions
|
|
100
|
+
}, { quoted })
|
|
101
|
+
return message
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export async function sendRichMenu(sock, jid, {
|
|
105
|
+
header = {},
|
|
106
|
+
body = {},
|
|
107
|
+
footer = {},
|
|
108
|
+
contextInfo = {}
|
|
109
|
+
} = {}) {
|
|
110
|
+
const sections = []
|
|
111
|
+
const {
|
|
112
|
+
disclaimer = false,
|
|
113
|
+
disclaimerText = ' ',
|
|
114
|
+
image = {},
|
|
115
|
+
title = ''
|
|
116
|
+
} = header || {}
|
|
117
|
+
|
|
118
|
+
if (disclaimer) {
|
|
119
|
+
sections.push({ __typename: 'GenAIUnifiedResponseSection',
|
|
120
|
+
view_model: { __typename: 'GenAISingleLayoutViewModel',
|
|
121
|
+
primitive: { __typename: 'FOATextPrimitive', text: disclaimerText } } })
|
|
122
|
+
}
|
|
123
|
+
if (title) {
|
|
124
|
+
sections.push({
|
|
125
|
+
__typename: 'GenAIUnifiedResponseSection',
|
|
126
|
+
view_model: {
|
|
127
|
+
__typename: 'GenAISingleLayoutViewModel',
|
|
128
|
+
primitive: { __typename: 'FOATextPrimitive', text: '# ' + title }
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
if (image?.url) {
|
|
133
|
+
sections.push({
|
|
134
|
+
__typename: 'GenAIUnifiedResponseSection',
|
|
135
|
+
view_model: {
|
|
136
|
+
__typename: 'GenAISingleLayoutViewModel',
|
|
137
|
+
primitive: image.inline ? {
|
|
138
|
+
__typename: 'GenAIMarkdownTextUXPrimitive',
|
|
139
|
+
text: '{{header}}.{{/header}}',
|
|
140
|
+
inline_entities: [{
|
|
141
|
+
__typename: 'GenAITextInlineEntity',
|
|
142
|
+
key: 'header',
|
|
143
|
+
metadata: {
|
|
144
|
+
__typename: 'GenAILatexItem',
|
|
145
|
+
latex_expression: '.',
|
|
146
|
+
font_height: 24,
|
|
147
|
+
padding: 4,
|
|
148
|
+
latex_image: {
|
|
149
|
+
__typename: 'GenAIMediaItem',
|
|
150
|
+
mime_type: image.mime_type || 'image/png',
|
|
151
|
+
url: image.url,
|
|
152
|
+
url_fallback: image.url,
|
|
153
|
+
width: image.width || 500,
|
|
154
|
+
height: image.height || 500,
|
|
155
|
+
expiration_timestamp_ms: Date.now() + 86400000
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}]
|
|
159
|
+
} : {
|
|
160
|
+
__typename: 'GenAIImagePrimitive',
|
|
161
|
+
preview_image: { __typename: 'GenAIMediaItem', mime_type: image.mime_type || 'image/png', url: image.url },
|
|
162
|
+
full_image: { __typename: 'GenAIMediaItem', mime_type: image.mime_type || 'image/png', url: image.url }
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const {
|
|
169
|
+
cards = [],
|
|
170
|
+
buttons = [],
|
|
171
|
+
title: bodyTitle = '',
|
|
172
|
+
toast = '',
|
|
173
|
+
carousel = false,
|
|
174
|
+
row = false
|
|
175
|
+
} = body || {}
|
|
176
|
+
|
|
177
|
+
if ((carousel || row) && cards.length) {
|
|
178
|
+
sections.push({
|
|
179
|
+
__typename: 'GenAIUnifiedResponseSection',
|
|
180
|
+
view_model: {
|
|
181
|
+
primitives: cards.map((card, cardIndex) => ({
|
|
182
|
+
__typename: 'GenAI3PExtWidgetPrimitive',
|
|
183
|
+
header: {
|
|
184
|
+
__typename: 'GenAI3PExtWidgetStandardHeader',
|
|
185
|
+
title: card?.title || ''
|
|
186
|
+
},
|
|
187
|
+
body: {
|
|
188
|
+
__typename: 'GenAI3PExtCalendarEventList',
|
|
189
|
+
ctas: (card?.buttons || []).map((label, buttonIndex) => ({
|
|
190
|
+
label,
|
|
191
|
+
state: 'PENDING',
|
|
192
|
+
kind: 'OTHER',
|
|
193
|
+
tool_call_id: `${cardIndex}${buttonIndex}`,
|
|
194
|
+
toast: { label: card?.toast || toast, __typename: 'GenAI3PExtWidgetToast' },
|
|
195
|
+
__typename: 'GenAI3PExtWidgetCTA'
|
|
196
|
+
})),
|
|
197
|
+
sections: []
|
|
198
|
+
}
|
|
199
|
+
})),
|
|
200
|
+
__typename: carousel ? 'GenAIHScrollLayoutViewModel' : 'GenAIActionRowLayoutViewModel'
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
} else if (buttons.length) {
|
|
204
|
+
sections.push({
|
|
205
|
+
__typename: 'GenAIUnifiedResponseSection',
|
|
206
|
+
view_model: {
|
|
207
|
+
primitive: {
|
|
208
|
+
__typename: 'GenAI3PExtWidgetPrimitive',
|
|
209
|
+
header: { __typename: 'GenAI3PExtWidgetStandardHeader', title: bodyTitle },
|
|
210
|
+
body: {
|
|
211
|
+
__typename: 'GenAI3PExtCalendarEventList',
|
|
212
|
+
ctas: buttons.map((label, index) => ({
|
|
213
|
+
label,
|
|
214
|
+
state: 'PENDING',
|
|
215
|
+
kind: 'OTHER',
|
|
216
|
+
tool_call_id: `${index}`,
|
|
217
|
+
toast: { label: toast, __typename: 'GenAI3PExtWidgetToast' },
|
|
218
|
+
__typename: 'GenAI3PExtWidgetCTA'
|
|
219
|
+
})),
|
|
220
|
+
sections: []
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
__typename: 'GenAISingleLayoutViewModel'
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (footer?.text || footer?.url) {
|
|
229
|
+
sections.push({
|
|
230
|
+
view_model: {
|
|
231
|
+
primitives: [{
|
|
232
|
+
cta_text: footer.text || 'Open',
|
|
233
|
+
cta_type: 'OPEN_URL',
|
|
234
|
+
cta_url: footer.url || '',
|
|
235
|
+
__typename: 'GenAIFooterActionPrimitive'
|
|
236
|
+
}],
|
|
237
|
+
__typename: 'GenAIActionRowLayoutViewModel'
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const message = generateWAMessageFromContent(jid, {
|
|
243
|
+
richResponseMessage: {
|
|
244
|
+
unifiedResponse: {
|
|
245
|
+
data: Buffer.from(JSON.stringify({ sections })).toString('base64')
|
|
246
|
+
},
|
|
247
|
+
contextInfo
|
|
248
|
+
}
|
|
249
|
+
}, { quoted: undefined, userJid: sock.user?.id })
|
|
250
|
+
|
|
251
|
+
await sock.relayMessage(jid, message.message, { messageId: message.key.id })
|
|
252
|
+
return message
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export const sendRowMenu = (sock, jid, options = {}) =>
|
|
256
|
+
sendRichMenu(sock, jid, { ...options, body: { ...(options.body || {}), row: true, carousel: false } })
|
|
257
|
+
|
|
258
|
+
export const sendCarouselMenu = (sock, jid, options = {}) =>
|
|
259
|
+
sendRichMenu(sock, jid, { ...options, body: { ...(options.body || {}), carousel: true, row: false } })
|
|
260
|
+
|
|
261
|
+
export const sendButtonMenu = (sock, jid, options = {}) =>
|
|
262
|
+
sendRichMenu(sock, jid, { ...options, body: { ...(options.body || {}), carousel: false, row: false } })
|
|
263
|
+
|
|
264
|
+
export const sendListMenu = (sock, jid, {
|
|
265
|
+
title = 'Menu',
|
|
266
|
+
sections = [],
|
|
267
|
+
...rest
|
|
268
|
+
} = {}) => sendNativeFlowMenu(sock, jid, {
|
|
269
|
+
...rest,
|
|
270
|
+
buttons: [asList(title, sections)]
|
|
271
|
+
})
|
|
272
|
+
|
|
273
|
+
export const menuQuickReply = asButton
|
|
274
|
+
export const menuList = asList
|
|
275
|
+
export const menuUrl = asUrl
|
|
276
|
+
export const menuCopy = asCopy
|
|
277
|
+
export const menuCall = asCall
|
|
278
|
+
|
|
279
|
+
export const createMenuButton = asButton
|
|
280
|
+
export const createMenuList = asList
|
|
281
|
+
export const createMenuUrl = asUrl
|
|
282
|
+
export const createMenuCopy = asCopy
|
|
283
|
+
export const createMenuCall = asCall
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class CiphertextMessage {
|
|
2
|
+
readonly UNSUPPORTED_VERSION: number;
|
|
3
|
+
readonly CURRENT_VERSION: number;
|
|
4
|
+
readonly WHISPER_TYPE: number;
|
|
5
|
+
readonly PREKEY_TYPE: number;
|
|
6
|
+
readonly SENDERKEY_TYPE: number;
|
|
7
|
+
readonly SENDERKEY_DISTRIBUTION_TYPE: number;
|
|
8
|
+
readonly ENCRYPTED_MESSAGE_OVERHEAD: number;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ciphertext-message.d.ts.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export class CiphertextMessage {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
constructor() {
|
|
3
|
+
this.UNSUPPORTED_VERSION = 1;
|
|
4
|
+
this.CURRENT_VERSION = 3;
|
|
5
|
+
this.WHISPER_TYPE = 2;
|
|
6
|
+
this.PREKEY_TYPE = 3;
|
|
7
|
+
this.SENDERKEY_TYPE = 4;
|
|
8
|
+
this.SENDERKEY_DISTRIBUTION_TYPE = 5;
|
|
9
|
+
this.ENCRYPTED_MESSAGE_OVERHEAD = 53;
|
|
10
|
+
}
|
|
11
11
|
}
|
|
12
|
+
//# sourceMappingURL=ciphertext-message.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SenderKeyDistributionMessage } from './sender-key-distribution-message.js';
|
|
2
|
+
import { SenderKeyName } from './sender-key-name.js';
|
|
3
|
+
import { SenderKeyRecord } from './sender-key-record.js';
|
|
4
|
+
interface SenderKeyStore {
|
|
5
|
+
loadSenderKey(senderKeyName: SenderKeyName): Promise<SenderKeyRecord>;
|
|
6
|
+
storeSenderKey(senderKeyName: SenderKeyName, record: SenderKeyRecord): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare class GroupSessionBuilder {
|
|
9
|
+
private readonly senderKeyStore;
|
|
10
|
+
constructor(senderKeyStore: SenderKeyStore);
|
|
11
|
+
process(senderKeyName: SenderKeyName, senderKeyDistributionMessage: SenderKeyDistributionMessage): Promise<void>;
|
|
12
|
+
create(senderKeyName: SenderKeyName): Promise<SenderKeyDistributionMessage>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=group-session-builder.d.ts.map
|