WEB WAM IMPLEMENTATION!!!!! (#708)

* feat(WAM): initial commit

* fix(wam-development): I made a whoopsie

* Update Example/example.ts

Co-authored-by: Javier Cuevas <javiercr@gmail.com>

---------

Co-authored-by: Javier Cuevas <javiercr@gmail.com>
This commit is contained in:
Rajeh Taher
2024-04-28 14:03:24 +03:00
committed by GitHub
parent e52570bbd7
commit 306e1c1355
8 changed files with 16546 additions and 1 deletions

View File

@@ -0,0 +1,924 @@
{
"header": {
"wamVersion": 5,
"eventSequenceNumber": 26885,
"regular": true
},
"events": [
{
"WebcFingerprint": {
"props": {
"webcDocumentWebdriverEvaluate": false,
"webcDocumentSeleniumEvaluate": false,
"webcDocumentWebdriverScriptFunction": false,
"webcDocumentWebdriverScriptFunc": false,
"webcDocumentWebdriverScriptFn": false,
"webcDocumentFxdriverEvaluate": false,
"webcDocumentDriverUnwrapped": false,
"webcDocumentWebdriverUnwrapped": false,
"webcDocumentDriverEvaluate": false,
"webcDocumentSeleniumUnwrapped": false,
"webcDocumentFxdriverUnwrapped": false,
"webcDocumentElementAttrSelenium": false,
"webcDocumentElementAttrWebdriver": false,
"webcDocumentElementAttrDriver": false,
"webcWindowPhantom": false,
"webcWindowNightmare": false,
"webcWindowSelenium": false,
"webcWindowCallphantom": false,
"webcWindowCallselenium": false,
"webcWindowSeleniumIdeRecorder": false,
"webcWindowNavigatorWebdriver": 0
},
"globals": {
"platform": 8,
"deviceName": "Mac OS",
"appVersion": "2.3000.1012146637",
"appIsBetaRelease": true,
"commitTime": 1710835207,
"browserVersion": "Chrome 122.0.0.0",
"webcEnv": 0,
"browser": "Chrome",
"webcWebPlatform": 1,
"appBuild": 4,
"sequenceNumber": 0,
"webcTabId": "x311909394",
"deviceVersion": "10.15.7",
"ocVersion": 1,
"deviceClassification": 4
}
}
},
{
"WebcDbOpen": {
"props": {
"webcDbName": "wawc",
"webcDbOpenWasSuccess": true,
"webcDbOpenNumAttempts": 0
},
"globals": {
"commitTime": 1710835208,
"sequenceNumber": 1
}
}
},
{
"WebDbVersionsSource": {
"props": {
"webDbVersionSource": 1,
"webSchemaInitiator": 1
},
"globals": {
"commitTime": 1710835208,
"sequenceNumber": 2
}
}
},
{
"WebcAssetLoad": {
"props": {
"webcAssetName": "initial-assets",
"webcAssetFromCache": false,
"webcAssetCacheType": 0,
"webcAssetLoadT": 376
},
"globals": {
"commitTime": 1710835209,
"webcPhonePlatform": 2,
"sequenceNumber": 3
}
}
},
{
"WebcStorageStat": {
"props": {
"webcStorageUsage": 8158454,
"webcStorageQuota": 596797550592
},
"globals": {
"commitTime": 1710835209,
"sequenceNumber": 4
}
}
},
{
"OfflineResumeStage": {
"props": {
"offlineSessionId": "8FDE5A4D1710835208",
"offlineResumeMode": 1,
"offlineStageTimestampMs": 1799,
"currentOfflineStage": 2
},
"globals": {
"commitTime": 1710835209,
"sequenceNumber": 5
}
}
},
{
"OfflineResumeStage": {
"props": {
"offlineSessionId": "8FDE5A4D1710835208",
"offlineResumeMode": 1,
"offlineStageTimestampMs": 2244,
"currentOfflineStage": 3,
"offlineDecryptErrorCount": 0
},
"globals": {
"commitTime": 1710835210,
"webcBucket": null,
"sequenceNumber": 6,
"serviceImprovementOptOut": false
}
}
},
{
"OfflineResumeStage": {
"props": {
"offlineSessionId": "8FDE5A4D1710835208",
"offlineResumeMode": 1,
"offlineStageTimestampMs": 2328,
"currentOfflineStage": 4,
"offlineDecryptErrorCount": 0,
"chatThreadCount": 20
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 7
}
}
},
{
"WebcStreamModeChange": {
"props": {
"webcStreamMode": 1
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 8
}
}
},
{
"WebcStatusSync": {
"props": {
"webcStatusSyncT": 8,
"webcStatusRecentItemCount": 0,
"webcStatusRecentRowCount": 0,
"webcStatusViewedItemCount": 0,
"webcStatusViewedRowCount": 0,
"webcStatusMutedItemCount": 0,
"webcStatusMutedRowCount": 0
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 9
}
}
},
{
"OfflineResume": {
"props": {
"offlineMessageCount": 0,
"offlineReceiptCount": 0,
"offlineNotificationCount": 0,
"offlineDecryptErrorCount": 0,
"offlineSizeBytes": 0,
"chatThreadCount": 20,
"preackMessageCount": 0,
"preackReceiptCount": 0,
"isOfflineCompleteMissed": false,
"pageLoadT": 1436,
"isResumeInForeground": true,
"socketConnectT": 3235,
"lastStanzaT": 3680,
"mainScreenLoadT": 3765,
"mailboxAge": 0
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 10
}
}
},
{
"TsNavigation": {
"props": {
"tsSessionId": 1988827797,
"relativeTimestampMs": 234453,
"navigationSource": 6,
"navigationDestination": 8
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 11
}
}
},
{
"UserActivity": {
"props": {
"userActivitySessionId": "2mq50p",
"userActivityStartTime": 1710835183,
"userActivityBitmapLen": 24,
"userActivityBitmapLow": 12582931,
"userActivitySessionSeq": 0,
"userActivitySessionCum": 5
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 12
}
}
},
{
"TsBitArray": {
"props": {
"tsSessionId": 1988827797,
"bitarrayLength": 24,
"bitarrayLow": 12582931,
"bitarrayHigh": 0,
"cumulativeBits": 17,
"relativeTimestampMs": 211037,
"sessionSeq": 5
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 13
}
}
},
{
"WebcPageLoad": {
"props": {
"webcExeStart": 1406,
"webcExeDone": 1422,
"webcMainScriptStart": 2225,
"webcMainScriptEnd": 2235,
"webcInitialPanel": "MAIN",
"webcInitialPanelMountStartT": 4178,
"webcInitialPanelRenderT": 4338,
"webcPageLoadT": 1386,
"webcUnloadEventStart": 185,
"webcUnloadEventEnd": 185,
"webcRedirectStart": 0,
"webcRedirectEnd": 0,
"webcFetchStart": 2,
"webcDomainLookupStart": 2,
"webcDomainLookupEnd": 2,
"webcConnectStart": 2,
"webcConnectEnd": 2,
"webcSecureConnectionStart": 0,
"webcRequestStart": 4,
"webcResponseStart": 180,
"webcResponseEnd": 512,
"webcDomLoading": 191,
"webcDomInteractive": 522,
"webcDomContentLoadedEventStart": 522,
"webcDomContentLoadedEventEnd": 522,
"webcDomComplete": 1386,
"webcLoadEventStart": 1386,
"webcLoadEventEnd": 1386,
"webcCached": true,
"webcNavigation": 1,
"webcRedirectCount": 0,
"webcWsOpening": 2246,
"webcWsPairing": 3235,
"webcWsSyncing": 3235,
"webcWsNormal": 3765,
"webcWsAttempts": 1,
"webcQrCode": false,
"webcInitialPanelMountT": 3778,
"webcLoadInForeground": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 14
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yG/l/0,cross/wutZ6S4uSJD27Zd4v4x-HvK6Sjj5ZPWYb.css?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 296,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 15
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yk/r/kNbB3PuS_Bf.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 309,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 16
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yF/r/p55HfXW__mM.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 281,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 17
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yJ/r/9oJ1yn1k9uE.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 321,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 18
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/ym/r/MlywYX_J_TLaJ0ADN4LEWAWCoJeodTdwSDQjJxOHorPJvsWqehdEtWwDQVEH-g-FDC.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 312,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 19
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3iZ_S4/ys/l/makehaste_jhash/nUxbTp4lNHX.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 894,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 20
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc-translations.php/v6iZ_S4/y-/l/en_US/nUxbTp4lNHX.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 874,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 21
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3i30p4/yV/l/makehaste_jhash/iCyna0MjBGV.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 281,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 22
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc-translations.php/v6i30p4/y1/l/en_US/iCyna0MjBGV.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 891,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 23
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yX/r/7e4NMmX2B0m.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 951,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 24
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc-translations.php/v6iXYF4/y8/l/en_US/df_rO3jdhlI.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 948,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 25
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3iXYF4/yE/l/makehaste_jhash/df_rO3jdhlI.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 1092,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 26
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3ixps4/y8/l/makehaste_jhash/knKF43raTSI.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 1093,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 27
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc-translations.php/v6ixps4/yp/l/en_US/knKF43raTSI.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 896,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 28
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/killswitch/",
"webcResourceDuration": 287,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 29
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yy/r/0VfZP3-iu6n.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 67,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 30
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yM/r/FPlNguXyB9e.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 82,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 31
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3ih1C4/yN/l/makehaste_jhash/KibbF6u10gY.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 282,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 32
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3i0oM4/yw/l/makehaste_jhash/lnWgrQmN2YX.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 311,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 33
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3i68a4/y-/l/makehaste_jhash/XqFc2T3XXdL.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 308,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 34
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yt/r/iLS68Cpho3U.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 225,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 35
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yU/r/DdQbUpSH52U.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 238,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 36
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3ibOv4/yZ/l/makehaste_jhash/WAWmJZMUU6R.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 235,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 37
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3il6a4/yM/l/makehaste_jhash/kShvtcfXO0D.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 251,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 38
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3iNLP4/yS/l/makehaste_jhash/afY5G3FyBQ4.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 342,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 39
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3io034/yu/l/makehaste_jhash/0wrWn7oiQ97.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 563,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 40
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yT/r/BCEPMVgrDGc.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 262,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 41
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/y4/l/0,cross/U4m_Em-cSVc.css?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 78,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 42
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3isKW4/y0/l/makehaste_jhash/jb4EFFP9i02.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 714,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 43
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3iXg_4/y1/l/makehaste_jhash/k9NKSzUO_jN.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 638,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 44
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yu/l/0,cross/nDbTkqlvGPP.css?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 79,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 45
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yJ/r/ztUgagupDlO.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 623,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 46
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yP/r/rYZqPCBaG70.png",
"webcResourceDuration": 281,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 47
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/data/manifest.json",
"webcResourceDuration": 238,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 48
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/static_resources/webworker_v1/init_script/?__hs=19801.HYP%3Awhatsapp_comet_pkg.2.1..0.1&__spin_r=1012146637&__spin_b=trunk&__spin_t=1710835206",
"webcResourceDuration": 236,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 49
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/y-/r/qmLVV-6EM4D.png",
"webcResourceDuration": 55,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 50
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3iJeR4/yN/l/makehaste_jhash/dG5SZIGf7BA.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 316,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 51
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3iTvy4/yI/l/makehaste_jhash/x68ZDZLJQK2.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 320,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 52
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3i1IW4/yp/l/makehaste_jhash/nskS-3z5DeR.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 73,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 53
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3i6Fp4/yA/l/makehaste_jhash/GVQkKM-FFf7.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 129,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 54
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/y7/r/bm0sbp22sOS.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 185,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 55
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3/yZ/l/0,cross/V2VsZ0Z8CrF.css?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 59,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 56
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3iasf4/yv/l/makehaste_jhash/wF6oRkcktwM.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 187,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 57
}
}
},
{
"WebcResourceLoad": {
"props": {
"webcResourceName": "/rsrc.php/v3iica4/yM/l/makehaste_jhash/PbawSa9OMfG.js?_nc_x=Ij3Wp8lg5Kz",
"webcResourceDuration": 206,
"webcResourceCached": true
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 58
}
}
},
{
"TsNavigation": {
"props": {
"tsSessionId": 1988827797,
"relativeTimestampMs": 239713,
"navigationSource": 8,
"navigationDestination": 6
},
"globals": {
"commitTime": 1710835210,
"sequenceNumber": 59
}
}
},
{
"WebcImgError": {
"props": {
"webcImgErrorCode": 404
},
"globals": {
"commitTime": 1710835211,
"sequenceNumber": 60
}
}
},
{
"WebcAssetLoad": {
"props": {
"webcAssetName": "emojis",
"webcAssetFromCache": false,
"webcAssetCacheType": 0,
"webcAssetLoadT": 748
},
"globals": {
"commitTime": 1710835212,
"sequenceNumber": 61
}
}
},
{
"WebcStorageStat": {
"props": {
"webcStorageUsage": 8309457,
"webcStorageQuota": 596797550592
},
"globals": {
"commitTime": 1710835212,
"sequenceNumber": 62
}
}
}
]
}

View File

@@ -1,7 +1,7 @@
import { Boom } from '@hapi/boom'
import NodeCache from 'node-cache'
import readline from 'readline'
import makeWASocket, { AnyMessageContent, delay, DisconnectReason, fetchLatestBaileysVersion, getAggregateVotesInPollMessage, makeCacheableSignalKeyStore, makeInMemoryStore, PHONENUMBER_MCC, proto, useMultiFileAuthState, WAMessageContent, WAMessageKey } from '../src'
import makeWASocket, { AnyMessageContent, BinaryInfo, delay, DisconnectReason, encodeWAM, fetchLatestBaileysVersion, getAggregateVotesInPollMessage, makeCacheableSignalKeyStore, makeInMemoryStore, PHONENUMBER_MCC, proto, useMultiFileAuthState, WAMessageContent, WAMessageKey } from '../src'
import MAIN_LOGGER from '../src/Utils/logger'
import open from 'open'
import fs from 'fs'
@@ -176,6 +176,36 @@ const startSock = async() => {
console.log('Connection closed. You are logged out.')
}
}
// WARNING: THIS WILL SEND A WAM EXAMPLE AND THIS IS A ****CAPTURED MESSAGE.****
// DO NOT ACTUALLY ENABLE THIS UNLESS YOU MODIFIED THE FILE.JSON!!!!!
// THE ANALYTICS IN THE FILE ARE OLD. DO NOT USE THEM.
// YOUR APP SHOULD HAVE GLOBALS AND ANALYTICS ACCURATE TO TIME, DATE AND THE SESSION
// THIS FILE.JSON APPROACH IS JUST AN APPROACH I USED, BE FREE TO DO THIS IN ANOTHER WAY.
// THE FIRST EVENT CONTAINS THE CONSTANT GLOBALS, EXCEPT THE seqenceNumber(in the event) and commitTime
// THIS INCLUDES STUFF LIKE ocVersion WHICH IS CRUCIAL FOR THE PREVENTION OF THE WARNING
const sendWAMExample = false;
if(connection === 'open' && sendWAMExample) {
/// sending WAM EXAMPLE
const {
header: {
wamVersion,
eventSequenceNumber,
},
events,
} = JSON.parse(await fs.promises.readFile("./boot_analytics_test.json", "utf-8"))
const binaryInfo = new BinaryInfo({
protocolVersion: wamVersion,
sequence: eventSequenceNumber,
events: events
})
const buffer = encodeWAM(binaryInfo);
const result = await sock.sendWAMBuffer(buffer)
console.log(result)
}
console.log('connection update', update)
}

View File

@@ -547,6 +547,24 @@ export const makeSocket = (config: SocketConfig) => {
return Buffer.concat([salt, randomIv, ciphered])
}
const sendWAMBuffer = (wamBuffer: Buffer) => {
return query({
tag: 'iq',
attrs: {
to: S_WHATSAPP_NET,
id: generateMessageTag(),
xmlns: 'w:stats'
},
content: [
{
tag: 'add',
attrs: {},
content: wamBuffer
}
]
})
}
ws.on('message', onMessageRecieved)
ws.on('open', async() => {
try {
@@ -723,6 +741,7 @@ export const makeSocket = (config: SocketConfig) => {
requestPairingCode,
/** Waits for the connection to WA to reach a state */
waitForConnectionUpdate: bindWaitForConnectionUpdate(ev),
sendWAMBuffer,
}
}

12
src/WAM/BinaryInfo.ts Normal file
View File

@@ -0,0 +1,12 @@
import { EventInputType } from './constants'
export class BinaryInfo {
protocolVersion = 5
sequence = 0
events = [] as EventInputType[]
buffer: Buffer[] = []
constructor(options: Partial<BinaryInfo> = {}) {
Object.assign(this, options)
}
}

15382
src/WAM/constants.ts Normal file

File diff suppressed because it is too large Load Diff

174
src/WAM/encode.ts Normal file
View File

@@ -0,0 +1,174 @@
import { BinaryInfo } from './BinaryInfo'
import { FLAG_BYTE, FLAG_EVENT, FLAG_EXTENDED, FLAG_FIELD, FLAG_GLOBAL, WEB_EVENTS, WEB_GLOBALS } from './constants'
const getHeaderBitLength = (key: number) => (key < 256 ? 2 : 3)
type Value = number | null | string
export const encodeWAM = (binaryInfo: BinaryInfo) => {
binaryInfo.buffer = []
encodeWAMHeader(binaryInfo)
encodeEvents(binaryInfo)
console.log(binaryInfo.buffer)
const totalSize = binaryInfo.buffer
.map((a) => a.length)
.reduce((a, b) => a + b)
const buffer = Buffer.alloc(totalSize)
let offset = 0
binaryInfo.buffer.forEach((buffer_) => {
buffer_.copy(buffer, offset)
offset += buffer_.length
})
return buffer
}
function encodeWAMHeader(binaryInfo: BinaryInfo) {
const headerBuffer = Buffer.alloc(8) // starting buffer
headerBuffer.write('WAM', 0, 'utf8')
headerBuffer.writeUInt8(binaryInfo.protocolVersion, 3)
headerBuffer.writeUInt8(1, 4) //random flag
headerBuffer.writeUInt16BE(binaryInfo.sequence, 5)
headerBuffer.writeUInt8(0, 7) // regular channel
binaryInfo.buffer.push(headerBuffer)
}
function encodeGlobalAttributes(binaryInfo: BinaryInfo, globals: {[key: string]: Value}) {
for(const [key, _value] of Object.entries(globals)) {
const id = WEB_GLOBALS.find(a => a?.name === key)!.id
let value = _value
if(typeof value === 'boolean') {
value = value ? 1 : 0
}
binaryInfo.buffer.push(serializeData(id, value, FLAG_GLOBAL))
}
}
function encodeEvents(binaryInfo: BinaryInfo) {
for(const [
name,
{ props, globals },
] of binaryInfo.events.map((a) => Object.entries(a)[0])) {
encodeGlobalAttributes(binaryInfo, globals)
const event = WEB_EVENTS.find((a) => a.name === name)!
const props_ = Object.entries(props)
let extended = false
for(const [, value] of props_) {
extended ||= value !== null
}
const eventFlag = extended ? FLAG_EVENT : FLAG_EVENT | FLAG_EXTENDED
binaryInfo.buffer.push(serializeData(event.id, -event.weight, eventFlag))
for(let i = 0; i < props_.length; i++) {
const [key, _value] = props_[i]
const id = (event.props)[key][0]
extended = i < (props_.length - 1)
let value = _value
if(typeof value === 'boolean') {
value = value ? 1 : 0
}
const fieldFlag = extended ? FLAG_EVENT : FLAG_FIELD | FLAG_EXTENDED
binaryInfo.buffer.push(serializeData(id, value as Value, fieldFlag))
}
}
}
function serializeData(key: number, value: Value, flag: number): Buffer {
const bufferLength = getHeaderBitLength(key)
let buffer: Buffer
let offset = 0
if(value === null) {
if(flag === FLAG_GLOBAL) {
buffer = Buffer.alloc(bufferLength)
offset = serializeHeader(buffer, offset, key, flag)
return buffer
}
} else if(typeof value === 'number' && Number.isInteger(value)) {
// is number
if(value === 0 || value === 1) {
buffer = Buffer.alloc(bufferLength)
offset = serializeHeader(buffer, offset, key, flag | ((value + 1) << 4))
return buffer
} else if(-128 <= value && value < 128) {
buffer = Buffer.alloc(bufferLength + 1)
offset = serializeHeader(buffer, offset, key, flag | (3 << 4))
buffer.writeInt8(value, offset)
return buffer
} else if(-32768 <= value && value < 32768) {
buffer = Buffer.alloc(bufferLength + 2)
offset = serializeHeader(buffer, offset, key, flag | (4 << 4))
buffer.writeInt16LE(value, offset)
return buffer
} else if(-2147483648 <= value && value < 2147483648) {
buffer = Buffer.alloc(bufferLength + 4)
offset = serializeHeader(buffer, offset, key, flag | (5 << 4))
buffer.writeInt32LE(value, offset)
return buffer
} else {
buffer = Buffer.alloc(bufferLength + 8)
offset = serializeHeader(buffer, offset, key, flag | (7 << 4))
buffer.writeDoubleLE(value, offset)
return buffer
}
} else if(typeof value === 'number') {
// is float
buffer = Buffer.alloc(bufferLength + 8)
offset = serializeHeader(buffer, offset, key, flag | (7 << 4))
buffer.writeDoubleLE(value, offset)
return buffer
} else if(typeof value === 'string') {
// is string
const utf8Bytes = Buffer.byteLength(value, 'utf8')
if(utf8Bytes < 256) {
buffer = Buffer.alloc(bufferLength + 1 + utf8Bytes)
offset = serializeHeader(buffer, offset, key, flag | (8 << 4))
buffer.writeUint8(utf8Bytes, offset++)
} else if(utf8Bytes < 65536) {
buffer = Buffer.alloc(bufferLength + 2 + utf8Bytes)
offset = serializeHeader(buffer, offset, key, flag | (9 << 4))
buffer.writeUInt16LE(utf8Bytes, offset)
offset += 2
} else {
buffer = Buffer.alloc(bufferLength + 4 + utf8Bytes)
offset = serializeHeader(buffer, offset, key, flag | (10 << 4))
buffer.writeUInt32LE(utf8Bytes, offset)
offset += 4
}
buffer.write(value, offset, 'utf8')
return buffer
}
throw 'missing'
}
function serializeHeader(
buffer: Buffer,
offset: number,
key: number,
flag: number
) {
if(key < 256) {
buffer.writeUInt8(flag, offset)
offset += 1
buffer.writeUInt8(key, offset)
offset += 1
} else {
buffer.writeUInt8(flag | FLAG_BYTE, offset)
offset += 1
buffer.writeUInt16LE(key, offset)
offset += 2
}
return offset
}

3
src/WAM/index.ts Normal file
View File

@@ -0,0 +1,3 @@
export * from './constants'
export * from './encode'
export * from './BinaryInfo'

View File

@@ -6,6 +6,7 @@ export * from './Types'
export * from './Store'
export * from './Defaults'
export * from './WABinary'
export * from './WAM'
export type WASocket = ReturnType<typeof makeWASocket>
export { makeWASocket }