Merge branch 'master' of https://github.com/WhiskeySockets/Baileys into fix-eslint-prettier-editorconfig-rules

This commit is contained in:
canove
2025-05-28 22:42:28 -03:00
24 changed files with 16429 additions and 834 deletions

View File

@@ -8,3 +8,4 @@ WAProto
WASignalGroup WASignalGroup
Example/Example.ts Example/Example.ts
docs docs
proto-extract

44
.github/README.md vendored Normal file
View File

@@ -0,0 +1,44 @@
<h1><img alt="Baileys logo" src="https://raw.githubusercontent.com/WhiskeySockets/Baileys/refs/heads/master/Media/logo.png" height="75"/></h1>
![NPM Downloads](https://img.shields.io/npm/dw/%40whiskeysockets%2Fbaileys?label=npm&color=%23CB3837)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/whiskeysockets/baileys)
![Discord](https://img.shields.io/discord/725839806084546610?label=discord&color=%235865F2)
Baileys is a WebSockets-based TypeScript library for interacting with the WhatsApp Web API.
# Usage
A new guide has been posted at https://baileys.wiki. The old guide can be accessed on [NPM](https://npmjs.com/package/baileys).
# Sponsor
If you'd like to financially support this project, you can do so by supporting the current maintainer [here](https://purpshell.dev/sponsor).
# Disclaimer
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates.
The official WhatsApp website can be found at whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.
The maintainers of Baileys do not in any way condone the use of this application in practices that violate the Terms of Service of WhatsApp. The maintainers of this application call upon the personal responsibility of its users to use this application in a fair way, as it is intended to be used.
Use at your own discretion. Do not spam people with this. We discourage any stalkerware, bulk or automated messaging usage.
# License
Copyright (c) 2025 Rajeh Taher/WhiskeySockets
Licensed under the MIT License:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Thus, the maintainers of the project can't be held liable for any potential misuse of this project.

View File

@@ -3,7 +3,9 @@ name: Mark stale issues and pull requests
on: on:
schedule: schedule:
- cron: "30 1 * * *" - cron: "30 1 * * *"
permissions:
issues: write
pull-requests: write
jobs: jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -11,7 +13,9 @@ jobs:
- uses: actions/stale@v3 - uses: actions/stale@v3
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 6 days with no activity. Remove the stale label or comment or this will be closed in 2 days' stale-issue-message: 'This issue is stale because it has been open 15 days with no activity. Remove the stale label or comment or this will be closed in 15 days'
stale-pr-message: 'This PR is stale because it has been open 6 days with no activity. Remove the stale label or comment or this will be closed in 2 days' stale-pr-message: 'This PR is stale because it has been open 15 days with no activity. Remove the stale label or comment or this will be closed in 15 days'
days-before-stale: 6 days-before-stale: 15
days-before-close: 2 days-before-close: 30
exempt-issue-labels: 'bug,enhancement'
exempt-pr-labels: 'bug,enhancement'

View File

@@ -1,4 +1,4 @@
## 6.7.16 (2025-03-04) ## 6.7.18 (2025-05-28)

1267
README.md

File diff suppressed because it is too large Load Diff

2
WAProto/GenerateStatics.sh Executable file
View File

@@ -0,0 +1,2 @@
yarn pbjs -t static-module -w commonjs -o ./WAProto/index.js ./WAProto/WAProto.proto;
yarn pbts -o ./WAProto/index.d.ts ./WAProto/index.js;

View File

@@ -1,7 +1,7 @@
syntax = "proto3"; syntax = "proto3";
package proto; package proto;
/// WhatsApp Version: 2.3000.1020608496 /// WhatsApp Version: 2.3000.1023047013
message ADVDeviceIdentity { message ADVDeviceIdentity {
optional uint32 rawId = 1; optional uint32 rawId = 1;
@@ -42,14 +42,16 @@ message ADVSignedKeyIndexList {
optional bytes accountSignatureKey = 3; optional bytes accountSignatureKey = 3;
} }
message AIQueryFanout {
optional MessageKey messageKey = 1;
optional Message message = 2;
optional int64 timestamp = 3;
}
message AIRichResponseMessage { message AIRichResponseMessage {
optional AIRichResponseMessageType messageType = 1; optional AIRichResponseMessageType messageType = 1;
repeated AIRichResponseSubMessage submessages = 2; repeated AIRichResponseSubMessage submessages = 2;
optional AIRichResponseAbstractData abstractData = 3; optional AIRichResponseUnifiedResponse unifiedResponse = 3;
message AIRichResponseAbstractData {
optional bytes data = 1;
}
message AIRichResponseCodeMetadata { message AIRichResponseCodeMetadata {
optional string codeLanguage = 1; optional string codeLanguage = 1;
repeated AIRichResponseCodeBlock codeBlocks = 2; repeated AIRichResponseCodeBlock codeBlocks = 2;
@@ -134,6 +136,10 @@ message AIRichResponseMessage {
optional double width = 3; optional double width = 3;
optional double height = 4; optional double height = 4;
optional double fontHeight = 5; optional double fontHeight = 5;
optional double imageTopPadding = 6;
optional double imageLeadingPadding = 7;
optional double imageBottomPadding = 8;
optional double imageTrailingPadding = 9;
} }
} }
@@ -193,6 +199,17 @@ message AIRichResponseMessage {
} }
message AIRichResponseUnifiedResponse {
optional bytes data = 1;
}
}
message Account {
optional string lid = 1;
optional string username = 2;
optional string countryCode = 3;
optional bool isUsernameDeleted = 4;
} }
message ActionLink { message ActionLink {
@@ -256,6 +273,11 @@ message BizIdentityInfo {
} }
} }
message BotAgeCollectionMetadata {
optional bool ageCollectionEligible = 1;
optional bool shouldTriggerAgeCollectionOnClient = 2;
}
message BotAvatarMetadata { message BotAvatarMetadata {
optional uint32 sentiment = 1; optional uint32 sentiment = 1;
optional string behaviorGraph = 2; optional string behaviorGraph = 2;
@@ -297,6 +319,12 @@ message BotCapabilityMetadata {
AGENTIC_PLANNING = 27; AGENTIC_PLANNING = 27;
ACCOUNT_LINKING = 28; ACCOUNT_LINKING = 28;
STREAMING_DISAGGREGATION = 29; STREAMING_DISAGGREGATION = 29;
RICH_RESPONSE_GRID_IMAGE_3P = 30;
RICH_RESPONSE_LATEX_INLINE = 31;
QUERY_PLAN = 32;
PROACTIVE_MESSAGE = 33;
RICH_RESPONSE_UNIFIED_RESPONSE = 34;
PROMOTION_MESSAGE = 35;
} }
} }
@@ -321,6 +349,7 @@ message BotLinkedAccount {
message BotLinkedAccountsMetadata { message BotLinkedAccountsMetadata {
repeated BotLinkedAccount accounts = 1; repeated BotLinkedAccount accounts = 1;
optional bytes acAuthTokens = 2; optional bytes acAuthTokens = 2;
optional int32 acErrorCode = 3;
} }
message BotMediaMetadata { message BotMediaMetadata {
@@ -372,6 +401,12 @@ message BotMetadata {
optional BotRenderingMetadata renderingMetadata = 16; optional BotRenderingMetadata renderingMetadata = 16;
optional BotMetricsMetadata botMetricsMetadata = 17; optional BotMetricsMetadata botMetricsMetadata = 17;
optional BotLinkedAccountsMetadata botLinkedAccountsMetadata = 18; optional BotLinkedAccountsMetadata botLinkedAccountsMetadata = 18;
optional BotSourcesMetadata richResponseSourcesMetadata = 19;
optional bytes aiConversationContext = 20;
optional BotPromotionMessageMetadata botPromotionMessageMetadata = 21;
optional BotModeSelectionMetadata botModeSelectionMetadata = 22;
optional BotQuotaMetadata botQuotaMetadata = 23;
optional BotAgeCollectionMetadata botAgeCollectionMetadata = 24;
} }
enum BotMetricsEntryPoint { enum BotMetricsEntryPoint {
@@ -392,10 +427,32 @@ enum BotMetricsEntryPoint {
FORWARD = 15; FORWARD = 15;
APP_SHORTCUT = 16; APP_SHORTCUT = 16;
FF_FAMILY = 17; FF_FAMILY = 17;
AI_TAB = 18;
AI_HOME = 19;
AI_DEEPLINK_IMMERSIVE = 20;
AI_DEEPLINK = 21;
META_AI_CHAT_SHORTCUT_AI_STUDIO = 22;
UGC_CHAT_SHORTCUT_AI_STUDIO = 23;
NEW_CHAT_AI_STUDIO = 24;
} }
message BotMetricsMetadata { message BotMetricsMetadata {
optional string destinationId = 1; optional string destinationId = 1;
optional BotMetricsEntryPoint destinationEntryPoint = 2; optional BotMetricsEntryPoint destinationEntryPoint = 2;
optional BotMetricsThreadEntryPoint threadOrigin = 3;
}
enum BotMetricsThreadEntryPoint {
AI_TAB_THREAD = 1;
AI_HOME_THREAD = 2;
AI_DEEPLINK_IMMERSIVE_THREAD = 3;
AI_DEEPLINK_THREAD = 4;
}
message BotModeSelectionMetadata {
repeated BotUserSelectionMode mode = 1;
enum BotUserSelectionMode {
UNKNOWN_MODE = 0;
REASONING_MODE = 1;
}
} }
message BotModelMetadata { message BotModelMetadata {
@@ -449,6 +506,14 @@ message BotProgressIndicatorMetadata {
optional PlanningStepStatus status = 4; optional PlanningStepStatus status = 4;
optional bool isReasoning = 5; optional bool isReasoning = 5;
optional bool isEnhancedSearch = 6; optional bool isEnhancedSearch = 6;
repeated BotPlanningStepSectionMetadata sections = 7;
message BotPlanningSearchSourceMetadata {
optional string title = 1;
optional BotProgressIndicatorMetadata.BotPlanningStepMetadata.BotSearchSourceProvider provider = 2;
optional string sourceUrl = 3;
optional string favIconUrl = 4;
}
message BotPlanningSearchSourcesMetadata { message BotPlanningSearchSourcesMetadata {
optional string sourceTitle = 1; optional string sourceTitle = 1;
optional BotPlanningSearchSourceProvider provider = 2; optional BotPlanningSearchSourceProvider provider = 2;
@@ -461,6 +526,18 @@ message BotProgressIndicatorMetadata {
} }
} }
message BotPlanningStepSectionMetadata {
optional string sectionTitle = 1;
optional string sectionBody = 2;
repeated BotProgressIndicatorMetadata.BotPlanningStepMetadata.BotPlanningSearchSourceMetadata sourcesMetadata = 3;
}
enum BotSearchSourceProvider {
UNKNOWN_PROVIDER = 0;
OTHER = 1;
GOOGLE = 2;
BING = 3;
}
enum PlanningStepStatus { enum PlanningStepStatus {
UNKNOWN = 0; UNKNOWN = 0;
PLANNED = 1; PLANNED = 1;
@@ -471,6 +548,15 @@ message BotProgressIndicatorMetadata {
} }
message BotPromotionMessageMetadata {
optional BotPromotionType promotionType = 1;
optional string buttonTitle = 2;
enum BotPromotionType {
UNKNOWN_TYPE = 0;
C50 = 1;
}
}
message BotPromptSuggestion { message BotPromptSuggestion {
optional string prompt = 1; optional string prompt = 1;
optional string promptId = 2; optional string promptId = 2;
@@ -480,6 +566,20 @@ message BotPromptSuggestions {
repeated BotPromptSuggestion suggestions = 1; repeated BotPromptSuggestion suggestions = 1;
} }
message BotQuotaMetadata {
repeated BotFeatureQuotaMetadata botFeatureQuotaMetadata = 1;
message BotFeatureQuotaMetadata {
optional BotFeatureType featureType = 1;
optional uint32 remainingQuota = 2;
optional uint64 expirationTimestamp = 3;
enum BotFeatureType {
UNKNOWN_FEATURE = 0;
REASONING_FEATURE = 1;
}
}
}
message BotReminderMetadata { message BotReminderMetadata {
optional MessageKey requestMessageKey = 1; optional MessageKey requestMessageKey = 1;
optional ReminderAction action = 2; optional ReminderAction action = 2;
@@ -524,6 +624,25 @@ enum BotSessionSource {
EMU_FLASH_FOLLOWUP = 5; EMU_FLASH_FOLLOWUP = 5;
VOICE = 6; VOICE = 6;
} }
message BotSourcesMetadata {
repeated BotSourceItem sources = 1;
message BotSourceItem {
optional SourceProvider provider = 1;
optional string thumbnailCdnUrl = 2;
optional string sourceProviderUrl = 3;
optional string sourceQuery = 4;
optional string faviconCdnUrl = 5;
optional uint32 citationNumber = 6;
enum SourceProvider {
UNKNOWN = 0;
BING = 1;
GOOGLE = 2;
SUPPORT = 3;
}
}
}
message BotSuggestedPromptMetadata { message BotSuggestedPromptMetadata {
repeated string suggestedPrompts = 1; repeated string suggestedPrompts = 1;
optional uint32 selectedPromptIndex = 2; optional uint32 selectedPromptIndex = 2;
@@ -681,6 +800,12 @@ message ClientPayload {
optional int32 memClass = 37; optional int32 memClass = 37;
optional InteropData interopData = 38; optional InteropData interopData = 38;
optional TrafficAnonymization trafficAnonymization = 40; optional TrafficAnonymization trafficAnonymization = 40;
optional bool lidDbMigrated = 41;
optional AccountType accountType = 42;
enum AccountType {
DEFAULT = 0;
GUEST = 1;
}
enum ConnectReason { enum ConnectReason {
PUSH = 0; PUSH = 0;
USER_ACTIVATED = 1; USER_ACTIVATED = 1;
@@ -747,6 +872,7 @@ message ClientPayload {
MESSENGER = 1; MESSENGER = 1;
INTEROP = 2; INTEROP = 2;
INTEROP_MSGR = 3; INTEROP_MSGR = 3;
WHATSAPP_LID = 4;
} }
enum TrafficAnonymization { enum TrafficAnonymization {
OFF = 0; OFF = 0;
@@ -926,6 +1052,9 @@ message ContextInfo {
optional UrlTrackingMap urlTrackingMap = 58; optional UrlTrackingMap urlTrackingMap = 58;
optional PairedMediaType pairedMediaType = 59; optional PairedMediaType pairedMediaType = 59;
optional uint32 rankingVersion = 60; optional uint32 rankingVersion = 60;
optional MemberLabel memberLabel = 62;
optional bool isQuestion = 63;
optional StatusSourceType statusSourceType = 64;
message AdReplyInfo { message AdReplyInfo {
optional string advertiserName = 1; optional string advertiserName = 1;
optional MediaType mediaType = 2; optional MediaType mediaType = 2;
@@ -979,6 +1108,13 @@ message ContextInfo {
optional string ctaPayload = 20; optional string ctaPayload = 20;
optional bool disableNudge = 21; optional bool disableNudge = 21;
optional string originalImageUrl = 22; optional string originalImageUrl = 22;
optional string automatedGreetingMessageCtaType = 23;
optional bool wtwaAdFormat = 24;
optional AdType adType = 25;
enum AdType {
CTWA = 0;
CAWC = 1;
}
enum MediaType { enum MediaType {
NONE = 0; NONE = 0;
IMAGE = 1; IMAGE = 1;
@@ -1018,12 +1154,22 @@ message ContextInfo {
HD_VIDEO_CHILD = 2; HD_VIDEO_CHILD = 2;
SD_IMAGE_PARENT = 3; SD_IMAGE_PARENT = 3;
HD_IMAGE_CHILD = 4; HD_IMAGE_CHILD = 4;
MOTION_PHOTO_PARENT = 5;
MOTION_PHOTO_CHILD = 6;
} }
enum StatusAttributionType { enum StatusAttributionType {
NONE = 0; NONE = 0;
RESHARED_FROM_MENTION = 1; RESHARED_FROM_MENTION = 1;
RESHARED_FROM_POST = 2; RESHARED_FROM_POST = 2;
} }
enum StatusSourceType {
IMAGE = 0;
VIDEO = 1;
GIF = 2;
AUDIO = 3;
TEXT = 4;
MUSIC_STANDALONE = 5;
}
message UTMInfo { message UTMInfo {
optional string utmSource = 1; optional string utmSource = 1;
optional string utmCampaign = 2; optional string utmCampaign = 2;
@@ -1082,6 +1228,9 @@ message Conversation {
optional bool capiCreatedGroup = 48; optional bool capiCreatedGroup = 48;
optional string accountLid = 49; optional string accountLid = 49;
optional bool limitSharing = 50; optional bool limitSharing = 50;
optional int64 limitSharingSettingTimestamp = 51;
optional LimitSharing.TriggerType limitSharingTrigger = 52;
optional bool limitSharingInitiatedByMe = 53;
enum EndOfHistoryTransferType { enum EndOfHistoryTransferType {
COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY = 0; COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY = 0;
COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY = 1; COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY = 1;
@@ -1289,6 +1438,7 @@ message GlobalSettings {
optional NotificationSettings individualNotificationSettings = 17; optional NotificationSettings individualNotificationSettings = 17;
optional NotificationSettings groupNotificationSettings = 18; optional NotificationSettings groupNotificationSettings = 18;
optional ChatLockSettings chatLockSettings = 19; optional ChatLockSettings chatLockSettings = 19;
optional int64 chatDbLidMigrationTimestamp = 20;
} }
message GroupMention { message GroupMention {
@@ -1346,6 +1496,7 @@ message HistorySync {
repeated PhoneNumberToLIDMapping phoneNumberToLidMappings = 15; repeated PhoneNumberToLIDMapping phoneNumberToLidMappings = 15;
optional string companionMetaNonce = 16; optional string companionMetaNonce = 16;
optional bytes shareableChatIdentifierEncryptionKey = 17; optional bytes shareableChatIdentifierEncryptionKey = 17;
repeated Account accounts = 18;
enum BotAIWaitListState { enum BotAIWaitListState {
IN_WAITLIST = 0; IN_WAITLIST = 0;
AI_AVAILABLE = 1; AI_AVAILABLE = 1;
@@ -1406,12 +1557,18 @@ message InteractiveAnnotation {
repeated Point polygonVertices = 1; repeated Point polygonVertices = 1;
optional bool shouldSkipConfirmation = 4; optional bool shouldSkipConfirmation = 4;
optional EmbeddedContent embeddedContent = 5; optional EmbeddedContent embeddedContent = 5;
optional StatusLinkType statusLinkType = 8;
oneof action { oneof action {
Location location = 2; Location location = 2;
ContextInfo.ForwardedNewsletterMessageInfo newsletter = 3; ContextInfo.ForwardedNewsletterMessageInfo newsletter = 3;
bool embeddedAction = 6; bool embeddedAction = 6;
TapLinkAction tapAction = 7; TapLinkAction tapAction = 7;
} }
enum StatusLinkType {
RASTERIZED_LINK_PREVIEW = 1;
RASTERIZED_LINK_TRUNCATED = 2;
RASTERIZED_LINK_FULL_URL = 3;
}
} }
message KeepInChat { message KeepInChat {
@@ -1452,6 +1609,7 @@ message LIDMigrationMappingSyncMessage {
message LIDMigrationMappingSyncPayload { message LIDMigrationMappingSyncPayload {
repeated LIDMigrationMapping pnToLidMappings = 1; repeated LIDMigrationMapping pnToLidMappings = 1;
optional uint64 chatDbMigrationTimestamp = 2;
} }
message LegacyMessage { message LegacyMessage {
@@ -1461,10 +1619,14 @@ message LegacyMessage {
message LimitSharing { message LimitSharing {
optional bool sharingLimited = 1; optional bool sharingLimited = 1;
optional Trigger trigger = 2; optional TriggerType trigger = 2;
enum Trigger { optional int64 limitSharingSettingTimestamp = 3;
CHAT_SETTING = 0; optional bool initiatedByMe = 4;
BIZ_SUPPORTS_FB_HOSTING = 1; enum TriggerType {
UNKNOWN = 0;
CHAT_SETTING = 1;
BIZ_SUPPORTS_FB_HOSTING = 2;
UNKNOWN_GROUP = 3;
} }
} }
@@ -1508,6 +1670,11 @@ enum MediaVisibility {
OFF = 1; OFF = 1;
ON = 2; ON = 2;
} }
message MemberLabel {
optional string label = 1;
optional int64 labelTimestamp = 2;
}
message Message { message Message {
optional string conversation = 1; optional string conversation = 1;
optional SenderKeyDistributionMessage senderKeyDistributionMessage = 2; optional SenderKeyDistributionMessage senderKeyDistributionMessage = 2;
@@ -1591,6 +1758,10 @@ message Message {
optional FutureProofMessage groupStatusMessage = 96; optional FutureProofMessage groupStatusMessage = 96;
optional AIRichResponseMessage richResponseMessage = 97; optional AIRichResponseMessage richResponseMessage = 97;
optional StatusNotificationMessage statusNotificationMessage = 98; optional StatusNotificationMessage statusNotificationMessage = 98;
optional FutureProofMessage limitSharingMessage = 99;
optional FutureProofMessage botTaskMessage = 100;
optional FutureProofMessage questionMessage = 101;
optional MessageHistoryNotice messageHistoryNotice = 102;
message AlbumMessage { message AlbumMessage {
optional uint32 expectedImageCount = 2; optional uint32 expectedImageCount = 2;
optional uint32 expectedVideoCount = 3; optional uint32 expectedVideoCount = 3;
@@ -1768,6 +1939,7 @@ message Message {
optional uint32 conversionDelaySeconds = 4; optional uint32 conversionDelaySeconds = 4;
optional string ctwaSignals = 5; optional string ctwaSignals = 5;
optional bytes ctwaPayload = 6; optional bytes ctwaPayload = 6;
optional ContextInfo contextInfo = 7;
} }
message CallLogMessage { message CallLogMessage {
@@ -1812,11 +1984,17 @@ message Message {
optional int64 senderNotificationTimestampMs = 2; optional int64 senderNotificationTimestampMs = 2;
optional string consumerLid = 3; optional string consumerLid = 3;
optional string consumerPhoneNumber = 4; optional string consumerPhoneNumber = 4;
optional CloudAPIThreadControlNotificationContent notificationContent = 5;
enum CloudAPIThreadControl { enum CloudAPIThreadControl {
UNKNOWN = 0; UNKNOWN = 0;
CONTROL_PASSED = 1; CONTROL_PASSED = 1;
CONTROL_TAKEN = 2; CONTROL_TAKEN = 2;
} }
message CloudAPIThreadControlNotificationContent {
optional string handoffNotificationText = 1;
optional string extraJson = 2;
}
} }
message CommentMessage { message CommentMessage {
@@ -1898,6 +2076,7 @@ message Message {
optional int64 startTime = 7; optional int64 startTime = 7;
optional int64 endTime = 8; optional int64 endTime = 8;
optional bool extraGuestsAllowed = 9; optional bool extraGuestsAllowed = 9;
optional bool isScheduleCall = 10;
} }
message EventResponseMessage { message EventResponseMessage {
@@ -1939,6 +2118,8 @@ message Message {
optional uint32 videoHeight = 31; optional uint32 videoHeight = 31;
optional uint32 videoWidth = 32; optional uint32 videoWidth = 32;
optional Message.MMSThumbnailMetadata faviconMMSMetadata = 33; optional Message.MMSThumbnailMetadata faviconMMSMetadata = 33;
optional Message.LinkPreviewMetadata linkPreviewMetadata = 34;
optional Message.PaymentLinkMetadata paymentLinkMetadata = 35;
enum FontType { enum FontType {
SYSTEM = 0; SYSTEM = 0;
SYSTEM_TEXT = 1; SYSTEM_TEXT = 1;
@@ -2232,6 +2413,12 @@ message Message {
optional int64 timestampMs = 3; optional int64 timestampMs = 3;
} }
message LinkPreviewMetadata {
optional Message.PaymentLinkMetadata paymentLinkMetadata = 1;
optional Message.URLMetadata urlMetadata = 2;
optional uint32 fbExperimentId = 3;
}
message ListMessage { message ListMessage {
optional string title = 1; optional string title = 1;
optional string description = 2; optional string description = 2;
@@ -2334,14 +2521,25 @@ message Message {
} }
message MessageHistoryBundle { message MessageHistoryBundle {
optional string mimetype = 2; optional string mimetype = 1;
optional bytes fileSha256 = 3; optional bytes fileSha256 = 2;
optional bytes mediaKey = 5; optional bytes mediaKey = 3;
optional bytes fileEncSha256 = 6; optional bytes fileEncSha256 = 4;
optional string directPath = 7; optional string directPath = 5;
optional int64 mediaKeyTimestamp = 8; optional int64 mediaKeyTimestamp = 6;
optional ContextInfo contextInfo = 9; optional ContextInfo contextInfo = 7;
repeated string participants = 10; optional Message.MessageHistoryMetadata messageHistoryMetadata = 8;
}
message MessageHistoryMetadata {
repeated string historyReceivers = 1;
optional int64 firstMessageTimestamp = 2;
optional int64 messageCount = 3;
}
message MessageHistoryNotice {
optional ContextInfo contextInfo = 1;
optional Message.MessageHistoryMetadata messageHistoryMetadata = 2;
} }
message NewsletterAdminInviteMessage { message NewsletterAdminInviteMessage {
@@ -2368,6 +2566,7 @@ message Message {
optional ContextInfo contextInfo = 17; optional ContextInfo contextInfo = 17;
optional int32 messageVersion = 12; optional int32 messageVersion = 12;
optional MessageKey orderRequestMessageId = 13; optional MessageKey orderRequestMessageId = 13;
optional string catalogType = 15;
enum OrderStatus { enum OrderStatus {
INQUIRY = 1; INQUIRY = 1;
ACCEPTED = 2; ACCEPTED = 2;
@@ -2389,6 +2588,23 @@ message Message {
} }
} }
message PaymentLinkMetadata {
optional PaymentLinkButton button = 1;
optional PaymentLinkHeader header = 2;
message PaymentLinkButton {
optional string displayText = 1;
}
message PaymentLinkHeader {
optional PaymentLinkHeaderType headerType = 1;
enum PaymentLinkHeaderType {
LINK_PREVIEW = 0;
ORDER = 1;
}
}
}
message PeerDataOperationRequestMessage { message PeerDataOperationRequestMessage {
optional Message.PeerDataOperationRequestType peerDataOperationRequestType = 1; optional Message.PeerDataOperationRequestType peerDataOperationRequestType = 1;
repeated RequestStickerReupload requestStickerReupload = 2; repeated RequestStickerReupload requestStickerReupload = 2;
@@ -2396,6 +2612,7 @@ message Message {
optional HistorySyncOnDemandRequest historySyncOnDemandRequest = 4; optional HistorySyncOnDemandRequest historySyncOnDemandRequest = 4;
repeated PlaceholderMessageResendRequest placeholderMessageResendRequest = 5; repeated PlaceholderMessageResendRequest placeholderMessageResendRequest = 5;
optional FullHistorySyncOnDemandRequest fullHistorySyncOnDemandRequest = 6; optional FullHistorySyncOnDemandRequest fullHistorySyncOnDemandRequest = 6;
optional SyncDCollectionFatalRecoveryRequest syncdCollectionFatalRecoveryRequest = 7;
message FullHistorySyncOnDemandRequest { message FullHistorySyncOnDemandRequest {
optional Message.FullHistorySyncOnDemandRequestMetadata requestMetadata = 1; optional Message.FullHistorySyncOnDemandRequestMetadata requestMetadata = 1;
optional DeviceProps.HistorySyncConfig historySyncConfig = 2; optional DeviceProps.HistorySyncConfig historySyncConfig = 2;
@@ -2423,6 +2640,11 @@ message Message {
optional bool includeHqThumbnail = 2; optional bool includeHqThumbnail = 2;
} }
message SyncDCollectionFatalRecoveryRequest {
optional string collectionName = 1;
optional int64 timestamp = 2;
}
} }
message PeerDataOperationRequestResponseMessage { message PeerDataOperationRequestResponseMessage {
@@ -2437,6 +2659,7 @@ message Message {
optional WaffleNonceFetchResponse waffleNonceFetchRequestResponse = 5; optional WaffleNonceFetchResponse waffleNonceFetchRequestResponse = 5;
optional FullHistorySyncOnDemandRequestResponse fullHistorySyncOnDemandRequestResponse = 6; optional FullHistorySyncOnDemandRequestResponse fullHistorySyncOnDemandRequestResponse = 6;
optional CompanionMetaNonceFetchResponse companionMetaNonceFetchRequestResponse = 7; optional CompanionMetaNonceFetchResponse companionMetaNonceFetchRequestResponse = 7;
optional SyncDSnapshotFatalRecoveryResponse syncdSnapshotFatalRecoveryResponse = 8;
message CompanionMetaNonceFetchResponse { message CompanionMetaNonceFetchResponse {
optional string nonce = 1; optional string nonce = 1;
} }
@@ -2479,6 +2702,11 @@ message Message {
optional bytes webMessageInfoBytes = 1; optional bytes webMessageInfoBytes = 1;
} }
message SyncDSnapshotFatalRecoveryResponse {
optional bytes collectionSnapshot = 1;
optional bool isCompressed = 2;
}
message WaffleNonceFetchResponse { message WaffleNonceFetchResponse {
optional string nonce = 1; optional string nonce = 1;
optional string waEntFbid = 2; optional string waEntFbid = 2;
@@ -2497,6 +2725,7 @@ message Message {
WAFFLE_LINKING_NONCE_FETCH = 5; WAFFLE_LINKING_NONCE_FETCH = 5;
FULL_HISTORY_SYNC_ON_DEMAND = 6; FULL_HISTORY_SYNC_ON_DEMAND = 6;
COMPANION_META_NONCE_FETCH = 7; COMPANION_META_NONCE_FETCH = 7;
COMPANION_SYNCD_SNAPSHOT_FATAL_RECOVERY = 8;
} }
message PinInChatMessage { message PinInChatMessage {
optional MessageKey key = 1; optional MessageKey key = 1;
@@ -2623,6 +2852,9 @@ message Message {
optional Message.CloudAPIThreadControlNotification cloudApiThreadControlNotification = 22; optional Message.CloudAPIThreadControlNotification cloudApiThreadControlNotification = 22;
optional LIDMigrationMappingSyncMessage lidMigrationMappingSyncMessage = 23; optional LIDMigrationMappingSyncMessage lidMigrationMappingSyncMessage = 23;
optional LimitSharing limitSharing = 24; optional LimitSharing limitSharing = 24;
optional bytes aiPsiMetadata = 25;
optional AIQueryFanout aiQueryFanout = 26;
optional MemberLabel memberLabel = 27;
enum Type { enum Type {
REVOKE = 0; REVOKE = 0;
EPHEMERAL_SETTING = 3; EPHEMERAL_SETTING = 3;
@@ -2647,6 +2879,9 @@ message Message {
STATUS_MENTION_MESSAGE = 25; STATUS_MENTION_MESSAGE = 25;
STOP_GENERATION_MESSAGE = 26; STOP_GENERATION_MESSAGE = 26;
LIMIT_SHARING = 27; LIMIT_SHARING = 27;
AI_PSI_METADATA = 28;
AI_QUERY_FANOUT = 29;
GROUP_MEMBER_LABEL_CHANGE = 30;
} }
} }
@@ -2707,6 +2942,7 @@ message Message {
enum SecretEncType { enum SecretEncType {
UNKNOWN = 0; UNKNOWN = 0;
EVENT_EDIT = 1; EVENT_EDIT = 1;
MESSAGE_EDIT = 2;
} }
} }
@@ -2847,6 +3083,10 @@ message Message {
} }
message URLMetadata {
optional uint32 fbExperimentId = 1;
}
message VideoMessage { message VideoMessage {
optional string url = 1; optional string url = 1;
optional string mimetype = 2; optional string mimetype = 2;
@@ -2918,12 +3158,15 @@ message MessageAssociation {
EVENT_COVER_IMAGE = 3; EVENT_COVER_IMAGE = 3;
STATUS_POLL = 4; STATUS_POLL = 4;
HD_VIDEO_DUAL_UPLOAD = 5; HD_VIDEO_DUAL_UPLOAD = 5;
STATUS_TAPPABLE_MESSAGE = 6; STATUS_EXTERNAL_RESHARE = 6;
MEDIA_POLL = 7; MEDIA_POLL = 7;
STATUS_ADD_YOURS = 8; STATUS_ADD_YOURS = 8;
STATUS_NOTIFICATION = 9; STATUS_NOTIFICATION = 9;
HD_IMAGE_DUAL_UPLOAD = 10; HD_IMAGE_DUAL_UPLOAD = 10;
STICKER_ANNOTATION = 11; STICKER_ANNOTATION = 11;
MOTION_PHOTO = 12;
STATUS_LINK_ACTION = 13;
VIEW_ALL_REPLIES = 14;
} }
} }
@@ -2940,6 +3183,8 @@ message MessageContextInfo {
optional MessageAssociation messageAssociation = 10; optional MessageAssociation messageAssociation = 10;
optional bool capiCreatedGroup = 11; optional bool capiCreatedGroup = 11;
optional string supportPayload = 12; optional string supportPayload = 12;
optional LimitSharing limitSharing = 13;
optional LimitSharing limitSharingV2 = 14;
enum MessageAddonExpiryType { enum MessageAddonExpiryType {
STATIC = 1; STATIC = 1;
DEPENDENT_ON_PARENT = 2; DEPENDENT_ON_PARENT = 2;
@@ -3004,6 +3249,7 @@ message MsgOpaqueData {
optional int64 eventStartTime = 37; optional int64 eventStartTime = 37;
optional EventLocation eventLocation = 38; optional EventLocation eventLocation = 38;
optional int64 eventEndTime = 40; optional int64 eventEndTime = 40;
optional bytes plainProtobufBytes = 43;
message EventLocation { message EventLocation {
optional double degreesLatitude = 1; optional double degreesLatitude = 1;
optional double degreesLongitude = 2; optional double degreesLongitude = 2;
@@ -3535,6 +3781,9 @@ message SyncActionValue {
optional WaffleAccountLinkStateAction waffleAccountLinkStateAction = 58; optional WaffleAccountLinkStateAction waffleAccountLinkStateAction = 58;
optional UsernameChatStartModeAction usernameChatStartMode = 59; optional UsernameChatStartModeAction usernameChatStartMode = 59;
optional NotificationActivitySettingAction notificationActivitySettingAction = 60; optional NotificationActivitySettingAction notificationActivitySettingAction = 60;
optional LidContactAction lidContactAction = 61;
optional CtwaPerCustomerDataSharingAction ctwaPerCustomerDataSharingAction = 62;
optional PaymentTosAction paymentTosAction = 63;
message AgentAction { message AgentAction {
optional string name = 1; optional string name = 1;
optional int32 deviceID = 2; optional int32 deviceID = 2;
@@ -3575,6 +3824,12 @@ message SyncActionValue {
optional string firstName = 2; optional string firstName = 2;
optional string lidJid = 3; optional string lidJid = 3;
optional bool saveOnPrimaryAddressbook = 4; optional bool saveOnPrimaryAddressbook = 4;
optional string pnJid = 5;
optional string username = 6;
}
message CtwaPerCustomerDataSharingAction {
optional bool isCtwaPerCustomerDataSharingEnabled = 1;
} }
message CustomPaymentMethod { message CustomPaymentMethod {
@@ -3635,6 +3890,7 @@ message SyncActionValue {
optional int32 orderIndex = 5; optional int32 orderIndex = 5;
optional bool isActive = 6; optional bool isActive = 6;
optional ListType type = 7; optional ListType type = 7;
optional bool isImmutable = 8;
enum ListType { enum ListType {
NONE = 0; NONE = 0;
UNREAD = 1; UNREAD = 1;
@@ -3642,6 +3898,8 @@ message SyncActionValue {
FAVORITES = 3; FAVORITES = 3;
PREDEFINED = 4; PREDEFINED = 4;
CUSTOM = 5; CUSTOM = 5;
COMMUNITY = 6;
SERVER_ASSIGNED = 7;
} }
} }
@@ -3649,6 +3907,13 @@ message SyncActionValue {
repeated int32 sortedLabelIds = 1; repeated int32 sortedLabelIds = 1;
} }
message LidContactAction {
optional string fullName = 1;
optional string firstName = 2;
optional string username = 3;
optional bool saveOnPrimaryAddressbook = 4;
}
message LocaleSetting { message LocaleSetting {
optional string locale = 1; optional string locale = 1;
} }
@@ -3726,6 +3991,14 @@ message SyncActionValue {
optional string cpi = 1; optional string cpi = 1;
} }
message PaymentTosAction {
required PaymentNotice paymentNotice = 1;
required bool accepted = 2;
enum PaymentNotice {
BR_PAY_PRIVACY_POLICY = 0;
}
}
message PinAction { message PinAction {
optional bool pinned = 1; optional bool pinned = 1;
} }
@@ -4346,6 +4619,9 @@ message WebMessageInfo {
CHANGE_LID = 213; CHANGE_LID = 213;
BIZ_CUSTOMER_3PD_DATA_SHARING_OPT_IN_MESSAGE = 214; BIZ_CUSTOMER_3PD_DATA_SHARING_OPT_IN_MESSAGE = 214;
BIZ_CUSTOMER_3PD_DATA_SHARING_OPT_OUT_MESSAGE = 215; BIZ_CUSTOMER_3PD_DATA_SHARING_OPT_OUT_MESSAGE = 215;
CHANGE_LIMIT_SHARING = 216;
GROUP_MEMBER_LINK_MODE = 217;
BIZ_AUTOMATICALLY_LABELED_CHAT_SYSTEM_MESSAGE = 218;
} }
} }

3334
WAProto/index.d.ts vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "baileys", "name": "baileys",
"version": "6.7.16", "version": "6.7.18",
"description": "A WebSockets library for interacting with WhatsApp Web", "description": "A WebSockets library for interacting with WhatsApp Web",
"keywords": [ "keywords": [
"whatsapp", "whatsapp",
@@ -66,6 +66,7 @@
"json": "^11.0.0", "json": "^11.0.0",
"link-preview-js": "^3.0.0", "link-preview-js": "^3.0.0",
"open": "^8.4.2", "open": "^8.4.2",
"protobufjs-cli": "^1.1.3",
"release-it": "^15.10.3", "release-it": "^15.10.3",
"sharp": "^0.32.6", "sharp": "^0.32.6",
"ts-jest": "^29.3.2", "ts-jest": "^29.3.2",

10
proto-extract/README.md Normal file
View File

@@ -0,0 +1,10 @@
# Proto Extract
Derived initially from `whatseow`'s proto extract, this version generates a predictable diff friendly protobuf. It also does not rely on a hardcoded set of modules to look for but finds all proto modules on its own and extracts the proto from there.
Thanks to [wppconnect-team](https://github.com/wppconnect-team) for the script update to make it work with the latest version of whatsapp.
## Usage
1. Install dependencies with `yarn` (or `npm install`)
2. `yarn start`
3. The script will update `../WAProto/WAProto.proto` (except if something is broken)

507
proto-extract/index.js Normal file
View File

@@ -0,0 +1,507 @@
const request = require('request-promise-native');
const acorn = require('acorn');
const walk = require('acorn-walk');
const fs = require('fs/promises');
let whatsAppVersion = 'latest';
const addPrefix = (lines, prefix) => lines.map((line) => prefix + line);
const extractAllExpressions = (node) => {
const expressions = [node];
const exp = node.expression;
if (exp) {
expressions.push(exp);
}
if(node?.expression?.arguments?.length) {
for (const arg of node?.expression?.arguments) {
if(arg?.body?.body?.length){
for(const exp of arg?.body.body) {
expressions.push(...extractAllExpressions(exp));
}
}
}
}
if(node?.body?.body?.length) {
for (const exp of node?.body?.body) {
if(exp.expression){
expressions.push(...extractAllExpressions(exp.expression));
}
}
}
if (node.expression?.expressions?.length) {
for (const exp of node.expression?.expressions) {
expressions.push(...extractAllExpressions(exp));
}
}
return expressions;
};
async function findAppModules() {
const ua = {
headers: {
'User-Agent':
'Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0',
'Sec-Fetch-Dest': 'script',
'Sec-Fetch-Mode': 'no-cors',
'Sec-Fetch-Site': 'same-origin',
Referer: 'https://web.whatsapp.com/',
Accept: '*/*',
'Accept-Language': 'Accept-Language: en-US,en;q=0.5',
},
};
const baseURL = 'https://web.whatsapp.com';
const serviceworker = await request.get(`${baseURL}/sw.js`, ua);
const versions = [
...serviceworker.matchAll(/client_revision\\":([\d\.]+),/g),
].map((r) => r[1]);
const version = versions[0];
console.log(`Current version: 2.3000.${version}`);
const waVersion = `2.3000.${version}`;
whatsAppVersion = waVersion;
let bootstrapQRURL = '';
const clearString = serviceworker.replaceAll('/*BTDS*/', '');
const URLScript = clearString.match(/(?<=importScripts\(["'])(.*?)(?=["']\);)/g);
bootstrapQRURL = new URL(URLScript[0].replaceAll("\\",'')).href;
console.info('Found source JS URL:', bootstrapQRURL);
const qrData = await request.get(bootstrapQRURL, ua);
// This one list of types is so long that it's split into two JavaScript declarations.
// The module finder below can't handle it, so just patch it manually here.
const patchedQrData = qrData.replaceAll(
'LimitSharing$Trigger',
'LimitSharing$TriggerType'
);
const qrModules = acorn.parse(patchedQrData).body;
const result = qrModules.filter((m) => {
const expressions = extractAllExpressions(m);
return expressions?.find(
(e) => {
return e?.left?.property?.name === 'internalSpec'
}
);
});
return result;
}
(async () => {
const unspecName = (name) =>
name.endsWith('Spec') ? name.slice(0, -4) : name;
const unnestName = (name) => name.split('$').slice(-1)[0];
const getNesting = (name) => name.split('$').slice(0, -1).join('$');
const makeRenameFunc = () => (name) => {
name = unspecName(name);
return name; // .replaceAll('$', '__')
// return renames[name] ?? unnestName(name)
};
// The constructor IDs that can be used for enum types
const modules = await findAppModules();
// find aliases of cross references between the wanted modules
const modulesInfo = {};
const moduleIndentationMap = {};
modules.forEach((module) => {
const moduleName = module.expression.arguments[0].value;
modulesInfo[moduleName] = { crossRefs: [] };
walk.simple(module, {
AssignmentExpression(node) {
if (
node &&
node?.right?.type == 'CallExpression' &&
node?.right?.arguments?.length == 1 &&
node?.right?.arguments[0].type !== 'ObjectExpression'
) {
/*if(node.right.arguments[0].value == '$InternalEnum') {
console.log(node);
console.log(node.right.arguments[0]);
exit;
}*/
modulesInfo[moduleName].crossRefs.push({
alias: node.left.name,
module: node.right.arguments[0].value,
});
}
},
});
});
// find all identifiers and, for enums, their array of values
for (const mod of modules) {
const modInfo = modulesInfo[mod.expression.arguments[0].value];
const rename = makeRenameFunc(mod.expression.arguments[0].value);
const assignments = []
walk.simple(mod, {
AssignmentExpression(node) {
const left = node.left;
if(
left.property?.name &&
left.property?.name !== 'internalSpec' &&
left.property?.name !== 'internalDefaults' &&
left.property?.name !== 'name'
) {
assignments.push(left);
}
},
});
const makeBlankIdent = (a) => {
const key = rename(a?.property?.name);
const indentation = getNesting(key);
const value = { name: key };
moduleIndentationMap[key] = moduleIndentationMap[key] || {};
moduleIndentationMap[key].indentation = indentation;
if (indentation.length) {
moduleIndentationMap[indentation] =
moduleIndentationMap[indentation] || {};
moduleIndentationMap[indentation].members =
moduleIndentationMap[indentation].members || new Set();
moduleIndentationMap[indentation].members.add(key);
}
return [key, value];
};
modInfo.identifiers = Object.fromEntries(
assignments.map(makeBlankIdent).reverse()
);
const enumAliases = {};
// enums are defined directly, and both enums and messages get a one-letter alias
walk.ancestor(mod, {
Property(node, anc) {
const fatherNode = anc[anc.length - 3];
const fatherFather = anc[anc.length - 4];
if(
fatherNode?.type === 'AssignmentExpression' &&
fatherNode?.left?.property?.name == 'internalSpec'
&& fatherNode?.right?.properties.length
) {
const values = fatherNode?.right?.properties.map((p) => ({
name: p.key.name,
id: p.value.value,
}));
const nameAlias = fatherNode?.left?.name;
enumAliases[nameAlias] = values;
}
else if (node?.key && node?.key?.name && fatherNode.arguments?.length > 0) {
const values = fatherNode.arguments?.[0]?.properties.map((p) => ({
name: p.key.name,
id: p.value.value,
}));
const nameAlias = fatherFather?.left?.name || fatherFather.id.name;
enumAliases[nameAlias] = values;
}
},
});
walk.simple(mod, {
AssignmentExpression(node) {
if (
node.left.type === 'MemberExpression' &&
modInfo.identifiers?.[rename(node.left.property.name)]
) {
const ident = modInfo.identifiers[rename(node.left.property.name)];
ident.alias = node.right.name;
ident.enumValues = enumAliases[ident.alias];
}
},
});
}
// find the contents for all protobuf messages
for (const mod of modules) {
const modInfo = modulesInfo[mod.expression.arguments[0].value];
const rename = makeRenameFunc(mod.expression.arguments[0].value);
const findByAliasInIdentifier = (obj, alias) => {
return Object.values(obj).find(item => item.alias === alias);
};
// message specifications are stored in a "internalSpec" attribute of the respective identifier alias
walk.simple(mod, {
AssignmentExpression(node) {
if (
node.left.type === 'MemberExpression' &&
node.left.property.name === 'internalSpec' &&
node.right.type === 'ObjectExpression'
) {
const targetIdent = Object.values(modInfo.identifiers).find(
(v) => v.alias === node.left.object.name
);
if (!targetIdent) {
console.warn(
`found message specification for unknown identifier alias: ${node.left.object.name}`
);
return;
}
// partition spec properties by normal members and constraints (like "__oneofs__") which will be processed afterwards
const constraints = [];
let members = [];
for (const p of node.right.properties) {
p.key.name = p.key.type === 'Identifier' ? p.key.name : p.key.value;
const arr =
p.key.name.substr(0, 2) === '__' ? constraints : members;
arr.push(p);
}
members = members.map(({ key: { name }, value: { elements } }) => {
let type;
const flags = [];
const unwrapBinaryOr = (n) =>
n.type === 'BinaryExpression' && n.operator === '|'
? [].concat(unwrapBinaryOr(n.left), unwrapBinaryOr(n.right))
: [n];
// find type and flags
unwrapBinaryOr(elements[1]).forEach((m) => {
if (
m.type === 'MemberExpression' &&
m.object.type === 'MemberExpression'
) {
if (m.object.property.name === 'TYPES') {
type = m.property.name.toLowerCase();
if(type == 'map'){
let typeStr = 'map<';
if (elements[2]?.type === 'ArrayExpression') {
const subElements = elements[2].elements;
subElements.forEach((element, index) => {
if(element?.property?.name) {
typeStr += element?.property?.name?.toLowerCase();
} else {
const ref = findByAliasInIdentifier(modInfo.identifiers, element.name);
typeStr += ref.name;
}
if (index < subElements.length - 1) {
typeStr += ', ';
}
});
typeStr += '>';
type = typeStr;
}
}
} else if (m.object.property.name === 'FLAGS') {
flags.push(m.property.name.toLowerCase());
}
}
});
// determine cross reference name from alias if this member has type "message" or "enum"
if (type === 'message' || type === 'enum') {
const currLoc = ` from member '${name}' of message ${targetIdent.name}'`;
if (elements[2].type === 'Identifier') {
type = Object.values(modInfo.identifiers).find(
(v) => v.alias === elements[2].name
)?.name;
if (!type) {
console.warn(
`unable to find reference of alias '${elements[2].name}'` +
currLoc
);
}
} else if (elements[2].type === 'MemberExpression') {
let crossRef = modInfo.crossRefs.find(
(r) => r.alias === elements[2]?.object?.name || elements[2]?.object?.left?.name || elements[2]?.object?.callee?.name
);
if(elements[1]?.property?.name === 'ENUM' && elements[2]?.property?.name?.includes('Type')) {
type = rename(elements[2]?.property?.name);
}
else if(elements[2]?.property?.name.includes('Spec')) {
type = rename(elements[2].property.name);
} else if (
crossRef &&
crossRef.module !== '$InternalEnum' &&
modulesInfo[crossRef.module].identifiers[
rename(elements[2].property.name)
]
) {
type = rename(elements[2].property.name);
} else {
console.warn(
`unable to find reference of alias to other module '${elements[2].object.name}' or to message ${elements[2].property.name} of this module` +
currLoc
);
}
}
}
return { name, id: elements[0].value, type, flags };
});
// resolve constraints for members
constraints.forEach((c) => {
if (
c.key.name === '__oneofs__' &&
c.value.type === 'ObjectExpression'
) {
const newOneOfs = c.value.properties.map((p) => ({
name: p.key.name,
type: '__oneof__',
members: p.value.elements.map((e) => {
const idx = members.findIndex((m) => m.name === e.value);
const member = members[idx];
members.splice(idx, 1);
return member;
}),
}));
members.push(...newOneOfs);
}
});
targetIdent.members = members;
}
},
});
}
const decodedProtoMap = {};
const spaceIndent = ' '.repeat(4);
for (const mod of modules) {
const modInfo = modulesInfo[mod.expression.arguments[0].value];
const identifiers = Object.values(modInfo?.identifiers);
// enum stringifying function
const stringifyEnum = (ident, overrideName = null) =>
[].concat(
[`enum ${overrideName || ident.displayName || ident.name} {`],
addPrefix(
ident.enumValues.map((v) => `${v.name} = ${v.id};`),
spaceIndent
),
['}']
);
// message specification member stringifying function
const stringifyMessageSpecMember = (
info,
completeFlags,
parentName = undefined
) => {
if (info.type === '__oneof__') {
return [].concat(
[`oneof ${info.name} {`],
addPrefix(
[].concat(
...info.members.map((m) => stringifyMessageSpecMember(m, false))
),
spaceIndent
),
['}']
);
} else {
if (info.flags.includes('packed')) {
info.flags.splice(info.flags.indexOf('packed'));
info.packed = ' [packed=true]';
}
if (completeFlags && info.flags.length === 0 && !info.type.includes('map')) {
info.flags.push('optional');
}
const ret = [];
const indentation = moduleIndentationMap[info.type]?.indentation;
let typeName = unnestName(info.type);
if (indentation !== parentName && indentation) {
typeName = `${indentation.replaceAll('$', '.')}.${typeName}`;
}
// if(info.enumValues) {
// // typeName = unnestName(info.type)
// ret = stringifyEnum(info, typeName)
// }
ret.push(
`${
info.flags.join(' ') + (info.flags.length === 0 ? '' : ' ')
}${typeName} ${info.name} = ${info.id}${info.packed || ''};`
);
return ret;
}
};
// message specification stringifying function
const stringifyMessageSpec = (ident) => {
const members = moduleIndentationMap[ident.name]?.members;
const result = [];
result.push(
`message ${ident.displayName || ident.name} {`,
...addPrefix(
[].concat(
...ident.members.map((m) =>
stringifyMessageSpecMember(m, true, ident.name)
)
),
spaceIndent
)
);
if (members?.size) {
const sortedMembers = Array.from(members).sort();
for (const memberName of sortedMembers) {
let entity = modInfo.identifiers[memberName];
if (entity) {
const displayName = entity.name.slice(ident.name.length + 1);
entity = { ...entity, displayName };
result.push(...addPrefix(getEntity(entity), spaceIndent));
} else {
console.log('missing nested entity ', memberName);
}
}
}
result.push('}');
result.push('');
return result;
};
const getEntity = (v) => {
let result;
if (v.members) {
result = stringifyMessageSpec(v);
} else if (v.enumValues?.length) {
result = stringifyEnum(v);
} else {
result = ['// Unknown entity ' + v.name];
}
return result;
};
const stringifyEntity = (v) => {
return {
content: getEntity(v).join('\n'),
name: v.name,
};
};
for (const value of identifiers) {
const { name, content } = stringifyEntity(value);
if (!moduleIndentationMap[name]?.indentation?.length) {
decodedProtoMap[name] = content;
}
}
}
const decodedProto = Object.keys(decodedProtoMap).sort();
const sortedStr = decodedProto.map((d) => decodedProtoMap[d]).join('\n');
const decodedProtoStr = `syntax = "proto3";\npackage proto;\n\n/// WhatsApp Version: ${whatsAppVersion}\n\n${sortedStr}`;
const destinationPath = '../WAProto/WAProto.proto';
await fs.writeFile(destinationPath, decodedProtoStr);
console.log(`Extracted protobuf schema to "${destinationPath}"`);
})();

509
proto-extract/package-lock.json generated Normal file
View File

@@ -0,0 +1,509 @@
{
"name": "whatsapp-web-protobuf-extractor",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "whatsapp-web-protobuf-extractor",
"version": "1.0.0",
"dependencies": {
"acorn": "^6.4.1",
"acorn-walk": "^6.1.1",
"request": "^2.88.0",
"request-promise-core": "^1.1.2",
"request-promise-native": "^1.0.7"
}
},
"node_modules/acorn": {
"version": "6.4.2",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz",
"integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==",
"bin": {
"acorn": "bin/acorn"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/acorn-walk": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz",
"integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/asn1": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
"integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
"dependencies": {
"safer-buffer": "~2.1.0"
}
},
"node_modules/assert-plus": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k= sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==",
"engines": {
"node": "*"
}
},
"node_modules/aws4": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
"integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA=="
},
"node_modules/bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
"integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
"dependencies": {
"tweetnacl": "^0.14.3"
}
},
"node_modules/caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw=="
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ=="
},
"node_modules/dashdash": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==",
"dependencies": {
"assert-plus": "^1.0.0"
},
"engines": {
"node": ">=0.10"
}
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk= sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/ecc-jsbn": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
"integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==",
"dependencies": {
"jsbn": "~0.1.0",
"safer-buffer": "^2.1.0"
}
},
"node_modules/extend": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
},
"node_modules/extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==",
"engines": [
"node >=0.6.0"
]
},
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
},
"node_modules/fast-json-stable-stringify": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
},
"node_modules/forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==",
"engines": {
"node": "*"
}
},
"node_modules/form-data": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 0.12"
}
},
"node_modules/getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==",
"dependencies": {
"assert-plus": "^1.0.0"
}
},
"node_modules/har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==",
"engines": {
"node": ">=4"
}
},
"node_modules/har-validator": {
"version": "5.1.5",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
"integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
"deprecated": "this library is no longer supported",
"dependencies": {
"ajv": "^6.12.3",
"har-schema": "^2.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==",
"dependencies": {
"assert-plus": "^1.0.0",
"jsprim": "^1.2.2",
"sshpk": "^1.7.0"
},
"engines": {
"node": ">=0.8",
"npm": ">=1.3.7"
}
},
"node_modules/is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA=="
},
"node_modules/isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g=="
},
"node_modules/jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM= sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg=="
},
"node_modules/json-schema": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= sha512-a3xHnILGMtk+hDOqNwHzF6e2fNbiMrXZvxKQiEv2MlgQP+pjIOzqAmKYD2mDpXYE/44M7g+n9p2bKkYWDUcXCQ=="
},
"node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
},
"node_modules/json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA=="
},
"node_modules/jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= sha512-4Dj8Rf+fQ+/Pn7C5qeEX02op1WfOss3PKTE9Nsop3Dx+6UPxlm1dr/og7o2cRa5hNN07CACr4NFzRLtj/rjWog==",
"engines": [
"node >=0.6.0"
],
"dependencies": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
"json-schema": "0.2.3",
"verror": "1.10.0"
}
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"node_modules/mime-db": {
"version": "1.50.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.50.0.tgz",
"integrity": "sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.33",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.33.tgz",
"integrity": "sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g==",
"dependencies": {
"mime-db": "1.50.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==",
"engines": {
"node": "*"
}
},
"node_modules/performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="
},
"node_modules/psl": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
"integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
},
"node_modules/punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
"engines": {
"node": ">=6"
}
},
"node_modules/qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
"engines": {
"node": ">=0.6"
}
},
"node_modules/request": {
"version": "2.88.2",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
"integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
"deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142",
"dependencies": {
"aws-sign2": "~0.7.0",
"aws4": "^1.8.0",
"caseless": "~0.12.0",
"combined-stream": "~1.0.6",
"extend": "~3.0.2",
"forever-agent": "~0.6.1",
"form-data": "~2.3.2",
"har-validator": "~5.1.3",
"http-signature": "~1.2.0",
"is-typedarray": "~1.0.0",
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.19",
"oauth-sign": "~0.9.0",
"performance-now": "^2.1.0",
"qs": "~6.5.2",
"safe-buffer": "^5.1.2",
"tough-cookie": "~2.5.0",
"tunnel-agent": "^0.6.0",
"uuid": "^3.3.2"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/request-promise-core": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz",
"integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==",
"dependencies": {
"lodash": "^4.17.19"
},
"engines": {
"node": ">=0.10.0"
},
"peerDependencies": {
"request": "^2.34"
}
},
"node_modules/request-promise-native": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz",
"integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==",
"deprecated": "request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142",
"dependencies": {
"request-promise-core": "1.1.4",
"stealthy-require": "^1.1.1",
"tough-cookie": "^2.3.3"
},
"engines": {
"node": ">=0.12.0"
},
"peerDependencies": {
"request": "^2.34"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
]
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/sshpk": {
"version": "1.16.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
"integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
"dependencies": {
"asn1": "~0.2.3",
"assert-plus": "^1.0.0",
"bcrypt-pbkdf": "^1.0.0",
"dashdash": "^1.12.0",
"ecc-jsbn": "~0.1.1",
"getpass": "^0.1.1",
"jsbn": "~0.1.0",
"safer-buffer": "^2.0.2",
"tweetnacl": "~0.14.0"
},
"bin": {
"sshpk-conv": "bin/sshpk-conv",
"sshpk-sign": "bin/sshpk-sign",
"sshpk-verify": "bin/sshpk-verify"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/stealthy-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
"integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= sha512-ZnWpYnYugiOVEY5GkcuJK1io5V8QmNYChG62gSit9pQVGErXtrKuPC55ITaVSukmMta5qpMU7vqLt2Lnni4f/g==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/tough-cookie": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
"dependencies": {
"psl": "^1.1.28",
"punycode": "^2.1.1"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
"dependencies": {
"safe-buffer": "^5.0.1"
},
"engines": {
"node": "*"
}
},
"node_modules/tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA=="
},
"node_modules/uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
"dependencies": {
"punycode": "^2.1.0"
}
},
"node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/verror": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==",
"engines": [
"node >=0.6.0"
],
"dependencies": {
"assert-plus": "^1.0.0",
"core-util-is": "1.0.2",
"extsprintf": "^1.2.0"
}
}
}
}

View File

@@ -0,0 +1,15 @@
{
"name": "whatsapp-web-protobuf-extractor",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"acorn": "^6.4.1",
"acorn-walk": "^6.1.1",
"request": "^2.88.0",
"request-promise-core": "^1.1.2",
"request-promise-native": "^1.0.7"
}
}

352
proto-extract/yarn.lock Normal file
View File

@@ -0,0 +1,352 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
acorn-walk@^6.1.1:
version "6.2.0"
resolved "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz"
integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==
acorn@^6.4.1:
version "6.4.2"
resolved "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz"
integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==
ajv@^6.12.3:
version "6.12.6"
resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz"
integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==
dependencies:
fast-deep-equal "^3.1.1"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
asn1@~0.2.3:
version "0.2.4"
resolved "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz"
integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==
dependencies:
safer-buffer "~2.1.0"
assert-plus@^1.0.0, assert-plus@1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==
asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz"
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
aws-sign2@~0.7.0:
version "0.7.0"
resolved "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz"
integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==
aws4@^1.8.0:
version "1.11.0"
resolved "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz"
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==
bcrypt-pbkdf@^1.0.0:
version "1.0.2"
resolved "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz"
integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==
dependencies:
tweetnacl "^0.14.3"
caseless@~0.12.0:
version "0.12.0"
resolved "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz"
integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==
combined-stream@^1.0.6, combined-stream@~1.0.6:
version "1.0.8"
resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz"
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
dependencies:
delayed-stream "~1.0.0"
core-util-is@1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==
dashdash@^1.12.0:
version "1.14.1"
resolved "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz"
integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==
dependencies:
assert-plus "^1.0.0"
delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
ecc-jsbn@~0.1.1:
version "0.1.2"
resolved "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz"
integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==
dependencies:
jsbn "~0.1.0"
safer-buffer "^2.1.0"
extend@~3.0.2:
version "3.0.2"
resolved "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz"
integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==
extsprintf@^1.2.0, extsprintf@1.3.0:
version "1.3.0"
resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz"
integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==
fast-deep-equal@^3.1.1:
version "3.1.3"
resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
fast-json-stable-stringify@^2.0.0:
version "2.1.0"
resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz"
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
forever-agent@~0.6.1:
version "0.6.1"
resolved "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz"
integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==
form-data@~2.3.2:
version "2.3.3"
resolved "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz"
integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.6"
mime-types "^2.1.12"
getpass@^0.1.1:
version "0.1.7"
resolved "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz"
integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==
dependencies:
assert-plus "^1.0.0"
har-schema@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz"
integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==
har-validator@~5.1.3:
version "5.1.5"
resolved "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz"
integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==
dependencies:
ajv "^6.12.3"
har-schema "^2.0.0"
http-signature@~1.2.0:
version "1.2.0"
resolved "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz"
integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==
dependencies:
assert-plus "^1.0.0"
jsprim "^1.2.2"
sshpk "^1.7.0"
is-typedarray@~1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz"
integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==
isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz"
integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==
jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz"
integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==
json-schema-traverse@^0.4.1:
version "0.4.1"
resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz"
integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==
json-schema@0.2.3:
version "0.2.3"
resolved "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz"
integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= sha512-a3xHnILGMtk+hDOqNwHzF6e2fNbiMrXZvxKQiEv2MlgQP+pjIOzqAmKYD2mDpXYE/44M7g+n9p2bKkYWDUcXCQ==
json-stringify-safe@~5.0.1:
version "5.0.1"
resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz"
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==
jsprim@^1.2.2:
version "1.4.1"
resolved "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz"
integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= sha512-4Dj8Rf+fQ+/Pn7C5qeEX02op1WfOss3PKTE9Nsop3Dx+6UPxlm1dr/og7o2cRa5hNN07CACr4NFzRLtj/rjWog==
dependencies:
assert-plus "1.0.0"
extsprintf "1.3.0"
json-schema "0.2.3"
verror "1.10.0"
lodash@^4.17.19:
version "4.17.21"
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
mime-db@1.50.0:
version "1.50.0"
resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.50.0.tgz"
integrity sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A==
mime-types@^2.1.12, mime-types@~2.1.19:
version "2.1.33"
resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.33.tgz"
integrity sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g==
dependencies:
mime-db "1.50.0"
oauth-sign@~0.9.0:
version "0.9.0"
resolved "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz"
integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==
performance-now@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==
psl@^1.1.28:
version "1.8.0"
resolved "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz"
integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==
punycode@^2.1.0, punycode@^2.1.1:
version "2.1.1"
resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
qs@~6.5.2:
version "6.5.2"
resolved "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz"
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
request-promise-core@^1.1.2, request-promise-core@1.1.4:
version "1.1.4"
resolved "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz"
integrity sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==
dependencies:
lodash "^4.17.19"
request-promise-native@^1.0.7:
version "1.0.9"
resolved "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz"
integrity sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==
dependencies:
request-promise-core "1.1.4"
stealthy-require "^1.1.1"
tough-cookie "^2.3.3"
request@^2.34, request@^2.88.0:
version "2.88.2"
resolved "https://registry.npmjs.org/request/-/request-2.88.2.tgz"
integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==
dependencies:
aws-sign2 "~0.7.0"
aws4 "^1.8.0"
caseless "~0.12.0"
combined-stream "~1.0.6"
extend "~3.0.2"
forever-agent "~0.6.1"
form-data "~2.3.2"
har-validator "~5.1.3"
http-signature "~1.2.0"
is-typedarray "~1.0.0"
isstream "~0.1.2"
json-stringify-safe "~5.0.1"
mime-types "~2.1.19"
oauth-sign "~0.9.0"
performance-now "^2.1.0"
qs "~6.5.2"
safe-buffer "^5.1.2"
tough-cookie "~2.5.0"
tunnel-agent "^0.6.0"
uuid "^3.3.2"
safe-buffer@^5.0.1, safe-buffer@^5.1.2:
version "5.2.1"
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
version "2.1.2"
resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
sshpk@^1.7.0:
version "1.16.1"
resolved "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz"
integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==
dependencies:
asn1 "~0.2.3"
assert-plus "^1.0.0"
bcrypt-pbkdf "^1.0.0"
dashdash "^1.12.0"
ecc-jsbn "~0.1.1"
getpass "^0.1.1"
jsbn "~0.1.0"
safer-buffer "^2.0.2"
tweetnacl "~0.14.0"
stealthy-require@^1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz"
integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= sha512-ZnWpYnYugiOVEY5GkcuJK1io5V8QmNYChG62gSit9pQVGErXtrKuPC55ITaVSukmMta5qpMU7vqLt2Lnni4f/g==
tough-cookie@^2.3.3, tough-cookie@~2.5.0:
version "2.5.0"
resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz"
integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==
dependencies:
psl "^1.1.28"
punycode "^2.1.1"
tunnel-agent@^0.6.0:
version "0.6.0"
resolved "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz"
integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==
dependencies:
safe-buffer "^5.0.1"
tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
resolved "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz"
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==
uri-js@^4.2.2:
version "4.4.1"
resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz"
integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==
dependencies:
punycode "^2.1.0"
uuid@^3.3.2:
version "3.4.0"
resolved "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
verror@1.10.0:
version "1.10.0"
resolved "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz"
integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==
dependencies:
assert-plus "^1.0.0"
core-util-is "1.0.2"
extsprintf "^1.2.0"

View File

@@ -1,3 +1,3 @@
{ {
"version": [2, 3000, 1020608496] "version": [2, 3000, 1023223821]
} }

View File

@@ -634,7 +634,10 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
isLid ? authState.creds.me?.lid : authState.creds.me?.id isLid ? authState.creds.me?.lid : authState.creds.me?.id
) )
const remoteJid = !isNodeFromMe || isJidGroup(attrs.from) ? attrs.from : attrs.recipient const remoteJid = !isNodeFromMe || isJidGroup(attrs.from) ? attrs.from : attrs.recipient
const fromMe = !attrs.recipient || (attrs.type === 'retry' && isNodeFromMe) const fromMe = !attrs.recipient || (
(attrs.type === 'retry' || attrs.type === 'sender')
&& isNodeFromMe
)
const key: proto.IMessageKey = { const key: proto.IMessageKey = {
remoteJid, remoteJid,

View File

@@ -264,10 +264,7 @@ export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions &
userJid: string userJid: string
} }
export type WAMediaUploadFunction = ( export type WAMediaUploadFunction = (encFilePath: string, opts: { fileEncSha256B64: string, mediaType: MediaType, timeoutMs?: number }) => Promise<{ mediaUrl: string, directPath: string }>
readStream: Readable,
opts: { fileEncSha256B64: string; mediaType: MediaType; timeoutMs?: number }
) => Promise<{ mediaUrl: string; directPath: string }>
export type MediaGenerationOptions = { export type MediaGenerationOptions = {
logger?: ILogger logger?: ILogger

View File

@@ -1,18 +1,12 @@
import { Boom } from '@hapi/boom' import { Boom } from '@hapi/boom'
import { createHash } from 'crypto' import { createHash } from 'crypto'
import { import { createWriteStream, promises as fs } from 'fs'
CatalogCollection, import { tmpdir } from 'os'
CatalogStatus, import { join } from 'path'
OrderDetails, import { CatalogCollection, CatalogStatus, OrderDetails, OrderProduct, Product, ProductCreate, ProductUpdate, WAMediaUpload, WAMediaUploadFunction } from '../Types'
OrderProduct,
Product,
ProductCreate,
ProductUpdate,
WAMediaUpload,
WAMediaUploadFunction
} from '../Types'
import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildren, getBinaryNodeChildString } from '../WABinary' import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildren, getBinaryNodeChildString } from '../WABinary'
import { getStream, getUrlFromDirectPath, toReadable } from './messages-media' import { generateMessageIDV2 } from './generics'
import { getStream, getUrlFromDirectPath } from './messages-media'
export const parseCatalogNode = (node: BinaryNode) => { export const parseCatalogNode = (node: BinaryNode) => {
const catalogNode = getBinaryNodeChild(node, 'product_catalog') const catalogNode = getBinaryNodeChild(node, 'product_catalog')
@@ -238,23 +232,35 @@ export const uploadingNecessaryImages = async (
} }
} }
const { stream } = await getStream(img) const { stream } = await getStream(img)
const hasher = createHash('sha256') const hasher = createHash('sha256')
const contentBlocks: Buffer[] = []
for await (const block of stream) { const filePath = join(tmpdir(), 'img' + generateMessageIDV2())
hasher.update(block) const encFileWriteStream = createWriteStream(filePath)
contentBlocks.push(block)
} for await (const block of stream) {
hasher.update(block)
encFileWriteStream.write(block)
}
const sha = hasher.digest('base64') const sha = hasher.digest('base64')
const { directPath } = await waUploadToServer(toReadable(Buffer.concat(contentBlocks)), { const { directPath } = await waUploadToServer(
mediaType: 'product-catalog-image', filePath,
fileEncSha256B64: sha, {
timeoutMs mediaType: 'product-catalog-image',
}) fileEncSha256B64: sha,
return { url: getUrlFromDirectPath(directPath) } timeoutMs
}) }
)
await fs
.unlink(filePath)
.catch(err => console.log('Error deleting temp file ', err))
return { url: getUrlFromDirectPath(directPath) }
}
)
) )
return results return results
} }

View File

@@ -36,7 +36,7 @@ export const Browsers: BrowsersMap = {
export const getPlatformId = (browser: string) => { export const getPlatformId = (browser: string) => {
const platformType = proto.DeviceProps.PlatformType[browser.toUpperCase()] const platformType = proto.DeviceProps.PlatformType[browser.toUpperCase()]
return platformType ? platformType.toString().charCodeAt(0).toString() : '49' //chrome return platformType ? platformType.toString() : '1' //chrome
} }
export const BufferJSON = { export const BufferJSON = {

View File

@@ -11,20 +11,7 @@ import { Readable, Transform } from 'stream'
import { URL } from 'url' import { URL } from 'url'
import { proto } from '../../WAProto' import { proto } from '../../WAProto'
import { DEFAULT_ORIGIN, MEDIA_HKDF_KEY_MAPPING, MEDIA_PATH_MAP } from '../Defaults' import { DEFAULT_ORIGIN, MEDIA_HKDF_KEY_MAPPING, MEDIA_PATH_MAP } from '../Defaults'
import { import { BaileysEventMap, DownloadableMessage, MediaConnInfo, MediaDecryptionKeyInfo, MediaType, MessageType, SocketConfig, WAGenericMediaMessage, WAMediaUpload, WAMediaUploadFunction, WAMessageContent } from '../Types'
BaileysEventMap,
DownloadableMessage,
MediaConnInfo,
MediaDecryptionKeyInfo,
MediaType,
MessageType,
SocketConfig,
WAGenericMediaMessage,
WAMediaPayloadURL,
WAMediaUpload,
WAMediaUploadFunction,
WAMessageContent
} from '../Types'
import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildBuffer, jidNormalizedUser } from '../WABinary' import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildBuffer, jidNormalizedUser } from '../WABinary'
import { aesDecryptGCM, aesEncryptGCM, hkdf } from './crypto' import { aesDecryptGCM, aesEncryptGCM, hkdf } from './crypto'
import { generateMessageIDV2 } from './generics' import { generateMessageIDV2 } from './generics'
@@ -339,24 +326,35 @@ export const encryptedStream = async (
const mediaKey = Crypto.randomBytes(32) const mediaKey = Crypto.randomBytes(32)
const { cipherKey, iv, macKey } = await getMediaKeys(mediaKey, mediaType) const { cipherKey, iv, macKey } = await getMediaKeys(mediaKey, mediaType)
const encWriteStream = new Readable({ read: () => {} })
let bodyPath: string | undefined const encFilePath = join(
let writeStream: WriteStream | undefined getTmpFilesDirectory(),
let didSaveToTmpPath = false mediaType + generateMessageIDV2() + '-enc'
if (type === 'file') { )
bodyPath = (media as WAMediaPayloadURL).url.toString() const encFileWriteStream = createWriteStream(encFilePath)
} else if (saveOriginalFileIfRequired) {
bodyPath = join(getTmpFilesDirectory(), mediaType + generateMessageIDV2()) let originalFileStream: WriteStream | undefined
writeStream = createWriteStream(bodyPath) let originalFilePath: string | undefined
didSaveToTmpPath = true
if(saveOriginalFileIfRequired) {
originalFilePath = join(
getTmpFilesDirectory(),
mediaType + generateMessageIDV2() + '-original'
)
originalFileStream = createWriteStream(originalFilePath)
} }
let fileLength = 0 let fileLength = 0
const aes = Crypto.createCipheriv('aes-256-cbc', cipherKey, iv) const aes = Crypto.createCipheriv('aes-256-cbc', cipherKey, iv)
let hmac = Crypto.createHmac('sha256', macKey!).update(iv) const hmac = Crypto.createHmac('sha256', macKey!).update(iv)
let sha256Plain = Crypto.createHash('sha256') const sha256Plain = Crypto.createHash('sha256')
let sha256Enc = Crypto.createHash('sha256') const sha256Enc = Crypto.createHash('sha256')
const onChunk = (buff: Buffer) => {
sha256Enc.update(buff)
hmac.update(buff)
encFileWriteStream.write(buff)
}
try { try {
for await (const data of stream) { for await (const data of stream) {
@@ -368,66 +366,63 @@ export const encryptedStream = async (
}) })
} }
sha256Plain = sha256Plain.update(data) if(originalFileStream) {
if (writeStream && !writeStream.write(data)) { if(!originalFileStream.write(data)) {
await once(writeStream, 'drain') await once(originalFileStream, 'drain')
}
} }
sha256Plain.update(data)
onChunk(aes.update(data)) onChunk(aes.update(data))
} }
onChunk(aes.final()) onChunk(aes.final())
const mac = hmac.digest().slice(0, 10) const mac = hmac.digest().slice(0, 10)
sha256Enc = sha256Enc.update(mac) sha256Enc.update(mac)
const fileSha256 = sha256Plain.digest() const fileSha256 = sha256Plain.digest()
const fileEncSha256 = sha256Enc.digest() const fileEncSha256 = sha256Enc.digest()
encWriteStream.push(mac) encFileWriteStream.write(mac)
encWriteStream.push(null)
writeStream?.end() encFileWriteStream.end()
originalFileStream?.end?.()
stream.destroy() stream.destroy()
logger?.debug('encrypted data successfully') logger?.debug('encrypted data successfully')
return { return {
mediaKey, mediaKey,
encWriteStream, originalFilePath,
bodyPath, encFilePath,
mac, mac,
fileEncSha256, fileEncSha256,
fileSha256, fileSha256,
fileLength, fileLength
didSaveToTmpPath
} }
} catch (error) { } catch (error) {
// destroy all streams with error // destroy all streams with error
encWriteStream.destroy() encFileWriteStream.destroy()
writeStream?.destroy() originalFileStream?.destroy?.()
aes.destroy() aes.destroy()
hmac.destroy() hmac.destroy()
sha256Plain.destroy() sha256Plain.destroy()
sha256Enc.destroy() sha256Enc.destroy()
stream.destroy() stream.destroy()
if (didSaveToTmpPath) {
try { try {
await fs.unlink(bodyPath!) await fs.unlink(encFilePath)
} catch (err) { if(originalFilePath) {
logger?.error({ err }, 'failed to save to tmp path') await fs.unlink(originalFilePath)
} }
} catch(err) {
logger?.error({ err }, 'failed deleting tmp files')
} }
throw error throw error
} }
function onChunk(buff: Buffer) {
sha256Enc = sha256Enc.update(buff)
hmac = hmac.update(buff)
encWriteStream.push(buff)
}
} }
const DEF_HOST = 'mmg.whatsapp.net' const DEF_HOST = 'mmg.whatsapp.net'
@@ -577,7 +572,7 @@ export const getWAUploadToServer = (
{ customUploadHosts, fetchAgent, logger, options }: SocketConfig, { customUploadHosts, fetchAgent, logger, options }: SocketConfig,
refreshMediaConn: (force: boolean) => Promise<MediaConnInfo> refreshMediaConn: (force: boolean) => Promise<MediaConnInfo>
): WAMediaUploadFunction => { ): WAMediaUploadFunction => {
return async (stream, { mediaType, fileEncSha256B64, timeoutMs }) => { return async(filePath, { mediaType, fileEncSha256B64, timeoutMs }) => {
// send a query JSON to obtain the url & auth token to upload our media // send a query JSON to obtain the url & auth token to upload our media
let uploadInfo = await refreshMediaConn(false) let uploadInfo = await refreshMediaConn(false)
@@ -594,19 +589,25 @@ export const getWAUploadToServer = (
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
let result: any let result: any
try { try {
const body = await axios.post(url, stream, {
...options, const body = await axios.post(
headers: { url,
...(options.headers || {}), createReadStream(filePath),
'Content-Type': 'application/octet-stream', {
Origin: DEFAULT_ORIGIN ...options,
}, maxRedirects: 0,
httpsAgent: fetchAgent, headers: {
timeout: timeoutMs, ...options.headers || { },
responseType: 'json', 'Content-Type': 'application/octet-stream',
maxBodyLength: Infinity, 'Origin': DEFAULT_ORIGIN
maxContentLength: Infinity },
}) httpsAgent: fetchAgent,
timeout: timeoutMs,
responseType: 'json',
maxBodyLength: Infinity,
maxContentLength: Infinity,
}
)
result = body.data result = body.data
if (result?.url || result?.directPath) { if (result?.url || result?.directPath) {

View File

@@ -165,8 +165,17 @@ export const prepareWAMessageMedia = async (message: AnyMediaMessageContent, opt
const requiresWaveformProcessing = mediaType === 'audio' && uploadData.ptt === true const requiresWaveformProcessing = mediaType === 'audio' && uploadData.ptt === true
const requiresAudioBackground = options.backgroundColor && mediaType === 'audio' && uploadData.ptt === true const requiresAudioBackground = options.backgroundColor && mediaType === 'audio' && uploadData.ptt === true
const requiresOriginalForSomeProcessing = requiresDurationComputation || requiresThumbnailComputation const requiresOriginalForSomeProcessing = requiresDurationComputation || requiresThumbnailComputation
const { mediaKey, encWriteStream, bodyPath, fileEncSha256, fileSha256, fileLength, didSaveToTmpPath } = const {
await encryptedStream(uploadData.media, options.mediaTypeOverride || mediaType, { mediaKey,
encFilePath,
originalFilePath,
fileEncSha256,
fileSha256,
fileLength
} = await encryptedStream(
uploadData.media,
options.mediaTypeOverride || mediaType,
{
logger, logger,
saveOriginalFileIfRequired: requiresOriginalForSomeProcessing, saveOriginalFileIfRequired: requiresOriginalForSomeProcessing,
opts: options.options opts: options.options
@@ -174,23 +183,21 @@ export const prepareWAMessageMedia = async (message: AnyMediaMessageContent, opt
// url safe Base64 encode the SHA256 hash of the body // url safe Base64 encode the SHA256 hash of the body
const fileEncSha256B64 = fileEncSha256.toString('base64') const fileEncSha256B64 = fileEncSha256.toString('base64')
const [{ mediaUrl, directPath }] = await Promise.all([ const [{ mediaUrl, directPath }] = await Promise.all([
(async () => { (async() => {
const result = await options.upload(encWriteStream, { const result = await options.upload(
fileEncSha256B64, encFilePath,
mediaType, { fileEncSha256B64, mediaType, timeoutMs: options.mediaUploadTimeoutMs }
timeoutMs: options.mediaUploadTimeoutMs )
})
logger?.debug({ mediaType, cacheableKey }, 'uploaded media') logger?.debug({ mediaType, cacheableKey }, 'uploaded media')
return result return result
})(), })(),
(async () => { (async () => {
try { try {
if (requiresThumbnailComputation) { if(requiresThumbnailComputation) {
const { thumbnail, originalImageDimensions } = await generateThumbnail( const {
bodyPath!, thumbnail,
mediaType as 'image' | 'video', originalImageDimensions
options } = await generateThumbnail(originalFilePath!, mediaType as 'image' | 'video', options)
)
uploadData.jpegThumbnail = thumbnail uploadData.jpegThumbnail = thumbnail
if (!uploadData.width && originalImageDimensions) { if (!uploadData.width && originalImageDimensions) {
uploadData.width = originalImageDimensions.width uploadData.width = originalImageDimensions.width
@@ -201,13 +208,13 @@ export const prepareWAMessageMedia = async (message: AnyMediaMessageContent, opt
logger?.debug('generated thumbnail') logger?.debug('generated thumbnail')
} }
if (requiresDurationComputation) { if(requiresDurationComputation) {
uploadData.seconds = await getAudioDuration(bodyPath!) uploadData.seconds = await getAudioDuration(originalFilePath!)
logger?.debug('computed audio duration') logger?.debug('computed audio duration')
} }
if (requiresWaveformProcessing) { if(requiresWaveformProcessing) {
uploadData.waveform = await getAudioWaveform(bodyPath!, logger) uploadData.waveform = await getAudioWaveform(originalFilePath!, logger)
logger?.debug('processed waveform') logger?.debug('processed waveform')
} }
@@ -218,20 +225,22 @@ export const prepareWAMessageMedia = async (message: AnyMediaMessageContent, opt
} catch (error) { } catch (error) {
logger?.warn({ trace: error.stack }, 'failed to obtain extra info') logger?.warn({ trace: error.stack }, 'failed to obtain extra info')
} }
})() })(),
]).finally(async () => { ])
encWriteStream.destroy() .finally(
// remove tmp files async() => {
if (didSaveToTmpPath && bodyPath) { try {
try { await fs.unlink(encFilePath)
await fs.access(bodyPath) if(originalFilePath) {
await fs.unlink(bodyPath) await fs.unlink(originalFilePath)
logger?.debug('removed tmp file') }
} catch (error) {
logger?.warn('failed to remove tmp file') logger?.debug('removed tmp files')
} catch(error) {
logger?.warn('failed to remove tmp file')
}
} }
} )
})
const obj = WAProto.Message.fromObject({ const obj = WAProto.Message.fromObject({
[`${mediaType}Message`]: MessageTypeProto[mediaType].fromObject({ [`${mediaType}Message`]: MessageTypeProto[mediaType].fromObject({

View File

@@ -23,7 +23,7 @@ export class USyncStatusProtocol implements USyncQueryProtocol {
parser(node: BinaryNode): StatusData | undefined { parser(node: BinaryNode): StatusData | undefined {
if (node.tag === 'status') { if (node.tag === 'status') {
assertNodeErrorFree(node) assertNodeErrorFree(node)
let status: string | null = node?.content!.toString() let status: string | null = node?.content?.toString() ?? null
const setAt = new Date(+(node?.attrs.t || 0) * 1000) const setAt = new Date(+(node?.attrs.t || 0) * 1000)
if (!status) { if (!status) {
if (+node.attrs?.code === 401) { if (+node.attrs?.code === 401) {

183
yarn.lock
View File

@@ -101,11 +101,21 @@
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz#d50e8d37b1176207b4fe9acedec386c565a44a54" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz#d50e8d37b1176207b4fe9acedec386c565a44a54"
integrity sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g== integrity sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==
"@babel/helper-string-parser@^7.27.1":
version "7.27.1"
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687"
integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==
"@babel/helper-validator-identifier@^7.25.7": "@babel/helper-validator-identifier@^7.25.7":
version "7.25.7" version "7.25.7"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz#77b7f60c40b15c97df735b38a66ba1d7c3e93da5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz#77b7f60c40b15c97df735b38a66ba1d7c3e93da5"
integrity sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg== integrity sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==
"@babel/helper-validator-identifier@^7.27.1":
version "7.27.1"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8"
integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==
"@babel/helper-validator-option@^7.25.7": "@babel/helper-validator-option@^7.25.7":
version "7.25.7" version "7.25.7"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.25.7.tgz#97d1d684448228b30b506d90cace495d6f492729" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.25.7.tgz#97d1d684448228b30b506d90cace495d6f492729"
@@ -136,6 +146,13 @@
dependencies: dependencies:
"@babel/types" "^7.25.8" "@babel/types" "^7.25.8"
"@babel/parser@^7.20.15":
version "7.27.2"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.2.tgz#577518bedb17a2ce4212afd052e01f7df0941127"
integrity sha512-QYLs8299NA7WM/bZAdp+CviYYkVoYXlDW2rzliy3chxd1PQjej7JORuMJDJXJUb9g0TT+B99EwaVLKmX+sPXWw==
dependencies:
"@babel/types" "^7.27.1"
"@babel/plugin-syntax-async-generators@^7.8.4": "@babel/plugin-syntax-async-generators@^7.8.4":
version "7.8.4" version "7.8.4"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d"
@@ -286,6 +303,14 @@
"@babel/helper-validator-identifier" "^7.25.7" "@babel/helper-validator-identifier" "^7.25.7"
to-fast-properties "^2.0.0" to-fast-properties "^2.0.0"
"@babel/types@^7.27.1":
version "7.27.1"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.1.tgz#9defc53c16fc899e46941fc6901a9eea1c9d8560"
integrity sha512-+EzkxvLNfiUeKMgy/3luqfsCWFRXLb7U6wNQTk60tovuckwB15B191tJWvpp4HjiQWdJkCxO3Wbvc6jlk3Xb2Q==
dependencies:
"@babel/helper-string-parser" "^7.27.1"
"@babel/helper-validator-identifier" "^7.27.1"
"@bcoe/v8-coverage@^0.2.3": "@bcoe/v8-coverage@^0.2.3":
version "0.2.3" version "0.2.3"
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
@@ -904,6 +929,13 @@
"@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14" "@jridgewell/sourcemap-codec" "^1.4.14"
"@jsdoc/salty@^0.2.1":
version "0.2.9"
resolved "https://registry.yarnpkg.com/@jsdoc/salty/-/salty-0.2.9.tgz#4d8c147f7ca011532681ce86352a77a0178f1dec"
integrity sha512-yYxMVH7Dqw6nO0d5NIV8OQWnitU8k6vXH8NtgqAfIa/IUqRMxRv/NUJJ08VEKbAakwxlgBl5PJdrU0dMPStsnw==
dependencies:
lodash "^4.17.21"
"@keyv/serialize@*": "@keyv/serialize@*":
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/@keyv/serialize/-/serialize-1.0.1.tgz#8dae240d5fe11c589e38b73a2db238dcf26a33cf" resolved "https://registry.yarnpkg.com/@keyv/serialize/-/serialize-1.0.1.tgz#8dae240d5fe11c589e38b73a2db238dcf26a33cf"
@@ -1273,11 +1305,29 @@
jest-matcher-utils "^27.0.0" jest-matcher-utils "^27.0.0"
pretty-format "^27.0.0" pretty-format "^27.0.0"
"@types/linkify-it@^5":
version "5.0.0"
resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-5.0.0.tgz#21413001973106cda1c3a9b91eedd4ccd5469d76"
integrity sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==
"@types/long@^4.0.0": "@types/long@^4.0.0":
version "4.0.2" version "4.0.2"
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a" resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a"
integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA== integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==
"@types/markdown-it@^14.1.1":
version "14.1.2"
resolved "https://registry.yarnpkg.com/@types/markdown-it/-/markdown-it-14.1.2.tgz#57f2532a0800067d9b934f3521429a2e8bfb4c61"
integrity sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==
dependencies:
"@types/linkify-it" "^5"
"@types/mdurl" "^2"
"@types/mdurl@^2":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-2.0.0.tgz#d43878b5b20222682163ae6f897b20447233bdfd"
integrity sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==
"@types/minimist@^1.2.0": "@types/minimist@^1.2.0":
version "1.2.5" version "1.2.5"
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.5.tgz#ec10755e871497bcd83efe927e43ec46e8c0747e" resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.5.tgz#ec10755e871497bcd83efe927e43ec46e8c0747e"
@@ -1842,6 +1892,11 @@ bl@^5.0.0:
inherits "^2.0.4" inherits "^2.0.4"
readable-stream "^3.4.0" readable-stream "^3.4.0"
bluebird@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
bmp-js@^0.1.0: bmp-js@^0.1.0:
version "0.1.0" version "0.1.0"
resolved "https://registry.yarnpkg.com/bmp-js/-/bmp-js-0.1.0.tgz#e05a63f796a6c1ff25f4771ec7adadc148c07233" resolved "https://registry.yarnpkg.com/bmp-js/-/bmp-js-0.1.0.tgz#e05a63f796a6c1ff25f4771ec7adadc148c07233"
@@ -2028,6 +2083,13 @@ caniuse-lite@^1.0.30001663:
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001668.tgz#98e214455329f54bf7a4d70b49c9794f0fbedbed" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001668.tgz#98e214455329f54bf7a4d70b49c9794f0fbedbed"
integrity sha512-nWLrdxqCdblixUO+27JtGJJE/txpJlyUy5YN1u53wLZkP0emYCo5zgS6QYft7VUYR42LGgi/S5hdLZTrnyIddw== integrity sha512-nWLrdxqCdblixUO+27JtGJJE/txpJlyUy5YN1u53wLZkP0emYCo5zgS6QYft7VUYR42LGgi/S5hdLZTrnyIddw==
catharsis@^0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/catharsis/-/catharsis-0.9.0.tgz#40382a168be0e6da308c277d3a2b3eb40c7d2121"
integrity sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==
dependencies:
lodash "^4.17.15"
centra@^2.7.0: centra@^2.7.0:
version "2.7.0" version "2.7.0"
resolved "https://registry.yarnpkg.com/centra/-/centra-2.7.0.tgz#4c8312a58436e8a718302011561db7e6a2b0ec18" resolved "https://registry.yarnpkg.com/centra/-/centra-2.7.0.tgz#4c8312a58436e8a718302011561db7e6a2b0ec18"
@@ -2955,7 +3017,7 @@ escape-string-regexp@^5.0.0:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz#4683126b500b61762f2dbebace1806e8be31b1c8" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz#4683126b500b61762f2dbebace1806e8be31b1c8"
integrity sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw== integrity sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==
escodegen@^1.14.3: escodegen@^1.13.0, escodegen@^1.14.3:
version "1.14.3" version "1.14.3"
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.3.tgz#4e7b81fba61581dc97582ed78cab7f0e8d63f503" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.3.tgz#4e7b81fba61581dc97582ed78cab7f0e8d63f503"
integrity sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw== integrity sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==
@@ -3040,7 +3102,7 @@ eslint@^8.0.0:
strip-ansi "^6.0.1" strip-ansi "^6.0.1"
text-table "^0.2.0" text-table "^0.2.0"
espree@^9.6.0, espree@^9.6.1: espree@^9.0.0, espree@^9.6.0, espree@^9.6.1:
version "9.6.1" version "9.6.1"
resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f"
integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==
@@ -3532,6 +3594,17 @@ glob@^7.0.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
once "^1.3.0" once "^1.3.0"
path-is-absolute "^1.0.0" path-is-absolute "^1.0.0"
glob@^8.0.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e"
integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^5.0.1"
once "^1.3.0"
global-dirs@^3.0.0: global-dirs@^3.0.0:
version "3.0.1" version "3.0.1"
resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-3.0.1.tgz#0c488971f066baceda21447aecb1a8b911d22485" resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-3.0.1.tgz#0c488971f066baceda21447aecb1a8b911d22485"
@@ -3619,7 +3692,7 @@ graceful-fs@4.2.10:
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==
graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.6, graceful-fs@^4.2.9: graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.6, graceful-fs@^4.2.9:
version "4.2.11" version "4.2.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
@@ -4727,11 +4800,39 @@ js-yaml@^4.1.0:
dependencies: dependencies:
argparse "^2.0.1" argparse "^2.0.1"
js2xmlparser@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/js2xmlparser/-/js2xmlparser-4.0.2.tgz#2a1fdf01e90585ef2ae872a01bc169c6a8d5e60a"
integrity sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==
dependencies:
xmlcreate "^2.0.4"
jsbn@1.1.0: jsbn@1.1.0:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040"
integrity sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A== integrity sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==
jsdoc@^4.0.0:
version "4.0.4"
resolved "https://registry.yarnpkg.com/jsdoc/-/jsdoc-4.0.4.tgz#86565a9e39cc723a3640465b3fb189a22d1206ca"
integrity sha512-zeFezwyXeG4syyYHbvh1A967IAqq/67yXtXvuL5wnqCkFZe8I0vKfm+EO+YEvLguo6w9CDUbrAXVtJSHh2E8rw==
dependencies:
"@babel/parser" "^7.20.15"
"@jsdoc/salty" "^0.2.1"
"@types/markdown-it" "^14.1.1"
bluebird "^3.7.2"
catharsis "^0.9.0"
escape-string-regexp "^2.0.0"
js2xmlparser "^4.0.2"
klaw "^3.0.0"
markdown-it "^14.1.0"
markdown-it-anchor "^8.6.7"
marked "^4.0.10"
mkdirp "^1.0.4"
requizzle "^0.2.3"
strip-json-comments "^3.1.0"
underscore "~1.13.2"
jsdom@^16.6.0: jsdom@^16.6.0:
version "16.7.0" version "16.7.0"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.7.0.tgz#918ae71965424b197c819f8183a754e18977b710" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.7.0.tgz#918ae71965424b197c819f8183a754e18977b710"
@@ -4843,6 +4944,13 @@ kind-of@^6.0.3:
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==
klaw@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/klaw/-/klaw-3.0.0.tgz#b11bec9cf2492f06756d6e809ab73a2910259146"
integrity sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==
dependencies:
graceful-fs "^4.1.9"
kleur@^3.0.3: kleur@^3.0.3:
version "3.0.3" version "3.0.3"
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
@@ -5085,6 +5193,11 @@ map-obj@^4.0.0:
resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a"
integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==
markdown-it-anchor@^8.6.7:
version "8.6.7"
resolved "https://registry.yarnpkg.com/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz#ee6926daf3ad1ed5e4e3968b1740eef1c6399634"
integrity sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==
markdown-it@^14.1.0: markdown-it@^14.1.0:
version "14.1.0" version "14.1.0"
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-14.1.0.tgz#3c3c5992883c633db4714ccb4d7b5935d98b7d45" resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-14.1.0.tgz#3c3c5992883c633db4714ccb4d7b5935d98b7d45"
@@ -5097,6 +5210,11 @@ markdown-it@^14.1.0:
punycode.js "^2.3.1" punycode.js "^2.3.1"
uc.micro "^2.1.0" uc.micro "^2.1.0"
marked@^4.0.10:
version "4.3.0"
resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3"
integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==
mdurl@^2.0.0: mdurl@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-2.0.0.tgz#80676ec0433025dd3e17ee983d0fe8de5a2237e0" resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-2.0.0.tgz#80676ec0433025dd3e17ee983d0fe8de5a2237e0"
@@ -5198,6 +5316,13 @@ minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2:
dependencies: dependencies:
brace-expansion "^1.1.7" brace-expansion "^1.1.7"
minimatch@^5.0.1:
version "5.1.6"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96"
integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==
dependencies:
brace-expansion "^2.0.1"
minimatch@^9.0.4, minimatch@^9.0.5: minimatch@^9.0.4, minimatch@^9.0.5:
version "9.0.5" version "9.0.5"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5"
@@ -5231,6 +5356,11 @@ mkdirp@^0.5.1:
dependencies: dependencies:
minimist "^1.2.6" minimist "^1.2.6"
mkdirp@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
modify-values@^1.0.0: modify-values@^1.0.0:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022"
@@ -5919,6 +6049,22 @@ proto-list@~1.2.1:
resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
integrity sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA== integrity sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==
protobufjs-cli@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/protobufjs-cli/-/protobufjs-cli-1.1.3.tgz#c58b8566784f0fa1aff11e8d875a31de999637fe"
integrity sha512-MqD10lqF+FMsOayFiNOdOGNlXc4iKDCf0ZQPkPR+gizYh9gqUeGTWulABUCdI+N67w5RfJ6xhgX4J8pa8qmMXQ==
dependencies:
chalk "^4.0.0"
escodegen "^1.13.0"
espree "^9.0.0"
estraverse "^5.1.0"
glob "^8.0.0"
jsdoc "^4.0.0"
minimist "^1.2.0"
semver "^7.1.2"
tmp "^0.2.1"
uglify-js "^3.7.7"
protobufjs@6.8.8: protobufjs@6.8.8:
version "6.8.8" version "6.8.8"
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.8.8.tgz#c8b4f1282fd7a90e6f5b109ed11c84af82908e7c" resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.8.8.tgz#c8b4f1282fd7a90e6f5b109ed11c84af82908e7c"
@@ -6232,6 +6378,13 @@ requires-port@^1.0.0:
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==
requizzle@^0.2.3:
version "0.2.4"
resolved "https://registry.yarnpkg.com/requizzle/-/requizzle-0.2.4.tgz#319eb658b28c370f0c20f968fa8ceab98c13d27c"
integrity sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==
dependencies:
lodash "^4.17.21"
resolve-alpn@^1.2.0: resolve-alpn@^1.2.0:
version "1.2.1" version "1.2.1"
resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9"
@@ -6414,6 +6567,11 @@ semver@^6.0.0, semver@^6.3.0, semver@^6.3.1:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==
semver@^7.1.2:
version "7.7.2"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58"
integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==
set-function-length@^1.2.1: set-function-length@^1.2.1:
version "1.2.2" version "1.2.2"
resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449"
@@ -6765,7 +6923,7 @@ strip-indent@^3.0.0:
dependencies: dependencies:
min-indent "^1.0.0" min-indent "^1.0.0"
strip-json-comments@^3.1.1: strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
version "3.1.1" version "3.1.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
@@ -6964,6 +7122,11 @@ tmp@^0.0.33:
dependencies: dependencies:
os-tmpdir "~1.0.2" os-tmpdir "~1.0.2"
tmp@^0.2.1:
version "0.2.3"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.3.tgz#eb783cc22bc1e8bebd0671476d46ea4eb32a79ae"
integrity sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==
tmpl@1.0.5: tmpl@1.0.5:
version "1.0.5" version "1.0.5"
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"
@@ -7197,7 +7360,7 @@ uc.micro@^2.0.0, uc.micro@^2.1.0:
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee" resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee"
integrity sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A== integrity sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==
uglify-js@^3.1.4: uglify-js@^3.1.4, uglify-js@^3.7.7:
version "3.19.3" version "3.19.3"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f"
integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ== integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==
@@ -7212,6 +7375,11 @@ unbox-primitive@^1.0.2:
has-symbols "^1.0.3" has-symbols "^1.0.3"
which-boxed-primitive "^1.0.2" which-boxed-primitive "^1.0.2"
underscore@~1.13.2:
version "1.13.7"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.7.tgz#970e33963af9a7dda228f17ebe8399e5fbe63a10"
integrity sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==
undici-types@~6.19.2: undici-types@~6.19.2:
version "6.19.8" version "6.19.8"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
@@ -7577,6 +7745,11 @@ xmlchars@^2.2.0:
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"
integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==
xmlcreate@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/xmlcreate/-/xmlcreate-2.0.4.tgz#0c5ab0f99cdd02a81065fa9cd8f8ae87624889be"
integrity sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==
xtend@^4.0.0, xtend@~4.0.1: xtend@^4.0.0, xtend@~4.0.1:
version "4.0.2" version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"