@yannajah/baileys 0.0.0-stage → 1.0.0
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/LICENSE +23 -0
- package/LICENSE.jexkcode +21 -0
- package/README.md +41 -2
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/WAProto/index.d.ts +16922 -0
- package/WAProto/index.js +122451 -0
- package/engine-requirements.js +10 -0
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.js +156 -0
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/Group/ciphertext-message.js +15 -0
- package/lib/Signal/Group/group-session-builder.js +64 -0
- package/lib/Signal/Group/group_cipher.js +96 -0
- package/lib/Signal/Group/index.js +57 -0
- package/lib/Signal/Group/keyhelper.js +55 -0
- package/lib/Signal/Group/queue-job.js +57 -0
- package/lib/Signal/Group/sender-chain-key.js +34 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.js +69 -0
- package/lib/Signal/Group/sender-key-name.js +51 -0
- package/lib/Signal/Group/sender-key-record.js +53 -0
- package/lib/Signal/Group/sender-key-state.js +99 -0
- package/lib/Signal/Group/sender-message-key.js +29 -0
- package/lib/Signal/libsignal.js +174 -0
- package/lib/Socket/Client/abstract-socket-client.js +13 -0
- package/lib/Socket/Client/index.js +19 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/web-socket-client.js +87 -0
- package/lib/Socket/business.js +260 -0
- package/lib/Socket/chats.js +1002 -0
- package/lib/Socket/clutch-handler.d.ts +27 -0
- package/lib/Socket/clutch-handler.js +880 -0
- package/lib/Socket/groups.js +317 -0
- package/lib/Socket/index.js +97 -0
- package/lib/Socket/messages-recv.js +1154 -0
- package/lib/Socket/messages-send.js +946 -0
- package/lib/Socket/newsletter.js +411 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.js +688 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Store/index.js +10 -0
- package/lib/Store/make-cache-manager-store.js +83 -0
- package/lib/Store/make-in-memory-store.js +457 -0
- package/lib/Store/make-ordered-dictionary.js +81 -0
- package/lib/Store/object-repository.js +27 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.js +4 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.js +27 -0
- package/lib/Types/LabelAssociation.js +9 -0
- package/lib/Types/Message.js +10 -0
- package/lib/Types/Mex.d.ts +2 -0
- package/lib/Types/Mex.js +98 -0
- package/lib/Types/Newsletter.js +41 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/State.js +2 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.js +43 -0
- package/lib/Utils/MessageBuilder.d.ts +215 -0
- package/lib/Utils/MessageBuilder.js +4001 -0
- package/lib/Utils/a2ui.d.ts +202 -0
- package/lib/Utils/a2ui.js +770 -0
- package/lib/Utils/auth-utils.js +206 -0
- package/lib/Utils/baileys-event-stream.js +63 -0
- package/lib/Utils/bot-signature.d.ts +22 -0
- package/lib/Utils/bot-signature.js +125 -0
- package/lib/Utils/business.js +234 -0
- package/lib/Utils/channel-manager.d.ts +39 -0
- package/lib/Utils/channel-manager.js +312 -0
- package/lib/Utils/chat-utils.js +729 -0
- package/lib/Utils/crypto.js +151 -0
- package/lib/Utils/decode-wa-message.js +198 -0
- package/lib/Utils/event-buffer.js +514 -0
- package/lib/Utils/extras.d.ts +449 -0
- package/lib/Utils/extras.js +1377 -0
- package/lib/Utils/generics.js +574 -0
- package/lib/Utils/history.js +96 -0
- package/lib/Utils/html-app.d.ts +39 -0
- package/lib/Utils/html-app.js +307 -0
- package/lib/Utils/index.d.ts +23 -0
- package/lib/Utils/index.js +51 -0
- package/lib/Utils/link-preview.js +93 -0
- package/lib/Utils/logger.js +7 -0
- package/lib/Utils/lt-hash.js +51 -0
- package/lib/Utils/make-mutex.js +43 -0
- package/lib/Utils/message-retry-manager.d.ts +42 -0
- package/lib/Utils/message-retry-manager.js +309 -0
- package/lib/Utils/messages-media.js +861 -0
- package/lib/Utils/messages.js +1085 -0
- package/lib/Utils/metaai.d.ts +438 -0
- package/lib/Utils/metaai.js +911 -0
- package/lib/Utils/mini-app.d.ts +93 -0
- package/lib/Utils/mini-app.js +453 -0
- package/lib/Utils/modern-messages.d.ts +150 -0
- package/lib/Utils/modern-messages.js +498 -0
- package/lib/Utils/native-flow.d.ts +14 -0
- package/lib/Utils/native-flow.js +122 -0
- package/lib/Utils/newsletter-status.d.ts +163 -0
- package/lib/Utils/newsletter-status.js +695 -0
- package/lib/Utils/noise-handler.js +155 -0
- package/lib/Utils/payment-messages.d.ts +59 -0
- package/lib/Utils/payment-messages.js +164 -0
- package/lib/Utils/process-message.js +334 -0
- package/lib/Utils/reporting-utils.d.ts +12 -0
- package/lib/Utils/reporting-utils.js +271 -0
- package/lib/Utils/scheduled-message.d.ts +82 -0
- package/lib/Utils/scheduled-message.js +126 -0
- package/lib/Utils/signal.js +153 -0
- package/lib/Utils/spr.d.ts +26 -0
- package/lib/Utils/spr.js +525 -0
- package/lib/Utils/status-stickers.d.ts +78 -0
- package/lib/Utils/status-stickers.js +275 -0
- package/lib/Utils/telegram-adapter.d.ts +28 -0
- package/lib/Utils/telegram-adapter.js +285 -0
- package/lib/Utils/use-multi-file-auth-state.js +153 -0
- package/lib/Utils/validate-connection.js +235 -0
- package/lib/WABinary/constants.js +40 -0
- package/lib/WABinary/decode.js +252 -0
- package/lib/WABinary/encode.js +265 -0
- package/lib/WABinary/generic-utils.js +178 -0
- package/lib/WABinary/index.js +21 -0
- package/lib/WABinary/jid-utils.js +81 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.js +13 -0
- package/lib/WAM/constants.js +15350 -0
- package/lib/WAM/encode.js +155 -0
- package/lib/WAM/index.js +19 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
- package/lib/WAUSync/Protocols/index.js +20 -0
- package/lib/WAUSync/USyncQuery.js +89 -0
- package/lib/WAUSync/USyncUser.js +26 -0
- package/lib/WAUSync/index.js +19 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.js +99 -0
- package/package.json +110 -4
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare const HTML_APP_MESSAGE_CEILING: number;
|
|
2
|
+
export declare const HTML_APP_BYTE_BUDGET: number;
|
|
3
|
+
export declare const HTML_APP_BYTE_LIMIT: number;
|
|
4
|
+
export declare const HTML_MIME_TYPE: string;
|
|
5
|
+
|
|
6
|
+
export declare function wireBytes(html: string): number;
|
|
7
|
+
|
|
8
|
+
export interface HtmlAppReport {
|
|
9
|
+
ok: boolean;
|
|
10
|
+
bytes: number;
|
|
11
|
+
wireBytes: number;
|
|
12
|
+
embeddedBytes: number;
|
|
13
|
+
problems: string[];
|
|
14
|
+
warnings: string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare function checkHtmlApp(html: string, options?: {
|
|
18
|
+
height?: number;
|
|
19
|
+
maxBytes?: number;
|
|
20
|
+
}): HtmlAppReport;
|
|
21
|
+
|
|
22
|
+
export declare function lockHeight(height: number): string;
|
|
23
|
+
export declare function autoHeight(): string;
|
|
24
|
+
export declare function scrollControls(options?: {
|
|
25
|
+
upLabel?: string;
|
|
26
|
+
downLabel?: string;
|
|
27
|
+
step?: number;
|
|
28
|
+
}): string;
|
|
29
|
+
|
|
30
|
+
export declare function htmlSection(html: string, options?: {
|
|
31
|
+
trustedSources?: string[];
|
|
32
|
+
height?: number;
|
|
33
|
+
typename?: string;
|
|
34
|
+
}): any;
|
|
35
|
+
|
|
36
|
+
export declare function sendHtmlApp(sock: any, jid: string, html: string, options?: any): Promise<any>;
|
|
37
|
+
export declare function sendHtmlDocument(sock: any, jid: string, html: string, options?: any): Promise<any>;
|
|
38
|
+
export declare function fileSection(url: string, options?: any): any;
|
|
39
|
+
export declare function fileLinkSection(url: string, options?: any): any;
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.fileLinkSection = exports.fileSection = exports.sendHtmlDocument = exports.HTML_MIME_TYPE = exports.sendHtmlApp = exports.htmlSection = exports.scrollControls = exports.autoHeight = exports.lockHeight = exports.checkHtmlApp = exports.wireBytes = exports.HTML_APP_BYTE_LIMIT = exports.HTML_APP_BYTE_BUDGET = exports.HTML_APP_MESSAGE_CEILING = void 0;
|
|
5
|
+
|
|
6
|
+
const crypto = require("crypto");
|
|
7
|
+
let _AIRich;
|
|
8
|
+
function getAIRich() {
|
|
9
|
+
if (!_AIRich) {
|
|
10
|
+
_AIRich = require("./MessageBuilder").AIRich;
|
|
11
|
+
}
|
|
12
|
+
return _AIRich;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const HTML_APP_MESSAGE_CEILING = 1024 * 1024;
|
|
16
|
+
exports.HTML_APP_MESSAGE_CEILING = HTML_APP_MESSAGE_CEILING;
|
|
17
|
+
|
|
18
|
+
const HTML_APP_BYTE_BUDGET = 960 * 1024;
|
|
19
|
+
exports.HTML_APP_BYTE_BUDGET = HTML_APP_BYTE_BUDGET;
|
|
20
|
+
|
|
21
|
+
const HTML_APP_BYTE_LIMIT = HTML_APP_BYTE_BUDGET;
|
|
22
|
+
exports.HTML_APP_BYTE_LIMIT = HTML_APP_BYTE_LIMIT;
|
|
23
|
+
|
|
24
|
+
const HTML_MIME_TYPE = 'text/html';
|
|
25
|
+
exports.HTML_MIME_TYPE = HTML_MIME_TYPE;
|
|
26
|
+
|
|
27
|
+
const wireBytes = (html) => Buffer.byteLength(
|
|
28
|
+
JSON.stringify(String(html)).replace(/[\u007f-\uffff]/g, (c) => '\\u' + c.charCodeAt(0).toString(16).padStart(4, '0')),
|
|
29
|
+
'utf-8'
|
|
30
|
+
);
|
|
31
|
+
exports.wireBytes = wireBytes;
|
|
32
|
+
|
|
33
|
+
const STORAGE_APIS = ['localStorage', 'sessionStorage', 'indexedDB', 'document.cookie', 'caches'];
|
|
34
|
+
|
|
35
|
+
const strip = (html) => html
|
|
36
|
+
.replace(/<!--[\s\S]*?-->/g, '')
|
|
37
|
+
.replace(/data:[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]*;base64,[A-Za-z0-9+/=]+/gi, 'data:');
|
|
38
|
+
|
|
39
|
+
const hasVisibilityGuard = (source) => /document\.(hidden|visibilityState)|visibilitychange|IntersectionObserver|cancelAnimationFrame|clearInterval/.test(source);
|
|
40
|
+
|
|
41
|
+
const checkHtmlApp = (html, { height, maxBytes = HTML_APP_BYTE_BUDGET } = {}) => {
|
|
42
|
+
if (typeof html !== 'string') {
|
|
43
|
+
throw new TypeError('checkHtmlApp requires an HTML string');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const bytes = Buffer.byteLength(html, 'utf-8');
|
|
47
|
+
const wire = wireBytes(html);
|
|
48
|
+
const source = strip(html);
|
|
49
|
+
const problems = [];
|
|
50
|
+
const warnings = [];
|
|
51
|
+
|
|
52
|
+
if (wire > maxBytes) {
|
|
53
|
+
problems.push(`${Math.round(wire / 1024)}KB on the wire, over the ${Math.round(maxBytes / 1024)}KB budget`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (wire > bytes * 1.15) {
|
|
57
|
+
warnings.push(`escaping inflates this page from ${Math.round(bytes / 1024)}KB to ${Math.round(wire / 1024)}KB`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const remote = [...source.matchAll(/\b(?:src|href)\s*=\s*["']?(https?:)?\/\//gi)];
|
|
61
|
+
if (remote.length) {
|
|
62
|
+
problems.push(`${remote.length} remote subresource(s) — embed as data: URIs instead`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (/\bfetch\s*\(|XMLHttpRequest|navigator\.sendBeacon|new\s+EventSource/.test(source)) {
|
|
66
|
+
problems.push('a call over HTTP stack — use offline/embedded storage');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const storage = STORAGE_APIS.filter(api => source.includes(api));
|
|
70
|
+
if (storage.length) {
|
|
71
|
+
problems.push(`${storage.join(', ')} — every storage API throws SecurityError in an opaque origin`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return { ok: problems.length === 0, bytes, wireBytes: wire, problems, warnings };
|
|
75
|
+
};
|
|
76
|
+
exports.checkHtmlApp = checkHtmlApp;
|
|
77
|
+
|
|
78
|
+
const lockHeight = (height) => {
|
|
79
|
+
const px = Number(height);
|
|
80
|
+
if (!Number.isFinite(px) || px <= 0) {
|
|
81
|
+
throw new TypeError('lockHeight requires a positive number of pixels');
|
|
82
|
+
}
|
|
83
|
+
return '<style>html,body{height:' + Math.round(px) + 'px;max-height:' + Math.round(px) + 'px;overflow:hidden}</style>';
|
|
84
|
+
};
|
|
85
|
+
exports.lockHeight = lockHeight;
|
|
86
|
+
|
|
87
|
+
const autoHeight = ({ min = 60, max = 900, settleMs = 120, maxReports = 24 } = {}) => {
|
|
88
|
+
const low = Number(min);
|
|
89
|
+
const high = Number(max);
|
|
90
|
+
const wait = Number(settleMs);
|
|
91
|
+
const cap = Number(maxReports);
|
|
92
|
+
if (!Number.isFinite(low) || low <= 0) {
|
|
93
|
+
throw new TypeError('autoHeight min must be a positive number of pixels');
|
|
94
|
+
}
|
|
95
|
+
if (!Number.isFinite(high) || high <= low) {
|
|
96
|
+
throw new TypeError('autoHeight max must be greater than min');
|
|
97
|
+
}
|
|
98
|
+
return '<style>html,body{margin:0;padding:0}</style>'
|
|
99
|
+
+ '<script>(function(){'
|
|
100
|
+
+ 'var LOW=' + low + ',HIGH=' + high + ',WAIT=' + wait + ',CAP=' + cap + ';'
|
|
101
|
+
+ 'var sent=[],timer=null,stopped=false;'
|
|
102
|
+
+ 'function measure(){var d=document.documentElement,b=document.body;'
|
|
103
|
+
+ 'var h=Math.max(d?d.scrollHeight:0,b?b.scrollHeight:0,b?b.offsetHeight:0);'
|
|
104
|
+
+ 'return Math.min(HIGH,Math.max(LOW,Math.ceil(h)))}'
|
|
105
|
+
+ 'function report(){if(stopped)return;var h=measure();'
|
|
106
|
+
+ 'if(sent.length&&sent[sent.length-1]===h)return;'
|
|
107
|
+
+ 'sent.push(h);if(sent.length>=CAP)stopped=true;'
|
|
108
|
+
+ 'if(window.AndroidBridge&&typeof window.AndroidBridge.updateSize==="function"){'
|
|
109
|
+
+ 'try{window.AndroidBridge.updateSize(h)}catch(e){}}}'
|
|
110
|
+
+ 'function ping(){if(timer!==null)clearTimeout(timer);timer=setTimeout(report,WAIT)}'
|
|
111
|
+
+ 'if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",ping);else ping();'
|
|
112
|
+
+ 'window.addEventListener("load",ping);'
|
|
113
|
+
+ 'if(typeof ResizeObserver==="function"){try{new ResizeObserver(ping).observe(document.body)}catch(e){}}'
|
|
114
|
+
+ '})();<' + '/script>';
|
|
115
|
+
};
|
|
116
|
+
exports.autoHeight = autoHeight;
|
|
117
|
+
|
|
118
|
+
const scrollControls = ({ step = 120, holdMs = 60, target = 'body', side = 'right', inset = 8, size = 36 } = {}) => {
|
|
119
|
+
const px = Number(step);
|
|
120
|
+
const hold = Number(holdMs);
|
|
121
|
+
const box = Number(size);
|
|
122
|
+
const edge = Number(inset);
|
|
123
|
+
return '<style>'
|
|
124
|
+
+ '#__sc{position:fixed;' + side + ':' + edge + 'px;bottom:' + edge + 'px;z-index:2147483647;'
|
|
125
|
+
+ 'display:none;flex-direction:column;gap:' + Math.round(box / 6) + 'px}'
|
|
126
|
+
+ '#__sc button{width:' + box + 'px;height:' + box + 'px;padding:0;border:0;'
|
|
127
|
+
+ 'border-radius:' + Math.round(box / 4) + 'px;background:rgba(0,0,0,.6);color:#fff;'
|
|
128
|
+
+ 'font:' + Math.round(box / 2) + 'px/1 system-ui;touch-action:none;cursor:pointer;'
|
|
129
|
+
+ '-webkit-tap-highlight-color:transparent}'
|
|
130
|
+
+ '#__sc button:disabled{opacity:.3}'
|
|
131
|
+
+ '</style>'
|
|
132
|
+
+ '<script>(function(){'
|
|
133
|
+
+ 'var STEP=' + px + ',HOLD=' + hold + ',SEL=' + JSON.stringify(target) + ';'
|
|
134
|
+
+ 'var box,up,down,timer=null;'
|
|
135
|
+
+ 'function pane(){return document.querySelector(SEL)||document.scrollingElement||document.body}'
|
|
136
|
+
+ 'function room(){var p=pane();return p?p.scrollHeight-p.clientHeight:0}'
|
|
137
|
+
+ 'function sync(){if(!box)return;var p=pane(),r=room();'
|
|
138
|
+
+ 'box.style.display=r>4?"flex":"none";if(r<=4)return;'
|
|
139
|
+
+ 'up.disabled=p.scrollTop<=0;down.disabled=p.scrollTop>=r-1}'
|
|
140
|
+
+ 'function move(by){var p=pane();if(!p)return;p.scrollTop+=by;sync()}'
|
|
141
|
+
+ 'function stop(){if(timer!==null){clearInterval(timer);timer=null}}'
|
|
142
|
+
+ 'function press(e,by){e.preventDefault();e.stopPropagation();stop();move(by);'
|
|
143
|
+
+ 'timer=setInterval(function(){move(by)},HOLD)}'
|
|
144
|
+
+ 'function make(label,by){var b=document.createElement("button");b.type="button";'
|
|
145
|
+
+ 'b.textContent=label;b.setAttribute("aria-label",by<0?"scroll up":"scroll down");'
|
|
146
|
+
+ 'b.addEventListener("touchstart",function(e){press(e,by)},{passive:false});'
|
|
147
|
+
+ 'b.addEventListener("touchend",function(e){e.preventDefault();stop()},{passive:false});'
|
|
148
|
+
+ 'b.addEventListener("touchcancel",stop);'
|
|
149
|
+
+ 'b.addEventListener("mousedown",function(e){press(e,by)});'
|
|
150
|
+
+ 'b.addEventListener("mouseup",stop);b.addEventListener("mouseleave",stop);'
|
|
151
|
+
+ 'b.addEventListener("click",function(e){e.preventDefault();e.stopPropagation()});'
|
|
152
|
+
+ 'return b}'
|
|
153
|
+
+ 'function start(){if(box)return;'
|
|
154
|
+
+ 'box=document.createElement("div");box.id="__sc";'
|
|
155
|
+
+ 'up=make("\\u25b2",-STEP);down=make("\\u25bc",STEP);'
|
|
156
|
+
+ 'box.appendChild(up);box.appendChild(down);document.body.appendChild(box);'
|
|
157
|
+
+ 'var p=pane();if(p&&p.addEventListener)p.addEventListener("scroll",sync,{passive:true});'
|
|
158
|
+
+ 'if(typeof ResizeObserver==="function"){try{new ResizeObserver(sync).observe(document.body)}catch(e){}}'
|
|
159
|
+
+ 'addEventListener("load",sync);sync()}'
|
|
160
|
+
+ 'if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",start);else start();'
|
|
161
|
+
+ 'window.__scrollControls={by:move,sync:sync};'
|
|
162
|
+
+ '})();<' + '/script>';
|
|
163
|
+
};
|
|
164
|
+
exports.scrollControls = scrollControls;
|
|
165
|
+
|
|
166
|
+
const AI_RICH_HTML_PRIMITIVE = 'GenAIaeacdsnwHtmlPrimitive';
|
|
167
|
+
|
|
168
|
+
const htmlSection = (html, { trustedSources = [], height, typename = AI_RICH_HTML_PRIMITIVE } = {}) => {
|
|
169
|
+
if (typeof html !== 'string' || html.trim() === '') {
|
|
170
|
+
throw new TypeError('htmlSection requires a non-empty HTML string');
|
|
171
|
+
}
|
|
172
|
+
return getAIRich().newLayout('Single', {
|
|
173
|
+
payload: height === undefined ? html : lockHeight(height) + html,
|
|
174
|
+
trusted_sources: Array.isArray(trustedSources) ? trustedSources.map(String) : [],
|
|
175
|
+
__typename: typename
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
exports.htmlSection = htmlSection;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* sendHtmlApp: sends an HTML app with automatic anti-unduh (bypass download)
|
|
182
|
+
* and full dual support for WhatsApp Business and regular WhatsApp.
|
|
183
|
+
*/
|
|
184
|
+
const sendHtmlApp = async (sock, jid, html, {
|
|
185
|
+
title = '',
|
|
186
|
+
label,
|
|
187
|
+
trustedSources = [],
|
|
188
|
+
height,
|
|
189
|
+
autoHeight: auto,
|
|
190
|
+
scrollButtons,
|
|
191
|
+
typename,
|
|
192
|
+
id,
|
|
193
|
+
bypassDownload = true,
|
|
194
|
+
guard = 'warn',
|
|
195
|
+
botJid = '867051314767696@bot',
|
|
196
|
+
contextInfo = {},
|
|
197
|
+
...options
|
|
198
|
+
} = {}) => {
|
|
199
|
+
if (!sock) {
|
|
200
|
+
throw new TypeError('sendHtmlApp requires a socket as the first argument');
|
|
201
|
+
}
|
|
202
|
+
if (!jid) {
|
|
203
|
+
throw new TypeError('sendHtmlApp requires a target jid');
|
|
204
|
+
}
|
|
205
|
+
if (auto && height !== undefined) {
|
|
206
|
+
throw new TypeError('sendHtmlApp takes either height or autoHeight, not both');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (auto) {
|
|
210
|
+
html = autoHeight(auto === true ? undefined : auto) + html;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (scrollButtons) {
|
|
214
|
+
html += scrollControls(scrollButtons === true ? undefined : scrollButtons);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (guard !== false) {
|
|
218
|
+
const report = checkHtmlApp(html, { height });
|
|
219
|
+
if (!report.ok && guard === true) {
|
|
220
|
+
throw new TypeError('this html app will not behave in the WebView:\n ' + report.problems.join('\n '));
|
|
221
|
+
}
|
|
222
|
+
if (guard === 'warn') {
|
|
223
|
+
for (const problem of report.problems) {
|
|
224
|
+
sock.logger?.warn({ jid }, 'html app: ' + problem);
|
|
225
|
+
}
|
|
226
|
+
for (const warning of report.warnings) {
|
|
227
|
+
sock.logger?.warn({ jid }, 'html app: ' + warning);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const rich = new (getAIRich())(sock);
|
|
233
|
+
|
|
234
|
+
if (title) {
|
|
235
|
+
rich.setTitle(title);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
rich._addContent(
|
|
239
|
+
htmlSection(html, { trustedSources, height, ...(typename ? { typename } : {}) }),
|
|
240
|
+
label ? { messageType: 2, messageText: String(label) } : undefined,
|
|
241
|
+
id ? { id } : {}
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
const mergedContextInfo = {
|
|
245
|
+
forwardingScore: 1,
|
|
246
|
+
isForwarded: true,
|
|
247
|
+
forwardedAiBotMessageInfo: { botJid },
|
|
248
|
+
forwardOrigin: 4,
|
|
249
|
+
...(typeof global !== 'undefined' && global.owner ? {
|
|
250
|
+
businessMessageForwardInfo: { businessOwnerJid: global.owner + '@s.whatsapp.net' }
|
|
251
|
+
} : {}),
|
|
252
|
+
...contextInfo
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
return rich.send(jid, {
|
|
256
|
+
bypassDownload,
|
|
257
|
+
botJid,
|
|
258
|
+
contextInfo: mergedContextInfo,
|
|
259
|
+
...options
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
exports.sendHtmlApp = sendHtmlApp;
|
|
263
|
+
|
|
264
|
+
const sendHtmlDocument = async (sock, jid, html, { fileName = 'app.html', caption, ...options } = {}) => {
|
|
265
|
+
if (!sock) {
|
|
266
|
+
throw new TypeError('sendHtmlDocument requires a socket as the first argument');
|
|
267
|
+
}
|
|
268
|
+
if (!jid) {
|
|
269
|
+
throw new TypeError('sendHtmlDocument requires a target jid');
|
|
270
|
+
}
|
|
271
|
+
if (typeof html !== 'string' || html.trim() === '') {
|
|
272
|
+
throw new TypeError('sendHtmlDocument requires a non-empty HTML string');
|
|
273
|
+
}
|
|
274
|
+
const name = String(fileName);
|
|
275
|
+
if (!/\.html?$/i.test(name)) {
|
|
276
|
+
throw new TypeError('sendHtmlDocument fileName must end with .html or .htm');
|
|
277
|
+
}
|
|
278
|
+
return sock.sendMessage(jid, {
|
|
279
|
+
document: Buffer.from(html, 'utf-8'),
|
|
280
|
+
mimetype: HTML_MIME_TYPE,
|
|
281
|
+
fileName: name,
|
|
282
|
+
...(caption ? { caption: String(caption) } : {}),
|
|
283
|
+
...options
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
exports.sendHtmlDocument = sendHtmlDocument;
|
|
287
|
+
|
|
288
|
+
const fileArtifact = (typename) => (url, { title = '', fileExtension = 'html', fileLength = 0, pageCount, previewImage } = {}) => {
|
|
289
|
+
if (typeof url !== 'string' || url.trim() === '') {
|
|
290
|
+
throw new TypeError('a file section requires a non-empty url');
|
|
291
|
+
}
|
|
292
|
+
return getAIRich().newLayout('Single', {
|
|
293
|
+
title: String(title),
|
|
294
|
+
url,
|
|
295
|
+
file_extension: String(fileExtension).replace(/^\./, ''),
|
|
296
|
+
file_length: Number(fileLength) || 0,
|
|
297
|
+
page_count: pageCount === undefined ? undefined : Number(pageCount) || 0,
|
|
298
|
+
preview_image: previewImage,
|
|
299
|
+
__typename: typename
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
const fileSection = fileArtifact('GenAIFilePrimitive');
|
|
304
|
+
exports.fileSection = fileSection;
|
|
305
|
+
|
|
306
|
+
const fileLinkSection = fileArtifact('GenAIFileLinkPrimitive');
|
|
307
|
+
exports.fileLinkSection = fileLinkSection;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from "./generics";
|
|
2
|
+
export * from "./decode-wa-message";
|
|
3
|
+
export * from "./messages";
|
|
4
|
+
export * from "./messages-media";
|
|
5
|
+
export * from "./validate-connection";
|
|
6
|
+
export * from "./crypto";
|
|
7
|
+
export * from "./signal";
|
|
8
|
+
export * from "./noise-handler";
|
|
9
|
+
export * from "./history";
|
|
10
|
+
export * from "./chat-utils";
|
|
11
|
+
export * from "./lt-hash";
|
|
12
|
+
export * from "./auth-utils";
|
|
13
|
+
export * from "./use-multi-file-auth-state";
|
|
14
|
+
export * from "./link-preview";
|
|
15
|
+
export * from "./event-buffer";
|
|
16
|
+
export * from "./process-message";
|
|
17
|
+
export * from "./MessageBuilder";
|
|
18
|
+
export * from "./a2ui";
|
|
19
|
+
export * from "./html-app";
|
|
20
|
+
export * from "./channel-manager";
|
|
21
|
+
export * from "./mini-app";
|
|
22
|
+
export * from "./telegram-adapter";
|
|
23
|
+
export * from "./message-retry-manager";
|
|
@@ -0,0 +1,51 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./generics"), exports);
|
|
18
|
+
__exportStar(require("./decode-wa-message"), exports);
|
|
19
|
+
__exportStar(require("./messages"), exports);
|
|
20
|
+
__exportStar(require("./messages-media"), exports);
|
|
21
|
+
__exportStar(require("./validate-connection"), exports);
|
|
22
|
+
__exportStar(require("./crypto"), exports);
|
|
23
|
+
__exportStar(require("./signal"), exports);
|
|
24
|
+
__exportStar(require("./noise-handler"), exports);
|
|
25
|
+
__exportStar(require("./history"), exports);
|
|
26
|
+
__exportStar(require("./chat-utils"), exports);
|
|
27
|
+
__exportStar(require("./lt-hash"), exports);
|
|
28
|
+
__exportStar(require("./auth-utils"), exports);
|
|
29
|
+
__exportStar(require("./baileys-event-stream"), exports);
|
|
30
|
+
__exportStar(require("./use-multi-file-auth-state"), exports);
|
|
31
|
+
__exportStar(require("./link-preview"), exports);
|
|
32
|
+
__exportStar(require("./event-buffer"), exports);
|
|
33
|
+
__exportStar(require("./process-message"), exports);
|
|
34
|
+
__exportStar(require("./MessageBuilder"), exports);
|
|
35
|
+
__exportStar(require("./channel-manager"), exports);
|
|
36
|
+
__exportStar(require("./mini-app"), exports);
|
|
37
|
+
__exportStar(require("./telegram-adapter"), exports);
|
|
38
|
+
__exportStar(require("./a2ui"), exports);
|
|
39
|
+
__exportStar(require("./html-app"), exports);
|
|
40
|
+
__exportStar(require("./message-retry-manager"), exports);
|
|
41
|
+
__exportStar(require("./spr"), exports);
|
|
42
|
+
__exportStar(require("./newsletter-status"), exports);
|
|
43
|
+
__exportStar(require("./modern-messages"), exports);
|
|
44
|
+
__exportStar(require("./native-flow"), exports);
|
|
45
|
+
__exportStar(require("./status-stickers"), exports);
|
|
46
|
+
__exportStar(require("./scheduled-message"), exports);
|
|
47
|
+
__exportStar(require("./payment-messages"), exports);
|
|
48
|
+
__exportStar(require("./reporting-utils"), exports);
|
|
49
|
+
__exportStar(require("./bot-signature"), exports);
|
|
50
|
+
__exportStar(require("./extras"), exports);
|
|
51
|
+
__exportStar(require("./metaai"), exports);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUrlInfo = void 0;
|
|
4
|
+
const messages_1 = require("./messages");
|
|
5
|
+
const messages_media_1 = require("./messages-media");
|
|
6
|
+
const THUMBNAIL_WIDTH_PX = 192;
|
|
7
|
+
/** Fetches an image and generates a thumbnail for it */
|
|
8
|
+
const getCompressedJpegThumbnail = async (url, { thumbnailWidth, fetchOpts }) => {
|
|
9
|
+
const stream = await (0, messages_media_1.getHttpStream)(url, fetchOpts);
|
|
10
|
+
const result = await (0, messages_media_1.extractImageThumb)(stream, thumbnailWidth);
|
|
11
|
+
return result;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Given a piece of text, checks for any URL present, generates link preview for the same and returns it
|
|
15
|
+
* Return undefined if the fetch failed or no URL was found
|
|
16
|
+
* @param text first matched URL in text
|
|
17
|
+
* @returns the URL info required to generate link preview
|
|
18
|
+
*/
|
|
19
|
+
const getUrlInfo = async (text, opts = {
|
|
20
|
+
thumbnailWidth: THUMBNAIL_WIDTH_PX,
|
|
21
|
+
fetchOpts: { timeout: 3000 }
|
|
22
|
+
}) => {
|
|
23
|
+
var _a;
|
|
24
|
+
try {
|
|
25
|
+
// retries
|
|
26
|
+
const retries = 0;
|
|
27
|
+
const maxRetry = 5;
|
|
28
|
+
const { getLinkPreview } = await import('link-preview-js');
|
|
29
|
+
let previewLink = text;
|
|
30
|
+
if (!text.startsWith('https://') && !text.startsWith('http://')) {
|
|
31
|
+
previewLink = 'https://' + previewLink;
|
|
32
|
+
}
|
|
33
|
+
const info = await getLinkPreview(previewLink, {
|
|
34
|
+
...opts.fetchOpts,
|
|
35
|
+
followRedirects: 'follow',
|
|
36
|
+
handleRedirects: (baseURL, forwardedURL) => {
|
|
37
|
+
const urlObj = new URL(baseURL);
|
|
38
|
+
const forwardedURLObj = new URL(forwardedURL);
|
|
39
|
+
if (retries >= maxRetry) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (forwardedURLObj.hostname === urlObj.hostname
|
|
43
|
+
|| forwardedURLObj.hostname === 'www.' + urlObj.hostname
|
|
44
|
+
|| 'www.' + forwardedURLObj.hostname === urlObj.hostname) {
|
|
45
|
+
retries + 1;
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
headers: opts.fetchOpts
|
|
53
|
+
});
|
|
54
|
+
if (info && 'title' in info && info.title) {
|
|
55
|
+
const [image] = info.images;
|
|
56
|
+
const urlInfo = {
|
|
57
|
+
'canonical-url': info.url,
|
|
58
|
+
'matched-text': text,
|
|
59
|
+
title: info.title,
|
|
60
|
+
description: info.description,
|
|
61
|
+
originalThumbnailUrl: image
|
|
62
|
+
};
|
|
63
|
+
if (opts.uploadImage) {
|
|
64
|
+
const { imageMessage } = await (0, messages_1.prepareWAMessageMedia)({ image: { url: image } }, {
|
|
65
|
+
upload: opts.uploadImage,
|
|
66
|
+
mediaTypeOverride: 'thumbnail-link',
|
|
67
|
+
options: opts.fetchOpts
|
|
68
|
+
});
|
|
69
|
+
urlInfo.jpegThumbnail = (imageMessage === null || imageMessage === void 0 ? void 0 : imageMessage.jpegThumbnail)
|
|
70
|
+
? Buffer.from(imageMessage.jpegThumbnail)
|
|
71
|
+
: undefined;
|
|
72
|
+
urlInfo.highQualityThumbnail = imageMessage || undefined;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
try {
|
|
76
|
+
urlInfo.jpegThumbnail = image
|
|
77
|
+
? (await getCompressedJpegThumbnail(image, opts)).buffer
|
|
78
|
+
: undefined;
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
(_a = opts.logger) === null || _a === void 0 ? void 0 : _a.debug({ err: error.stack, url: previewLink }, 'error in generating thumbnail');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return urlInfo;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
if (!error.message.includes('receive a valid')) {
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
exports.getUrlInfo = getUrlInfo;
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
const pino_1 = __importDefault(require("pino"));
|
|
7
|
+
exports.default = (0, pino_1.default)({ timestamp: () => `,"time":"${new Date().toJSON()}"` });
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LT_HASH_ANTI_TAMPERING = void 0;
|
|
4
|
+
const crypto_1 = require("./crypto");
|
|
5
|
+
/**
|
|
6
|
+
* LT Hash is a summation based hash algorithm that maintains the integrity of a piece of data
|
|
7
|
+
* over a series of mutations. You can add/remove mutations and it'll return a hash equal to
|
|
8
|
+
* if the same series of mutations was made sequentially.
|
|
9
|
+
*/
|
|
10
|
+
const o = 128;
|
|
11
|
+
class d {
|
|
12
|
+
constructor(e) {
|
|
13
|
+
this.salt = e;
|
|
14
|
+
}
|
|
15
|
+
add(e, t) {
|
|
16
|
+
var r = this;
|
|
17
|
+
for (const item of t) {
|
|
18
|
+
e = r._addSingle(e, item);
|
|
19
|
+
}
|
|
20
|
+
return e;
|
|
21
|
+
}
|
|
22
|
+
subtract(e, t) {
|
|
23
|
+
var r = this;
|
|
24
|
+
for (const item of t) {
|
|
25
|
+
e = r._subtractSingle(e, item);
|
|
26
|
+
}
|
|
27
|
+
return e;
|
|
28
|
+
}
|
|
29
|
+
subtractThenAdd(e, t, r) {
|
|
30
|
+
var n = this;
|
|
31
|
+
return n.add(n.subtract(e, r), t);
|
|
32
|
+
}
|
|
33
|
+
_addSingle(e, t) {
|
|
34
|
+
var r = this;
|
|
35
|
+
const n = new Uint8Array((0, crypto_1.hkdf)(Buffer.from(t), o, { info: r.salt })).buffer;
|
|
36
|
+
return r.performPointwiseWithOverflow(e, n, ((e, t) => e + t));
|
|
37
|
+
}
|
|
38
|
+
_subtractSingle(e, t) {
|
|
39
|
+
var r = this;
|
|
40
|
+
const n = new Uint8Array((0, crypto_1.hkdf)(Buffer.from(t), o, { info: r.salt })).buffer;
|
|
41
|
+
return r.performPointwiseWithOverflow(e, n, ((e, t) => e - t));
|
|
42
|
+
}
|
|
43
|
+
performPointwiseWithOverflow(e, t, r) {
|
|
44
|
+
const n = new DataView(e), i = new DataView(t), a = new ArrayBuffer(n.byteLength), s = new DataView(a);
|
|
45
|
+
for (let e = 0; e < n.byteLength; e += 2) {
|
|
46
|
+
s.setUint16(e, r(n.getUint16(e, !0), i.getUint16(e, !0)), !0);
|
|
47
|
+
}
|
|
48
|
+
return a;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.LT_HASH_ANTI_TAMPERING = new d('WhatsApp Patch Integrity');
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeKeyedMutex = exports.makeMutex = void 0;
|
|
4
|
+
const makeMutex = () => {
|
|
5
|
+
let task = Promise.resolve();
|
|
6
|
+
let taskTimeout;
|
|
7
|
+
return {
|
|
8
|
+
mutex(code) {
|
|
9
|
+
task = (async () => {
|
|
10
|
+
// wait for the previous task to complete
|
|
11
|
+
// if there is an error, we swallow so as to not block the queue
|
|
12
|
+
try {
|
|
13
|
+
await task;
|
|
14
|
+
}
|
|
15
|
+
catch (_a) { }
|
|
16
|
+
try {
|
|
17
|
+
// execute the current task
|
|
18
|
+
const result = await code();
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
clearTimeout(taskTimeout);
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
25
|
+
// we replace the existing task, appending the new piece of execution to it
|
|
26
|
+
// so the next task will have to wait for this one to finish
|
|
27
|
+
return task;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
exports.makeMutex = makeMutex;
|
|
32
|
+
const makeKeyedMutex = () => {
|
|
33
|
+
const map = {};
|
|
34
|
+
return {
|
|
35
|
+
mutex(key, task) {
|
|
36
|
+
if (!map[key]) {
|
|
37
|
+
map[key] = (0, exports.makeMutex)();
|
|
38
|
+
}
|
|
39
|
+
return map[key].mutex(task);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
exports.makeKeyedMutex = makeKeyedMutex;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Logger } from 'pino';
|
|
2
|
+
import { proto } from '../../WAProto';
|
|
3
|
+
|
|
4
|
+
export declare enum RetryReason {
|
|
5
|
+
UnknownError = 0,
|
|
6
|
+
SignalErrorNoSession = 1,
|
|
7
|
+
SignalErrorInvalidKey = 2,
|
|
8
|
+
SignalErrorInvalidKeyId = 3,
|
|
9
|
+
SignalErrorInvalidMessage = 4,
|
|
10
|
+
SignalErrorInvalidSignature = 5,
|
|
11
|
+
SignalErrorFutureMessage = 6,
|
|
12
|
+
SignalErrorBadMac = 7,
|
|
13
|
+
SignalErrorInvalidSession = 8,
|
|
14
|
+
SignalErrorInvalidMsgKey = 9,
|
|
15
|
+
BadBroadcastEphemeralSetting = 10,
|
|
16
|
+
UnknownCompanionNoPrekey = 11,
|
|
17
|
+
AdvFailure = 12,
|
|
18
|
+
StatusRevokeDelay = 13
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare class MessageRetryManager {
|
|
22
|
+
logger: Logger;
|
|
23
|
+
maxMsgRetryCount: number;
|
|
24
|
+
constructor(logger?: any, maxMsgRetryCount?: number);
|
|
25
|
+
addRecentMessage(to: string, id: string, message: proto.IMessage): void;
|
|
26
|
+
getRecentMessage(to: string, id: string): { message: proto.IMessage; timestamp: number } | undefined;
|
|
27
|
+
shouldRecreateSession(jid: string, hasSession: boolean, errorCode?: number): { reason: string; recreate: boolean };
|
|
28
|
+
parseRetryErrorCode(errorAttr: string | undefined): number | undefined;
|
|
29
|
+
isMacError(errorCode: number | undefined): boolean;
|
|
30
|
+
incrementRetryCount(messageId: string): number;
|
|
31
|
+
getRetryCount(messageId: string): number;
|
|
32
|
+
hasExceededMaxRetries(messageId: string): boolean;
|
|
33
|
+
markRetrySuccess(messageId: string): void;
|
|
34
|
+
markRetryFailed(messageId: string): void;
|
|
35
|
+
schedulePhoneRequest(messageId: string, callback: () => void, delay?: number): void;
|
|
36
|
+
cancelPendingPhoneRequest(messageId: string): void;
|
|
37
|
+
clear(): void;
|
|
38
|
+
saveBaseKey(addr: string, msgId: string, baseKey: Uint8Array): void;
|
|
39
|
+
hasSameBaseKey(addr: string, msgId: string, baseKey: Uint8Array): boolean;
|
|
40
|
+
deleteBaseKey(addr: string, msgId: string): void;
|
|
41
|
+
removeRecentMessage(messageId: string): void;
|
|
42
|
+
}
|