mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: native-mobile-api
This commit is contained in:
@@ -4,22 +4,36 @@ import type { AuthenticationState, MediaType, SocketConfig, WAVersion } from '..
|
||||
import { Browsers } from '../Utils'
|
||||
import logger from '../Utils/logger'
|
||||
import { version } from './baileys-version.json'
|
||||
import phoneNumberMCC from './phonenumber-mcc.json'
|
||||
|
||||
export const UNAUTHORIZED_CODES = [401, 403, 419]
|
||||
|
||||
export const PHONENUMBER_MCC = phoneNumberMCC
|
||||
|
||||
export const DEFAULT_ORIGIN = 'https://web.whatsapp.com'
|
||||
export const MOBILE_ENDPOINT = 'g.whatsapp.net'
|
||||
export const MOBILE_PORT = 443
|
||||
export const DEF_CALLBACK_PREFIX = 'CB:'
|
||||
export const DEF_TAG_PREFIX = 'TAG:'
|
||||
export const PHONE_CONNECTION_CB = 'CB:Pong'
|
||||
|
||||
export const WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60
|
||||
|
||||
export const MOBILE_TOKEN = Buffer.from('0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSM4174c0243f5277a5d7720ce842cc4ae6')
|
||||
export const MOBILE_REGISTRATION_ENDPOINT = 'https://v.whatsapp.net/v2'
|
||||
export const MOBILE_USERAGENT = 'WhatsApp/2.22.24.81 iOS/15.3.1 Device/Apple-iPhone_7'
|
||||
export const REGISTRATION_PUBLIC_KEY = Buffer.from([
|
||||
5, 142, 140, 15, 116, 195, 235, 197, 215, 166, 134, 92, 108, 60, 132, 56, 86, 176, 97, 33, 204, 232, 234, 119, 77,
|
||||
34, 251, 111, 18, 37, 18, 48, 45,
|
||||
])
|
||||
export const NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0'
|
||||
export const DICT_VERSION = 2
|
||||
export const KEY_BUNDLE_TYPE = Buffer.from([5])
|
||||
export const NOISE_WA_HEADER = Buffer.from(
|
||||
[ 87, 65, 6, DICT_VERSION ]
|
||||
) // last is "DICT_VERSION"
|
||||
export const PROTOCOL_VERSION = [5, 2]
|
||||
export const MOBILE_NOISE_HEADER = Buffer.concat([Buffer.from('WA'), Buffer.from(PROTOCOL_VERSION)])
|
||||
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
||||
export const URL_REGEX = /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/
|
||||
export const URL_EXCLUDE_REGEX = /.*@.*/
|
||||
|
||||
223
src/Defaults/phonenumber-mcc.json
Normal file
223
src/Defaults/phonenumber-mcc.json
Normal file
@@ -0,0 +1,223 @@
|
||||
{
|
||||
"93": 412,
|
||||
"355": 276,
|
||||
"213": 603,
|
||||
"1-684": 544,
|
||||
"376": 213,
|
||||
"244": 631,
|
||||
"1-264": 365,
|
||||
"1-268": 344,
|
||||
"54": 722,
|
||||
"374": 283,
|
||||
"297": 363,
|
||||
"61": 505,
|
||||
"43": 232,
|
||||
"994": 400,
|
||||
"1-242": 364,
|
||||
"973": 426,
|
||||
"880": 470,
|
||||
"1-246": 342,
|
||||
"375": 257,
|
||||
"32": 206,
|
||||
"501": 702,
|
||||
"229": 616,
|
||||
"1-441": 350,
|
||||
"975": 402,
|
||||
"591": 736,
|
||||
"387": 218,
|
||||
"267": 652,
|
||||
"55": 724,
|
||||
"1-284": 348,
|
||||
"673": 528,
|
||||
"359": 284,
|
||||
"226": 613,
|
||||
"257": 642,
|
||||
"855": 456,
|
||||
"237": 624,
|
||||
"238": 625,
|
||||
"1-345": 346,
|
||||
"236": 623,
|
||||
"235": 622,
|
||||
"56": 730,
|
||||
"86": 454,
|
||||
"57": 732,
|
||||
"269": 654,
|
||||
"682": 548,
|
||||
"506": 712,
|
||||
"385": 219,
|
||||
"53": 368,
|
||||
"357": 280,
|
||||
"420": 230,
|
||||
"243": 630,
|
||||
"45": 238,
|
||||
"253": 638,
|
||||
"1-767": 366,
|
||||
"1-809": 370,
|
||||
"1-849": 370,
|
||||
"1-829": 370,
|
||||
"593": 740,
|
||||
"20": 602,
|
||||
"503": 706,
|
||||
"240": 627,
|
||||
"291": 657,
|
||||
"372": 248,
|
||||
"251": 636,
|
||||
"500": 750,
|
||||
"298": 288,
|
||||
"679": 542,
|
||||
"358": 244,
|
||||
"33": 208,
|
||||
"689": 547,
|
||||
"241": 628,
|
||||
"220": 607,
|
||||
"995": 282,
|
||||
"49": 262,
|
||||
"233": 620,
|
||||
"350": 266,
|
||||
"30": 202,
|
||||
"299": 290,
|
||||
"1-473": 352,
|
||||
"1-671": 535,
|
||||
"502": 704,
|
||||
"224": 537,
|
||||
"592": 738,
|
||||
"509": 372,
|
||||
"504": 708,
|
||||
"852": 454,
|
||||
"36": 216,
|
||||
"354": 274,
|
||||
"91": 404,
|
||||
"62": 510,
|
||||
"98": 432,
|
||||
"964": 418,
|
||||
"353": 234,
|
||||
"972": 425,
|
||||
"39": 222,
|
||||
"225": 612,
|
||||
"1-876": 338,
|
||||
"81": 440,
|
||||
"962": 416,
|
||||
"254": 639,
|
||||
"686": 545,
|
||||
"383": 221,
|
||||
"965": 419,
|
||||
"371": 247,
|
||||
"961": 415,
|
||||
"266": 651,
|
||||
"231": 618,
|
||||
"218": 606,
|
||||
"423": 295,
|
||||
"370": 246,
|
||||
"352": 270,
|
||||
"389": 294,
|
||||
"261": 646,
|
||||
"265": 650,
|
||||
"60": 502,
|
||||
"960": 472,
|
||||
"223": 610,
|
||||
"356": 278,
|
||||
"692": 551,
|
||||
"222": 609,
|
||||
"230": 617,
|
||||
"52": 334,
|
||||
"691": 550,
|
||||
"373": 259,
|
||||
"377": 212,
|
||||
"976": 428,
|
||||
"382": 297,
|
||||
"1-664": 354,
|
||||
"212": 604,
|
||||
"258": 643,
|
||||
"95": 414,
|
||||
"264": 649,
|
||||
"674": 536,
|
||||
"977": 429,
|
||||
"31": 204,
|
||||
"687": 546,
|
||||
"64": 530,
|
||||
"505": 710,
|
||||
"227": 614,
|
||||
"234": 621,
|
||||
"683": 555,
|
||||
"1-670": 534,
|
||||
"47": 242,
|
||||
"968": 226,
|
||||
"92": 410,
|
||||
"680": 552,
|
||||
"970": 423,
|
||||
"507": 714,
|
||||
"675": 537,
|
||||
"595": 744,
|
||||
"51": 716,
|
||||
"63": 515,
|
||||
"48": 260,
|
||||
"351": 268,
|
||||
"1-787, 1-939": 330,
|
||||
"974": 427,
|
||||
"242": 630,
|
||||
"40": 226,
|
||||
"7": 250,
|
||||
"250": 635,
|
||||
"290": 658,
|
||||
"1-869": 356,
|
||||
"1-758": 358,
|
||||
"508": 308,
|
||||
"1-784": 360,
|
||||
"685": 544,
|
||||
"378": 292,
|
||||
"239": 626,
|
||||
"966": 420,
|
||||
"221": 608,
|
||||
"381": 220,
|
||||
"248": 633,
|
||||
"232": 619,
|
||||
"65": 525,
|
||||
"386": 293,
|
||||
"677": 540,
|
||||
"27": 655,
|
||||
"211": 659,
|
||||
"34": 214,
|
||||
"94": 413,
|
||||
"249": 634,
|
||||
"597": 746,
|
||||
"268": 653,
|
||||
"46": 240,
|
||||
"41": 228,
|
||||
"963": 417,
|
||||
"886": 466,
|
||||
"992": 436,
|
||||
"255": 640,
|
||||
"66": 520,
|
||||
"228": 615,
|
||||
"690": 554,
|
||||
"676": 539,
|
||||
"1-868": 374,
|
||||
"216": 605,
|
||||
"90": 286,
|
||||
"993": 438,
|
||||
"1-649": 376,
|
||||
"688": 553,
|
||||
"1-340": 332,
|
||||
"256": 641,
|
||||
"380": 255,
|
||||
"971": 424,
|
||||
"44": 234,
|
||||
"1": 310,
|
||||
"598": 748,
|
||||
"998": 434,
|
||||
"678": 541,
|
||||
"379": 225,
|
||||
"58": 734,
|
||||
"681": 543,
|
||||
"967": 421,
|
||||
"260": 645,
|
||||
"263": 648,
|
||||
"670": 514,
|
||||
"245": 632,
|
||||
"856": 457,
|
||||
"599": 362,
|
||||
"850": 467,
|
||||
"262": 647,
|
||||
"82": 450,
|
||||
"84": 452
|
||||
}
|
||||
Reference in New Issue
Block a user