UNPKG

@rexxhayanasi/elaina-bail

Version:
107 lines (106 loc) 4.54 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); 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; const WAProto_1 = require("../../WAProto"); const libsignal_1 = require("../Signal/libsignal"); const Utils_1 = require("../Utils"); const logger_1 = __importDefault(require("../Utils/logger")); const baileys_version_json_1 = require("./baileys-version.json"); exports.UNAUTHORIZED_CODES = [401, 403, 419]; exports.DEFAULT_ORIGIN = 'https://web.whatsapp.com'; exports.DEF_CALLBACK_PREFIX = 'CB:'; exports.DEF_TAG_PREFIX = 'TAG:'; exports.PHONE_CONNECTION_CB = 'CB:Pong'; exports.WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60; exports.NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0'; exports.DICT_VERSION = 3; exports.KEY_BUNDLE_TYPE = Buffer.from([5]); exports.NOISE_WA_HEADER = Buffer.from([87, 65, 6, exports.DICT_VERSION]); // last is "DICT_VERSION" /** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */ exports.URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g; exports.WA_CERT_DETAILS = { SERIAL: 0, }; exports.PROCESSABLE_HISTORY_TYPES = [ WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.INITIAL_BOOTSTRAP, WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.PUSH_NAME, WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.RECENT, WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.FULL, WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.ON_DEMAND, ]; exports.DEFAULT_CONNECTION_CONFIG = { version: baileys_version_json_1.version, browser: Utils_1.Browsers.ubuntu('Chrome'), waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat', connectTimeoutMs: 20000, keepAliveIntervalMs: 30000, logger: logger_1.default.child({ class: 'baileys' }), printQRInTerminal: false, emitOwnEvents: true, defaultQueryTimeoutMs: 60000, customUploadHosts: [], retryRequestDelayMs: 250, maxMsgRetryCount: 5, fireInitQueries: true, auth: undefined, markOnlineOnConnect: true, syncFullHistory: false, patchMessageBeforeSending: msg => msg, shouldSyncHistoryMessage: () => true, shouldIgnoreJid: () => false, linkPreviewImageThumbnailWidth: 192, transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 }, generateHighQualityLinkPreview: false, options: {}, appStateMacVerification: { patch: false, snapshot: false, }, countryCode: 'US', getMessage: async () => undefined, cachedGroupMetadata: async () => undefined, makeSignalRepository: libsignal_1.makeLibSignalRepository }; exports.MEDIA_PATH_MAP = { image: '/mms/image', video: '/mms/video', document: '/mms/document', audio: '/mms/audio', sticker: '/mms/image', 'thumbnail-link': '/mms/image', 'product-catalog-image': '/product/image', 'md-app-state': '', 'md-msg-hist': '/mms/md-app-state', }; exports.MEDIA_HKDF_KEY_MAPPING = { 'audio': 'Audio', 'document': 'Document', 'gif': 'Video', 'image': 'Image', 'ppic': '', 'product': 'Image', 'ptt': 'Audio', 'sticker': 'Image', 'video': 'Video', 'thumbnail-document': 'Document Thumbnail', 'thumbnail-image': 'Image Thumbnail', 'thumbnail-video': 'Video Thumbnail', 'thumbnail-link': 'Link Thumbnail', 'md-msg-hist': 'History', 'md-app-state': 'App State', 'product-catalog-image': '', 'payment-bg-image': 'Payment Background', 'ptv': 'Video' }; exports.MEDIA_KEYS = Object.keys(exports.MEDIA_PATH_MAP); exports.MIN_PREKEY_COUNT = 5; exports.INITIAL_PREKEY_COUNT = 30; exports.DEFAULT_CACHE_TTLS = { SIGNAL_STORE: 5 * 60, // 5 minutes MSG_RETRY: 60 * 60, // 1 hour CALL_OFFER: 5 * 60, // 5 minutes USER_DEVICES: 5 * 60, // 5 minutes };