shellzapy 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- shellzapy-0.1.0.dist-info/METADATA +112 -0
- shellzapy-0.1.0.dist-info/RECORD +345 -0
- shellzapy-0.1.0.dist-info/WHEEL +4 -0
- shellzapy-0.1.0.dist-info/licenses/LICENSE +21 -0
- shellzapy-0.1.0.dist-info/licenses/NOTICE +9 -0
- zapy/__init__.py +58 -0
- zapy/_appstate/__init__.py +59 -0
- zapy/_appstate/constants.py +82 -0
- zapy/_appstate/crypto/__init__.py +17 -0
- zapy/_appstate/crypto/app_state_crypto.py +401 -0
- zapy/_appstate/parsers/__init__.py +23 -0
- zapy/_appstate/parsers/encoding.py +157 -0
- zapy/_appstate/parsers/response_parser.py +135 -0
- zapy/_appstate/sync/__init__.py +11 -0
- zapy/_appstate/sync/sync_client.py +1559 -0
- zapy/_appstate/types.py +137 -0
- zapy/_appstate/utils.py +100 -0
- zapy/_auth/__init__.py +3 -0
- zapy/_auth/auth_client.py +618 -0
- zapy/_auth/credentials_flow.py +290 -0
- zapy/_auth/pairing/__init__.py +3 -0
- zapy/_auth/pairing/companion_host.py +239 -0
- zapy/_auth/pairing/flow.py +808 -0
- zapy/_auth/pairing/pairing_code_crypto.py +143 -0
- zapy/_auth/pairing/qr_flow.py +123 -0
- zapy/_auth/pairing/shortcake_crypto.py +122 -0
- zapy/_auth/pairing/shortcake_flow.py +393 -0
- zapy/_auth/types.py +110 -0
- zapy/_client/__init__.py +26 -0
- zapy/_client/client.py +972 -0
- zapy/_client/connection/__init__.py +6 -0
- zapy/_client/connection/manager.py +525 -0
- zapy/_client/connection/receipt_queue.py +74 -0
- zapy/_client/coordinators/__init__.py +81 -0
- zapy/_client/coordinators/ab_props.py +260 -0
- zapy/_client/coordinators/app_state_mutation.py +2538 -0
- zapy/_client/coordinators/bot.py +830 -0
- zapy/_client/coordinators/broadcast_list.py +101 -0
- zapy/_client/coordinators/business.py +247 -0
- zapy/_client/coordinators/email.py +158 -0
- zapy/_client/coordinators/group.py +1478 -0
- zapy/_client/coordinators/incoming_node.py +758 -0
- zapy/_client/coordinators/low_level.py +119 -0
- zapy/_client/coordinators/message.py +1153 -0
- zapy/_client/coordinators/message_dispatch.py +1637 -0
- zapy/_client/coordinators/newsletter.py +110 -0
- zapy/_client/coordinators/offline_resume.py +271 -0
- zapy/_client/coordinators/passive_tasks.py +447 -0
- zapy/_client/coordinators/presence.py +103 -0
- zapy/_client/coordinators/privacy.py +623 -0
- zapy/_client/coordinators/profile.py +1024 -0
- zapy/_client/coordinators/retry.py +1878 -0
- zapy/_client/coordinators/status.py +132 -0
- zapy/_client/coordinators/stream_control.py +260 -0
- zapy/_client/coordinators/trusted_contact_token.py +417 -0
- zapy/_client/events/__init__.py +266 -0
- zapy/_client/events/abprops.py +58 -0
- zapy/_client/events/appstate_mutation.py +248 -0
- zapy/_client/events/business.py +565 -0
- zapy/_client/events/call.py +144 -0
- zapy/_client/events/chatstate.py +41 -0
- zapy/_client/events/devices.py +122 -0
- zapy/_client/events/dirty.py +384 -0
- zapy/_client/events/group.py +655 -0
- zapy/_client/events/identity.py +40 -0
- zapy/_client/events/incoming.py +1079 -0
- zapy/_client/events/mex_notification.py +317 -0
- zapy/_client/events/offline.py +123 -0
- zapy/_client/events/picture.py +67 -0
- zapy/_client/events/presence.py +74 -0
- zapy/_client/events/privacy.py +187 -0
- zapy/_client/events/privacy_token.py +72 -0
- zapy/_client/events/receipt.py +109 -0
- zapy/_client/events/registration.py +70 -0
- zapy/_client/events/username.py +76 -0
- zapy/_client/factory.py +2020 -0
- zapy/_client/media.py +829 -0
- zapy/_client/newsletter/__init__.py +90 -0
- zapy/_client/newsletter/admin.py +323 -0
- zapy/_client/newsletter/content.py +499 -0
- zapy/_client/newsletter/discovery.py +233 -0
- zapy/_client/newsletter/messaging.py +396 -0
- zapy/_client/newsletter/mex.py +99 -0
- zapy/_client/newsletter/parse.py +406 -0
- zapy/_client/newsletter/types.py +393 -0
- zapy/_client/persistence/__init__.py +89 -0
- zapy/_client/persistence/companion_host.py +133 -0
- zapy/_client/persistence/ephemeral_setting.py +245 -0
- zapy/_client/persistence/group_history.py +361 -0
- zapy/_client/persistence/history_blob.py +169 -0
- zapy/_client/persistence/history_sync.py +646 -0
- zapy/_client/persistence/mailbox.py +232 -0
- zapy/_client/persistence/write_behind_persistence.py +368 -0
- zapy/_client/plugins/__init__.py +23 -0
- zapy/_client/plugins/define.py +44 -0
- zapy/_client/plugins/install.py +254 -0
- zapy/_client/plugins/types.py +64 -0
- zapy/_client/tokens/__init__.py +21 -0
- zapy/_client/tokens/cs_token.py +47 -0
- zapy/_client/tokens/tc_token.py +43 -0
- zapy/_client/types.py +988 -0
- zapy/_crypto/__init__.py +65 -0
- zapy/_crypto/core/__init__.py +62 -0
- zapy/_crypto/core/hkdf.py +41 -0
- zapy/_crypto/core/keys.py +51 -0
- zapy/_crypto/core/nonce.py +25 -0
- zapy/_crypto/core/primitives.py +179 -0
- zapy/_crypto/core/random.py +32 -0
- zapy/_crypto/core/xeddsa.py +72 -0
- zapy/_crypto/curves/__init__.py +3 -0
- zapy/_crypto/curves/constants.py +10 -0
- zapy/_crypto/curves/ed25519.py +61 -0
- zapy/_crypto/curves/types.py +18 -0
- zapy/_crypto/curves/x25519.py +117 -0
- zapy/_crypto/math/__init__.py +3 -0
- zapy/_crypto/math/constants.py +35 -0
- zapy/_crypto/math/edwards.py +174 -0
- zapy/_crypto/math/fe.py +120 -0
- zapy/_crypto/math/le.py +13 -0
- zapy/_crypto/math/mod.py +15 -0
- zapy/_crypto/math/prime.py +11 -0
- zapy/_crypto/math/types.py +25 -0
- zapy/_crypto/native_backend.py +40 -0
- zapy/_infra/__init__.py +3 -0
- zapy/_infra/log.py +142 -0
- zapy/_infra/perf.py +77 -0
- zapy/_media/__init__.py +64 -0
- zapy/_media/constants.py +133 -0
- zapy/_media/container.py +110 -0
- zapy/_media/crypto/__init__.py +19 -0
- zapy/_media/crypto/crypto.py +633 -0
- zapy/_media/crypto/media_retry.py +107 -0
- zapy/_media/processor.py +100 -0
- zapy/_media/sticker/__init__.py +8 -0
- zapy/_media/sticker/pack.py +188 -0
- zapy/_media/transfer/__init__.py +15 -0
- zapy/_media/transfer/client.py +635 -0
- zapy/_media/transfer/conn.py +48 -0
- zapy/_media/types.py +169 -0
- zapy/_message/__init__.py +121 -0
- zapy/_message/addons/__init__.py +5 -0
- zapy/_message/addons/link_preview/__init__.py +54 -0
- zapy/_message/addons/link_preview/builder.py +56 -0
- zapy/_message/addons/link_preview/detect.py +72 -0
- zapy/_message/addons/link_preview/fetcher.py +553 -0
- zapy/_message/addons/link_preview/types.py +100 -0
- zapy/_message/client.py +486 -0
- zapy/_message/context_info.py +424 -0
- zapy/_message/crypto/__init__.py +71 -0
- zapy/_message/crypto/addon_crypto.py +656 -0
- zapy/_message/crypto/icdc.py +138 -0
- zapy/_message/crypto/phash.py +87 -0
- zapy/_message/crypto/reporting_token.py +498 -0
- zapy/_message/crypto/use_case_secret.py +113 -0
- zapy/_message/encode/__init__.py +84 -0
- zapy/_message/encode/content.py +636 -0
- zapy/_message/encode/device_sent.py +88 -0
- zapy/_message/encode/media_payload.py +122 -0
- zapy/_message/encode/padding.py +27 -0
- zapy/_message/kinds/__init__.py +1 -0
- zapy/_message/kinds/bot.py +179 -0
- zapy/_message/kinds/group_history.py +206 -0
- zapy/_message/kinds/newsletter.py +388 -0
- zapy/_message/kinds/sticker_pack.py +74 -0
- zapy/_message/messaging/__init__.py +336 -0
- zapy/_message/messaging/companion_host.py +117 -0
- zapy/_message/messaging/fanout.py +311 -0
- zapy/_message/messaging/group_metadata.py +444 -0
- zapy/_message/messaging/ignore_key.py +264 -0
- zapy/_message/messaging/key_protocol.py +217 -0
- zapy/_message/messaging/link_preview.py +448 -0
- zapy/_message/messaging/messages.py +1429 -0
- zapy/_message/primitives/__init__.py +1 -0
- zapy/_message/primitives/ack.py +232 -0
- zapy/_message/primitives/incoming.py +1141 -0
- zapy/_message/primitives/media_retry.py +451 -0
- zapy/_message/primitives/peer_data_operation.py +271 -0
- zapy/_message/types.py +434 -0
- zapy/_proto/WAProto_pb2.py +2584 -0
- zapy/_proto/__init__.py +1 -0
- zapy/_protocol/__init__.py +3 -0
- zapy/_protocol/abprops_spec.py +6216 -0
- zapy/_protocol/auth.py +17 -0
- zapy/_protocol/browser.py +57 -0
- zapy/_protocol/defaults.py +38 -0
- zapy/_protocol/device_identity.py +54 -0
- zapy/_protocol/jid.py +241 -0
- zapy/_protocol/message.py +127 -0
- zapy/_protocol/nodes.py +144 -0
- zapy/_protocol/notification.py +18 -0
- zapy/_retry/__init__.py +77 -0
- zapy/_retry/codec.py +209 -0
- zapy/_retry/constants.py +28 -0
- zapy/_retry/parse.py +132 -0
- zapy/_retry/reason.py +65 -0
- zapy/_retry/replay.py +483 -0
- zapy/_retry/tracker.py +161 -0
- zapy/_retry/types.py +122 -0
- zapy/_signal/__init__.py +171 -0
- zapy/_signal/api/__init__.py +133 -0
- zapy/_signal/api/codec.py +164 -0
- zapy/_signal/api/constants.py +14 -0
- zapy/_signal/api/device_sync.py +915 -0
- zapy/_signal/api/digest_sync.py +363 -0
- zapy/_signal/api/identity_sync.py +250 -0
- zapy/_signal/api/missing_pre_keys_sync.py +267 -0
- zapy/_signal/api/prekeys.py +191 -0
- zapy/_signal/api/result_map.py +40 -0
- zapy/_signal/api/rotate_key.py +111 -0
- zapy/_signal/api/session_sync.py +297 -0
- zapy/_signal/attestation.py +145 -0
- zapy/_signal/constants.py +22 -0
- zapy/_signal/encoding.py +78 -0
- zapy/_signal/group/__init__.py +35 -0
- zapy/_signal/group/chain.py +139 -0
- zapy/_signal/group/codec.py +78 -0
- zapy/_signal/group/encoding.py +166 -0
- zapy/_signal/group/manager.py +361 -0
- zapy/_signal/registration/__init__.py +44 -0
- zapy/_signal/registration/keygen.py +46 -0
- zapy/_signal/registration/reg_encoding.py +66 -0
- zapy/_signal/registration/reg_utils.py +52 -0
- zapy/_signal/session/__init__.py +114 -0
- zapy/_signal/session/encoding.py +385 -0
- zapy/_signal/session/protocol.py +590 -0
- zapy/_signal/session/ratchet.py +381 -0
- zapy/_signal/session/resolver.py +630 -0
- zapy/_signal/session/serializer.py +96 -0
- zapy/_signal/session/session.py +272 -0
- zapy/_signal/types.py +214 -0
- zapy/_store/__init__.py +118 -0
- zapy/_store/cache/__init__.py +166 -0
- zapy/_store/cache/identity.py +130 -0
- zapy/_store/cache/privacy_token.py +116 -0
- zapy/_store/cache/sender_key.py +168 -0
- zapy/_store/cache/session.py +142 -0
- zapy/_store/contracts/__init__.py +84 -0
- zapy/_store/contracts/appstate.py +82 -0
- zapy/_store/contracts/auth.py +16 -0
- zapy/_store/contracts/chat_metadata.py +29 -0
- zapy/_store/contracts/contact.py +31 -0
- zapy/_store/contracts/device_list.py +35 -0
- zapy/_store/contracts/group_metadata.py +33 -0
- zapy/_store/contracts/identity.py +18 -0
- zapy/_store/contracts/message.py +36 -0
- zapy/_store/contracts/message_secret.py +41 -0
- zapy/_store/contracts/pre_key.py +32 -0
- zapy/_store/contracts/privacy_token.py +32 -0
- zapy/_store/contracts/retry.py +47 -0
- zapy/_store/contracts/sender_key.py +37 -0
- zapy/_store/contracts/session.py +21 -0
- zapy/_store/contracts/signal.py +23 -0
- zapy/_store/contracts/thread.py +35 -0
- zapy/_store/create_store.py +890 -0
- zapy/_store/locks.py +1154 -0
- zapy/_store/memory/__init__.py +40 -0
- zapy/_store/memory/appstate.py +200 -0
- zapy/_store/memory/auth.py +24 -0
- zapy/_store/memory/chat_metadata.py +124 -0
- zapy/_store/memory/contact.py +125 -0
- zapy/_store/memory/device_list.py +161 -0
- zapy/_store/memory/group_metadata.py +125 -0
- zapy/_store/memory/identity.py +86 -0
- zapy/_store/memory/message.py +85 -0
- zapy/_store/memory/message_secret.py +145 -0
- zapy/_store/memory/pre_key.py +112 -0
- zapy/_store/memory/privacy_token.py +103 -0
- zapy/_store/memory/retry.py +250 -0
- zapy/_store/memory/sender_key.py +162 -0
- zapy/_store/memory/session.py +111 -0
- zapy/_store/memory/signal.py +45 -0
- zapy/_store/memory/thread.py +66 -0
- zapy/_store/noop.py +279 -0
- zapy/_transport/__init__.py +3 -0
- zapy/_transport/binary/__init__.py +77 -0
- zapy/_transport/binary/constants.py +80 -0
- zapy/_transport/binary/decoder.py +260 -0
- zapy/_transport/binary/encoder.py +279 -0
- zapy/_transport/binary/tokens.py +1289 -0
- zapy/_transport/comms.py +759 -0
- zapy/_transport/keepalive/__init__.py +3 -0
- zapy/_transport/keepalive/keep_alive.py +252 -0
- zapy/_transport/node/__init__.py +3 -0
- zapy/_transport/node/builders/__init__.py +9 -0
- zapy/_transport/node/builders/abprops.py +33 -0
- zapy/_transport/node/builders/account_sync.py +120 -0
- zapy/_transport/node/builders/bot.py +56 -0
- zapy/_transport/node/builders/business.py +261 -0
- zapy/_transport/node/builders/chatstate.py +74 -0
- zapy/_transport/node/builders/community.py +116 -0
- zapy/_transport/node/builders/device.py +30 -0
- zapy/_transport/node/builders/email.py +181 -0
- zapy/_transport/node/builders/global_.py +74 -0
- zapy/_transport/node/builders/group.py +279 -0
- zapy/_transport/node/builders/media.py +21 -0
- zapy/_transport/node/builders/message.py +436 -0
- zapy/_transport/node/builders/mobile.py +227 -0
- zapy/_transport/node/builders/newsletter.py +293 -0
- zapy/_transport/node/builders/offline.py +20 -0
- zapy/_transport/node/builders/pairing.py +130 -0
- zapy/_transport/node/builders/passive.py +28 -0
- zapy/_transport/node/builders/prekeys.py +215 -0
- zapy/_transport/node/builders/presence.py +100 -0
- zapy/_transport/node/builders/privacy.py +243 -0
- zapy/_transport/node/builders/privacy_token.py +94 -0
- zapy/_transport/node/builders/profile.py +176 -0
- zapy/_transport/node/builders/retry.py +156 -0
- zapy/_transport/node/builders/shortcake.py +87 -0
- zapy/_transport/node/builders/tos.py +92 -0
- zapy/_transport/node/builders/usync.py +185 -0
- zapy/_transport/node/helpers.py +201 -0
- zapy/_transport/node/orchestrator.py +210 -0
- zapy/_transport/node/query.py +82 -0
- zapy/_transport/node/transport.py +105 -0
- zapy/_transport/node/usync.py +33 -0
- zapy/_transport/node/xml.py +38 -0
- zapy/_transport/noise/__init__.py +7 -0
- zapy/_transport/noise/cert.py +85 -0
- zapy/_transport/noise/client_payload.py +344 -0
- zapy/_transport/noise/constants.py +12 -0
- zapy/_transport/noise/frame_codec.py +120 -0
- zapy/_transport/noise/handshake.py +92 -0
- zapy/_transport/noise/session.py +493 -0
- zapy/_transport/noise/socket.py +45 -0
- zapy/_transport/noise/types.py +66 -0
- zapy/_transport/noise/version.json +3 -0
- zapy/_transport/proxy.py +35 -0
- zapy/_transport/types.py +19 -0
- zapy/_transport/wa_version_fetcher.py +159 -0
- zapy/_transport/web_socket.py +602 -0
- zapy/_util/__init__.py +3 -0
- zapy/_util/bytes.py +131 -0
- zapy/_util/coercion.py +29 -0
- zapy/_util/collections.py +45 -0
- zapy/_util/primitives.py +49 -0
- zapy/client.py +840 -0
- zapy/errors.py +148 -0
- zapy/events.py +564 -0
- zapy/jid.py +140 -0
- zapy/py.typed +0 -0
- zapy/stores/__init__.py +50 -0
- zapy/stores/base.py +1627 -0
- zapy/stores/json_file.py +359 -0
- zapy/stores/memory.py +322 -0
- zapy/stores/sqlite.py +343 -0
zapy/_client/types.py
ADDED
|
@@ -0,0 +1,988 @@
|
|
|
1
|
+
"""Client options and event payloads (mirrors ``src/client/types.ts``).
|
|
2
|
+
|
|
3
|
+
Message bodies (``Proto.IMessage`` and friends) are typed as :data:`Any`
|
|
4
|
+
here: the generated protobuf bindings are evolving with the sibling message
|
|
5
|
+
layer, and this module must stay importable on its own. Where a payload
|
|
6
|
+
references a sibling-owned coordinator type it is likewise :data:`Any` with
|
|
7
|
+
a comment naming the owning module.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from collections.abc import Awaitable, Callable
|
|
13
|
+
from dataclasses import dataclass, field
|
|
14
|
+
from typing import Any, Literal, Protocol
|
|
15
|
+
|
|
16
|
+
from zapy._store.create_store import WaStore
|
|
17
|
+
from zapy._auth.types import (
|
|
18
|
+
WaAuthCredentials,
|
|
19
|
+
WaAuthDangerousOptions,
|
|
20
|
+
WaMobileTransportOptions,
|
|
21
|
+
WaVersionResolver,
|
|
22
|
+
)
|
|
23
|
+
from zapy._transport.types import BinaryNode
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
"WaClientProxyOptions",
|
|
27
|
+
"WaLogoutStoreClearOptions",
|
|
28
|
+
"WaWriteBehindOptions",
|
|
29
|
+
"WaHistorySyncSink",
|
|
30
|
+
"WaHistorySyncChunkRef",
|
|
31
|
+
"WaHistorySyncChunkEvent",
|
|
32
|
+
"WaHistorySyncItem",
|
|
33
|
+
"WaHistorySyncOptions",
|
|
34
|
+
"WaClientChatEventsOptions",
|
|
35
|
+
"WaPrivacyTokenOptions",
|
|
36
|
+
"WaAddonOptions",
|
|
37
|
+
"WaMediaOptions",
|
|
38
|
+
"WaClientDangerousOptions",
|
|
39
|
+
"WaClientTestHooks",
|
|
40
|
+
"WaClientOptions",
|
|
41
|
+
"WaIgnoreStanzaKind",
|
|
42
|
+
"WaIgnoreKey",
|
|
43
|
+
"WaIgnoreKeyContext",
|
|
44
|
+
"WaIgnoreKeyPredicate",
|
|
45
|
+
"WaIncomingStanzaFilter",
|
|
46
|
+
"WaIncomingNodeHandler",
|
|
47
|
+
"WaIncomingNodeHandlerRegistration",
|
|
48
|
+
"WaIncomingBaseEvent",
|
|
49
|
+
"WaIncomingMessageKey",
|
|
50
|
+
"WaIncomingMessageEvent",
|
|
51
|
+
"WaOutgoingMessageEvent",
|
|
52
|
+
"WaIncomingProtocolMessageEvent",
|
|
53
|
+
"WaReceiptStatus",
|
|
54
|
+
"WaIncomingReceiptEvent",
|
|
55
|
+
"WaIncomingPresenceEvent",
|
|
56
|
+
"WaIncomingChatstateEvent",
|
|
57
|
+
"WaIncomingCallEvent",
|
|
58
|
+
"WaIncomingNotificationEvent",
|
|
59
|
+
"WaMexNotificationEvent",
|
|
60
|
+
"WaRegistrationCodeEvent",
|
|
61
|
+
"WaAccountTakeoverNoticeEvent",
|
|
62
|
+
"WaAddonKind",
|
|
63
|
+
"WaIncomingAddonEvent",
|
|
64
|
+
"WaIncomingBotChunkEvent",
|
|
65
|
+
"WaIncomingFailureEvent",
|
|
66
|
+
"WaIncomingUnhandledStanzaEvent",
|
|
67
|
+
"WaIncomingDecryptedPayloadEvent",
|
|
68
|
+
"WaUnavailableMessageKind",
|
|
69
|
+
"WaIncomingUnavailableMessageEvent",
|
|
70
|
+
"WaIncomingErrorStanzaEvent",
|
|
71
|
+
"WaIncomingNewsletterMessageUpdateEvent",
|
|
72
|
+
"WaNewsletterMessageUpdate",
|
|
73
|
+
"WaIncomingNewsletterEvent",
|
|
74
|
+
"WaNewsletterEventAction",
|
|
75
|
+
"WaGroupEvent",
|
|
76
|
+
"WaGroupEventAction",
|
|
77
|
+
"WaBusinessEvent",
|
|
78
|
+
"WaPictureEvent",
|
|
79
|
+
"WaOwnUsernameNotificationEvent",
|
|
80
|
+
"WaAppStateMutationEvent",
|
|
81
|
+
"WaAppStateMutationSource",
|
|
82
|
+
"WaAppStateMessageKey",
|
|
83
|
+
"WaGroupHistoryBundleEvent",
|
|
84
|
+
"WaOfflineResumeEvent",
|
|
85
|
+
"WaOfflineThreadMetadataEvent",
|
|
86
|
+
"WaPrivacyTokenUpdateEvent",
|
|
87
|
+
"WaConnectionEvent",
|
|
88
|
+
"WaClientEventName",
|
|
89
|
+
"WA_CLIENT_EVENT_NAMES",
|
|
90
|
+
"WaSendMessageOptions",
|
|
91
|
+
"WaPrivacyAccountSyncResult",
|
|
92
|
+
"WaBlocklistResult",
|
|
93
|
+
"WaClearChatOptions",
|
|
94
|
+
"WaDeleteChatOptions",
|
|
95
|
+
"WaDeleteMessageForMeOptions",
|
|
96
|
+
"WaDownloadMediaOptions",
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@dataclass(frozen=True, slots=True)
|
|
101
|
+
class WaClientProxyOptions:
|
|
102
|
+
"""Per-leg proxy configuration (mirrors ``WaClientProxyOptions``)."""
|
|
103
|
+
|
|
104
|
+
ws: Any | None = None
|
|
105
|
+
media_upload: Any | None = None
|
|
106
|
+
media_download: Any | None = None
|
|
107
|
+
link_preview: Any | None = None
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
@dataclass(frozen=True, slots=True)
|
|
111
|
+
class WaLogoutStoreClearOptions:
|
|
112
|
+
"""Per-domain control over what ``logout`` wipes (mirrors TS).
|
|
113
|
+
|
|
114
|
+
Defaults (domain left ``None``): ``messages``/``threads``/``contacts``
|
|
115
|
+
are preserved, everything else is cleared. Explicit ``True``/``False``
|
|
116
|
+
always wins.
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
auth: bool | None = None
|
|
120
|
+
signal: bool | None = None
|
|
121
|
+
pre_key: bool | None = None
|
|
122
|
+
session: bool | None = None
|
|
123
|
+
identity: bool | None = None
|
|
124
|
+
sender_key: bool | None = None
|
|
125
|
+
app_state: bool | None = None
|
|
126
|
+
retry: bool | None = None
|
|
127
|
+
group_metadata: bool | None = None
|
|
128
|
+
device_list: bool | None = None
|
|
129
|
+
messages: bool | None = None
|
|
130
|
+
message_secret: bool | None = None
|
|
131
|
+
threads: bool | None = None
|
|
132
|
+
contacts: bool | None = None
|
|
133
|
+
privacy_token: bool | None = None
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
@dataclass(frozen=True, slots=True)
|
|
137
|
+
class WaWriteBehindOptions:
|
|
138
|
+
"""Write-behind persistence tuning."""
|
|
139
|
+
|
|
140
|
+
max_pending_keys: int | None = None
|
|
141
|
+
max_write_concurrency: int | None = None
|
|
142
|
+
flush_timeout_ms: float | None = None
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@dataclass(frozen=True, slots=True)
|
|
146
|
+
class WaHistorySyncChunkRef:
|
|
147
|
+
"""Identifies one history-sync chunk; chunks may process concurrently."""
|
|
148
|
+
|
|
149
|
+
id: str
|
|
150
|
+
sync_type: int
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
WaHistorySyncItem = dict[str, Any]
|
|
154
|
+
"""One decoded record of a history-sync chunk (sibling app-state shape)."""
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class WaHistorySyncSink(Protocol):
|
|
158
|
+
"""Streaming receiver for decoded history-sync content (mirrors TS)."""
|
|
159
|
+
|
|
160
|
+
def item(self, item: WaHistorySyncItem, chunk: WaHistorySyncChunkRef) -> Any:
|
|
161
|
+
"""Receive one record in wire order; may return an awaitable."""
|
|
162
|
+
...
|
|
163
|
+
|
|
164
|
+
def commit(self, chunk: WaHistorySyncChunkEvent) -> Any:
|
|
165
|
+
"""Called once the chunk verified and applied."""
|
|
166
|
+
...
|
|
167
|
+
|
|
168
|
+
def abort(self, chunk: WaHistorySyncChunkRef, error: Exception) -> Any:
|
|
169
|
+
"""Called when the chunk fails after items may have been delivered."""
|
|
170
|
+
...
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
@dataclass(frozen=True, slots=True)
|
|
174
|
+
class WaHistorySyncChunkEvent(WaHistorySyncChunkRef):
|
|
175
|
+
"""One chunk of history-sync data."""
|
|
176
|
+
|
|
177
|
+
messages_count: int = 0
|
|
178
|
+
conversations_count: int = 0
|
|
179
|
+
pushnames_count: int = 0
|
|
180
|
+
inline_contacts_count: int = 0
|
|
181
|
+
chunk_order: int | None = None
|
|
182
|
+
progress: float | None = None
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
@dataclass(frozen=True, slots=True)
|
|
186
|
+
class WaHistorySyncOptions:
|
|
187
|
+
"""History-sync behavior (mirrors ``WaHistorySyncOptions``)."""
|
|
188
|
+
|
|
189
|
+
enabled: bool | None = None
|
|
190
|
+
sink: WaHistorySyncSink | None = None
|
|
191
|
+
require_full_sync: bool | None = None
|
|
192
|
+
group_bundles: bool | None = None
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
@dataclass(frozen=True, slots=True)
|
|
196
|
+
class WaClientChatEventsOptions:
|
|
197
|
+
"""Chat-event emission tuning."""
|
|
198
|
+
|
|
199
|
+
emit_snapshot_mutations: bool | None = None
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
@dataclass(frozen=True, slots=True)
|
|
203
|
+
class WaPrivacyTokenOptions:
|
|
204
|
+
"""Trusted-contact-token cache tuning."""
|
|
205
|
+
|
|
206
|
+
tc_token_duration_s: float | None = None
|
|
207
|
+
tc_token_num_buckets: int | None = None
|
|
208
|
+
tc_token_sender_duration_s: float | None = None
|
|
209
|
+
tc_token_sender_num_buckets: int | None = None
|
|
210
|
+
tc_token_max_duration_s: float | None = None
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
@dataclass(frozen=True, slots=True)
|
|
214
|
+
class WaAddonOptions:
|
|
215
|
+
"""Addon auto-decrypt / secret persistence tuning."""
|
|
216
|
+
|
|
217
|
+
auto_decrypt: bool | None = None
|
|
218
|
+
persist_all_secrets: bool | None = None
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
@dataclass(frozen=True, slots=True)
|
|
222
|
+
class WaMediaOptions:
|
|
223
|
+
"""Media handling tuning (processor lives in the sibling media layer)."""
|
|
224
|
+
|
|
225
|
+
processor: Any | None = None
|
|
226
|
+
generate_thumbnail: bool | None = None
|
|
227
|
+
generate_probe: bool | None = None
|
|
228
|
+
generate_waveform: bool | None = None
|
|
229
|
+
generate_sticker_thumbnail: bool | None = None
|
|
230
|
+
normalize_voice_note: bool | None = None
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
@dataclass(frozen=True, slots=True)
|
|
234
|
+
class WaClientDangerousOptions(WaAuthDangerousOptions):
|
|
235
|
+
"""Client escape hatches on top of the auth ones. Do not enable."""
|
|
236
|
+
|
|
237
|
+
disable_sender_key_signature_verification: bool = False
|
|
238
|
+
disable_app_state_mac_verification: bool = False
|
|
239
|
+
disable_media_mac_verification: bool = False
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
@dataclass(frozen=True, slots=True)
|
|
243
|
+
class WaClientTestHooks:
|
|
244
|
+
"""Test-only overrides (e.g. fake-server root CA). Never bypass checks."""
|
|
245
|
+
|
|
246
|
+
noise_root_ca: Any | None = None
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
@dataclass
|
|
250
|
+
class WaClientOptions:
|
|
251
|
+
"""Top-level client configuration (mirrors ``WaClientOptions``).
|
|
252
|
+
|
|
253
|
+
Flattened view of the TS ``WaAuthClientOptions & WaAuthSocketOptions``
|
|
254
|
+
plus the client-specific knobs. ``store`` is required; ``session_id``
|
|
255
|
+
must be a non-empty string.
|
|
256
|
+
"""
|
|
257
|
+
|
|
258
|
+
store: WaStore
|
|
259
|
+
session_id: str
|
|
260
|
+
device_browser: str | None = None
|
|
261
|
+
device_platform: str | None = None
|
|
262
|
+
device_os_display_name: str | None = None
|
|
263
|
+
device_os_version: str | None = None
|
|
264
|
+
require_full_sync: bool = False
|
|
265
|
+
version: WaVersionResolver | None = None
|
|
266
|
+
dangerous: WaAuthDangerousOptions | None = None
|
|
267
|
+
mobile_transport: WaMobileTransportOptions | None = None
|
|
268
|
+
url: str | None = None
|
|
269
|
+
urls: list[str] | tuple[str, ...] | None = None
|
|
270
|
+
protocols: list[str] | None = None
|
|
271
|
+
connect_timeout_ms: float | None = None
|
|
272
|
+
reconnect_interval_ms: float | None = None
|
|
273
|
+
timeout_interval_ms: float | None = None
|
|
274
|
+
max_reconnect_attempts: int | None = None
|
|
275
|
+
proxy: WaClientProxyOptions | dict[str, Any] | None = None
|
|
276
|
+
companion_host: dict[str, Any] | None = None
|
|
277
|
+
chat_socket_urls: list[str] | tuple[str, ...] | None = None
|
|
278
|
+
iq_timeout_ms: float | None = None
|
|
279
|
+
node_query_timeout_ms: float | None = None
|
|
280
|
+
keep_alive_interval_ms: float | None = None
|
|
281
|
+
dead_socket_timeout_ms: float | None = None
|
|
282
|
+
media_timeout_ms: float | None = None
|
|
283
|
+
app_state_sync_timeout_ms: float | None = None
|
|
284
|
+
signal_fetch_key_bundles_timeout_ms: float | None = None
|
|
285
|
+
message_ack_timeout_ms: float | None = None
|
|
286
|
+
message_max_attempts: int | None = None
|
|
287
|
+
message_retry_delay_ms: float | None = None
|
|
288
|
+
mark_online_on_connect: bool = False
|
|
289
|
+
recover_from_client_too_old: bool = False
|
|
290
|
+
write_behind: WaWriteBehindOptions | None = None
|
|
291
|
+
history: WaHistorySyncOptions | None = None
|
|
292
|
+
chat_events: WaClientChatEventsOptions | None = None
|
|
293
|
+
privacy_token: WaPrivacyTokenOptions | None = None
|
|
294
|
+
addons: WaAddonOptions | None = None
|
|
295
|
+
logout_store_clear: WaLogoutStoreClearOptions | None = None
|
|
296
|
+
media: WaMediaOptions | None = None
|
|
297
|
+
link_preview: Any | None = None
|
|
298
|
+
plugins: tuple[Any, ...] = ()
|
|
299
|
+
test_hooks: WaClientTestHooks | None = None
|
|
300
|
+
sign_passkey_assertion: Any | None = None
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
WaIgnoreStanzaKind = Literal[
|
|
304
|
+
"message", "receipt", "notification", "presence", "chatstate", "call"
|
|
305
|
+
]
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
@dataclass(frozen=True, slots=True)
|
|
309
|
+
class WaIgnoreKey:
|
|
310
|
+
"""Declarative stanza-drop descriptor (mirrors ``WaIgnoreKey``)."""
|
|
311
|
+
|
|
312
|
+
remote_jid: str | tuple[str, ...] | list[str] | None = None
|
|
313
|
+
from_me: bool | None = None
|
|
314
|
+
id: str | None = None
|
|
315
|
+
participant: str | None = None
|
|
316
|
+
only: tuple[WaIgnoreStanzaKind, ...] | None = None
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
@dataclass(frozen=True, slots=True)
|
|
320
|
+
class WaIgnoreKeyContext:
|
|
321
|
+
"""Parsed inbound stanza view passed to an ignore predicate."""
|
|
322
|
+
|
|
323
|
+
kind: WaIgnoreStanzaKind
|
|
324
|
+
remote_jid: str | None
|
|
325
|
+
from_me: bool
|
|
326
|
+
id: str | None
|
|
327
|
+
participant: str | None
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
WaIgnoreKeyPredicate = Callable[[WaIgnoreKeyContext], bool]
|
|
331
|
+
"""Return ``True`` to drop the stanza before any handler runs."""
|
|
332
|
+
|
|
333
|
+
WaIncomingStanzaFilter = Callable[[BinaryNode], bool | Awaitable[bool]]
|
|
334
|
+
|
|
335
|
+
WaIncomingNodeHandler = Callable[[BinaryNode], Awaitable[bool]]
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
@dataclass(frozen=True, slots=True)
|
|
339
|
+
class WaIncomingNodeHandlerRegistration:
|
|
340
|
+
"""A tag/subtype handler registered on the incoming-node coordinator."""
|
|
341
|
+
|
|
342
|
+
tag: str
|
|
343
|
+
handler: WaIncomingNodeHandler
|
|
344
|
+
subtype: str | None = None
|
|
345
|
+
prepend: bool = False
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
@dataclass(frozen=True, slots=True)
|
|
349
|
+
class WaIncomingBaseEvent:
|
|
350
|
+
"""Fields shared by every inbound stanza event."""
|
|
351
|
+
|
|
352
|
+
raw_node: BinaryNode
|
|
353
|
+
stanza_id: str | None = None
|
|
354
|
+
chat_jid: str | None = None
|
|
355
|
+
stanza_type: str | None = None
|
|
356
|
+
offline: bool = False
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
@dataclass(frozen=True, slots=True)
|
|
360
|
+
class WaIncomingMessageKey:
|
|
361
|
+
"""A received message's key plus addressing metadata (mirrors TS)."""
|
|
362
|
+
|
|
363
|
+
remote_jid: str
|
|
364
|
+
id: str | None = None
|
|
365
|
+
from_me: bool | None = None
|
|
366
|
+
participant: str | None = None
|
|
367
|
+
is_group: bool = False
|
|
368
|
+
is_broadcast: bool = False
|
|
369
|
+
is_newsletter: bool = False
|
|
370
|
+
remote_jid_alt: str | None = None
|
|
371
|
+
participant_alt: str | None = None
|
|
372
|
+
sender_device: int = 0
|
|
373
|
+
sender_username: str | None = None
|
|
374
|
+
recipient_jid: str | None = None
|
|
375
|
+
recipient_alt: str | None = None
|
|
376
|
+
recipient_username: str | None = None
|
|
377
|
+
server_id: int | None = None
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
@dataclass(frozen=True, slots=True)
|
|
381
|
+
class WaIncomingMessageEvent:
|
|
382
|
+
"""A decrypted inbound ``<message>`` stanza (mirrors TS)."""
|
|
383
|
+
|
|
384
|
+
key: WaIncomingMessageKey
|
|
385
|
+
raw_node: BinaryNode
|
|
386
|
+
message: Any | None = None
|
|
387
|
+
timestamp_seconds: int | None = None
|
|
388
|
+
expiration_seconds: int | None = None
|
|
389
|
+
push_name: str | None = None
|
|
390
|
+
stanza_id: str | None = None
|
|
391
|
+
offline: bool = False
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
@dataclass(frozen=True, slots=True)
|
|
395
|
+
class WaOutgoingMessageEvent:
|
|
396
|
+
"""An outbound message with its decrypted proto (mirrors TS)."""
|
|
397
|
+
|
|
398
|
+
to: str
|
|
399
|
+
message: Any
|
|
400
|
+
id: str | None = None
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
@dataclass(frozen=True, slots=True)
|
|
404
|
+
class WaIncomingProtocolMessageEvent(WaIncomingMessageEvent):
|
|
405
|
+
"""An inbound message carrying a decoded ``protocolMessage``."""
|
|
406
|
+
|
|
407
|
+
protocol_message: Any = None
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
WaReceiptStatus = Literal["delivered", "read", "played", "inactive"]
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
@dataclass(frozen=True, slots=True)
|
|
414
|
+
class WaIncomingReceiptEvent(WaIncomingBaseEvent):
|
|
415
|
+
"""Inbound ``<receipt>`` for an outgoing message."""
|
|
416
|
+
|
|
417
|
+
status: WaReceiptStatus = "delivered"
|
|
418
|
+
from_self_device: bool = False
|
|
419
|
+
participant_jid: str | None = None
|
|
420
|
+
participant_username: str | None = None
|
|
421
|
+
recipient_jid: str | None = None
|
|
422
|
+
message_ids: tuple[str, ...] = ()
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
@dataclass(frozen=True, slots=True)
|
|
426
|
+
class WaIncomingPresenceEvent(WaIncomingBaseEvent):
|
|
427
|
+
"""Peer presence (mirrors ``WaIncomingPresenceEvent``)."""
|
|
428
|
+
|
|
429
|
+
type: str = "unavailable"
|
|
430
|
+
last_seen: Any | None = None
|
|
431
|
+
group_online_count: int | None = None
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
@dataclass(frozen=True, slots=True)
|
|
435
|
+
class WaIncomingChatstateEvent(WaIncomingBaseEvent):
|
|
436
|
+
"""Peer chatstate, e.g. typing / recording (mirrors TS)."""
|
|
437
|
+
|
|
438
|
+
state: str = "paused"
|
|
439
|
+
media: str | None = None
|
|
440
|
+
participant_jid: str | None = None
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
@dataclass(frozen=True, slots=True)
|
|
444
|
+
class WaIncomingCallEvent(WaIncomingBaseEvent):
|
|
445
|
+
"""Incoming call signaling (mirrors ``WaIncomingCallEvent``)."""
|
|
446
|
+
|
|
447
|
+
type: str = "unknown"
|
|
448
|
+
payload_tag: str | None = None
|
|
449
|
+
call_id: str | None = None
|
|
450
|
+
call_creator_jid: str | None = None
|
|
451
|
+
sender_lid_jid: str | None = None
|
|
452
|
+
caller_pn_jid: str | None = None
|
|
453
|
+
group_jid: str | None = None
|
|
454
|
+
is_video: bool = False
|
|
455
|
+
caller_username: str | None = None
|
|
456
|
+
caller_country_code: str | None = None
|
|
457
|
+
caller_push_name: str | None = None
|
|
458
|
+
peer_platform: str | None = None
|
|
459
|
+
peer_app_version: str | None = None
|
|
460
|
+
timestamp_seconds: int | None = None
|
|
461
|
+
end_timestamp_seconds: int | None = None
|
|
462
|
+
silence_reason: str | None = None
|
|
463
|
+
group_info: tuple[Any, ...] = ()
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
@dataclass(frozen=True, slots=True)
|
|
467
|
+
class WaIncomingNotificationEvent(WaIncomingBaseEvent):
|
|
468
|
+
"""Debug mirror of an inbound ``<notification>`` stanza."""
|
|
469
|
+
|
|
470
|
+
notification_type: str | None = None
|
|
471
|
+
classification: str | None = None
|
|
472
|
+
details: dict[str, Any] | None = None
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
@dataclass(frozen=True, slots=True)
|
|
476
|
+
class WaMexNotificationEvent(WaIncomingBaseEvent):
|
|
477
|
+
"""MEX (GraphQL-over-noise) push notification (mirrors TS)."""
|
|
478
|
+
|
|
479
|
+
operation_name: str = "MexNotificationEvent"
|
|
480
|
+
kind: str = "unknown"
|
|
481
|
+
errors: tuple[Any, ...] = ()
|
|
482
|
+
data: Any | None = None
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
@dataclass(frozen=True, slots=True)
|
|
486
|
+
class WaRegistrationCodeEvent(WaIncomingBaseEvent):
|
|
487
|
+
"""SMS/voice verification code prompt (mobile flow only)."""
|
|
488
|
+
|
|
489
|
+
code: str = ""
|
|
490
|
+
expiry_timestamp_ms: int = 0
|
|
491
|
+
from_device_id: str = ""
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
@dataclass(frozen=True, slots=True)
|
|
495
|
+
class WaAccountTakeoverNoticeEvent(WaIncomingBaseEvent):
|
|
496
|
+
"""Account-takeover warning during mobile registration."""
|
|
497
|
+
|
|
498
|
+
server_token: str = ""
|
|
499
|
+
attempt_timestamp_ms: int = 0
|
|
500
|
+
new_device_name: str | None = None
|
|
501
|
+
new_device_platform: str | None = None
|
|
502
|
+
new_device_app_version: str | None = None
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
WaAddonKind = Literal[
|
|
506
|
+
"reaction",
|
|
507
|
+
"poll_vote",
|
|
508
|
+
"event_response",
|
|
509
|
+
"comment",
|
|
510
|
+
"message_edit",
|
|
511
|
+
"event_edit",
|
|
512
|
+
"poll_edit",
|
|
513
|
+
"poll_add_option",
|
|
514
|
+
]
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
@dataclass(frozen=True, slots=True)
|
|
518
|
+
class WaIncomingAddonEvent:
|
|
519
|
+
"""A decrypted addon attached to a previous message."""
|
|
520
|
+
|
|
521
|
+
key: WaIncomingMessageKey
|
|
522
|
+
raw_node: BinaryNode
|
|
523
|
+
kind: WaAddonKind = "reaction"
|
|
524
|
+
target_message_id: str = ""
|
|
525
|
+
decrypted: Any | None = None
|
|
526
|
+
raw: Any | None = None
|
|
527
|
+
stanza_id: str | None = None
|
|
528
|
+
offline: bool = False
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
@dataclass(frozen=True, slots=True)
|
|
532
|
+
class WaIncomingBotChunkEvent:
|
|
533
|
+
"""A streaming bot (Meta-AI) reply piece."""
|
|
534
|
+
|
|
535
|
+
key: WaIncomingMessageKey
|
|
536
|
+
raw_node: BinaryNode
|
|
537
|
+
target_message_id: str = ""
|
|
538
|
+
edit_type: str = "full"
|
|
539
|
+
edit_target_id: str | None = None
|
|
540
|
+
salt_id: str = ""
|
|
541
|
+
plaintext: bytes = b""
|
|
542
|
+
message: Any | None = None
|
|
543
|
+
raw: Any | None = None
|
|
544
|
+
stanza_id: str | None = None
|
|
545
|
+
offline: bool = False
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
@dataclass(frozen=True, slots=True)
|
|
549
|
+
class WaIncomingFailureEvent(WaIncomingBaseEvent):
|
|
550
|
+
"""Fatal stream-level server error; the connection closes right after."""
|
|
551
|
+
|
|
552
|
+
failure_reason: int | None = None
|
|
553
|
+
failure_code: int | None = None
|
|
554
|
+
failure_message: str | None = None
|
|
555
|
+
failure_url: str | None = None
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
@dataclass(frozen=True, slots=True)
|
|
559
|
+
class WaIncomingUnhandledStanzaEvent(WaIncomingBaseEvent):
|
|
560
|
+
"""Inbound stanza with no registered handler."""
|
|
561
|
+
|
|
562
|
+
reason: str = ""
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
@dataclass(frozen=True, slots=True)
|
|
566
|
+
class WaIncomingDecryptedPayloadEvent(WaIncomingBaseEvent):
|
|
567
|
+
"""One decrypted ``<enc>`` payload, surfaced before decoding."""
|
|
568
|
+
|
|
569
|
+
enc_index: int = 0
|
|
570
|
+
enc_type: str = ""
|
|
571
|
+
plaintext: bytes = b""
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
WaUnavailableMessageKind = Literal["view_once", "sender_drop", "hosted", "bot", "other"]
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
@dataclass(frozen=True, slots=True)
|
|
578
|
+
class WaIncomingUnavailableMessageEvent:
|
|
579
|
+
"""A message the server delivered as a content-less placeholder."""
|
|
580
|
+
|
|
581
|
+
key: WaIncomingMessageKey
|
|
582
|
+
raw_node: BinaryNode
|
|
583
|
+
kind: WaUnavailableMessageKind = "other"
|
|
584
|
+
resend_requested: bool = False
|
|
585
|
+
timestamp_seconds: int | None = None
|
|
586
|
+
push_name: str | None = None
|
|
587
|
+
stanza_id: str | None = None
|
|
588
|
+
offline: bool = False
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
@dataclass(frozen=True, slots=True)
|
|
592
|
+
class WaIncomingErrorStanzaEvent(WaIncomingBaseEvent):
|
|
593
|
+
"""Server-sent error on a specific outgoing stanza."""
|
|
594
|
+
|
|
595
|
+
code: int | None = None
|
|
596
|
+
text: str | None = None
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
@dataclass(frozen=True, slots=True)
|
|
600
|
+
class WaIncomingNewsletterMessageUpdateEvent(WaIncomingBaseEvent):
|
|
601
|
+
"""Newsletter message update: edit, react, view-count, poll-vote changes."""
|
|
602
|
+
|
|
603
|
+
timestamp_seconds: int | None = None
|
|
604
|
+
parent_message_server_id: int | None = None
|
|
605
|
+
update: Any | None = None
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
WaNewsletterMessageUpdate = dict[str, Any]
|
|
609
|
+
|
|
610
|
+
WaNewsletterEventAction = Literal[
|
|
611
|
+
"subscribers_count_change",
|
|
612
|
+
"live_updates",
|
|
613
|
+
"membership_revoke",
|
|
614
|
+
"admin_metadata_update",
|
|
615
|
+
"unknown",
|
|
616
|
+
]
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
@dataclass(frozen=True, slots=True)
|
|
620
|
+
class WaIncomingNewsletterEvent(WaIncomingBaseEvent):
|
|
621
|
+
"""A newsletter (channel) event."""
|
|
622
|
+
|
|
623
|
+
newsletter_jid: str = ""
|
|
624
|
+
action: WaNewsletterEventAction = "unknown"
|
|
625
|
+
sub_type: str | None = None
|
|
626
|
+
details: dict[str, Any] | None = None
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
WaGroupEventAction = Literal[
|
|
630
|
+
"create",
|
|
631
|
+
"add",
|
|
632
|
+
"delete",
|
|
633
|
+
"remove",
|
|
634
|
+
"promote",
|
|
635
|
+
"demote",
|
|
636
|
+
"linked_group_promote",
|
|
637
|
+
"linked_group_demote",
|
|
638
|
+
"modify",
|
|
639
|
+
"subject",
|
|
640
|
+
"description",
|
|
641
|
+
"restrict",
|
|
642
|
+
"announce",
|
|
643
|
+
"no_frequently_forwarded",
|
|
644
|
+
"invite",
|
|
645
|
+
"ephemeral",
|
|
646
|
+
"revoke_invite",
|
|
647
|
+
"suspend",
|
|
648
|
+
"growth_locked",
|
|
649
|
+
"growth_unlocked",
|
|
650
|
+
"link",
|
|
651
|
+
"unlink",
|
|
652
|
+
"membership_approval_mode",
|
|
653
|
+
"membership_approval_request",
|
|
654
|
+
"created_membership_requests",
|
|
655
|
+
"revoked_membership_requests",
|
|
656
|
+
"allow_non_admin_sub_group_creation",
|
|
657
|
+
"allow_admin_reports",
|
|
658
|
+
"admin_reports",
|
|
659
|
+
"created_sub_group_suggestion",
|
|
660
|
+
"revoked_sub_group_suggestions",
|
|
661
|
+
"change_number",
|
|
662
|
+
"member_add_mode",
|
|
663
|
+
"auto_add_disabled",
|
|
664
|
+
"is_capi_hosted_group",
|
|
665
|
+
"group_safety_check",
|
|
666
|
+
"limit_sharing_enabled",
|
|
667
|
+
"missing_participant_identification",
|
|
668
|
+
]
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
@dataclass(frozen=True, slots=True)
|
|
672
|
+
class WaGroupEvent(WaIncomingBaseEvent):
|
|
673
|
+
"""Group lifecycle event (mirrors ``WaGroupEvent``)."""
|
|
674
|
+
|
|
675
|
+
raw_action_node: BinaryNode | None = None
|
|
676
|
+
group_jid: str | None = None
|
|
677
|
+
author_jid: str | None = None
|
|
678
|
+
timestamp_seconds: int | None = None
|
|
679
|
+
action: str = "modify"
|
|
680
|
+
participants: tuple[Any, ...] = ()
|
|
681
|
+
linked_groups: tuple[Any, ...] = ()
|
|
682
|
+
membership_requests: tuple[Any, ...] = ()
|
|
683
|
+
subgroup_suggestions: tuple[Any, ...] = ()
|
|
684
|
+
context_group_jid: str | None = None
|
|
685
|
+
request_method: str | None = None
|
|
686
|
+
subject: str | None = None
|
|
687
|
+
subject_owner_jid: str | None = None
|
|
688
|
+
description: str | None = None
|
|
689
|
+
description_id: str | None = None
|
|
690
|
+
code: str | None = None
|
|
691
|
+
expiration_seconds: int | None = None
|
|
692
|
+
mode: str | None = None
|
|
693
|
+
enabled: bool | None = None
|
|
694
|
+
reason: str | None = None
|
|
695
|
+
details: dict[str, Any] | None = None
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
@dataclass(frozen=True, slots=True)
|
|
699
|
+
class WaBusinessEvent(WaIncomingBaseEvent):
|
|
700
|
+
"""Business profile change (mirrors ``WaBusinessEvent``)."""
|
|
701
|
+
|
|
702
|
+
action: str = "profile_update"
|
|
703
|
+
timestamp_seconds: int | None = None
|
|
704
|
+
biz_jid: str | None = None
|
|
705
|
+
biz_hash: str | None = None
|
|
706
|
+
verified_name: Any | None = None
|
|
707
|
+
product_ids: tuple[str, ...] = ()
|
|
708
|
+
collections: tuple[Any, ...] = ()
|
|
709
|
+
subscriptions: tuple[Any, ...] = ()
|
|
710
|
+
feature_flags: tuple[Any, ...] = ()
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
@dataclass(frozen=True, slots=True)
|
|
714
|
+
class WaPictureEvent(WaIncomingBaseEvent):
|
|
715
|
+
"""Profile/group/community picture change notification."""
|
|
716
|
+
|
|
717
|
+
action: str = "set"
|
|
718
|
+
target_jid: str | None = None
|
|
719
|
+
author_jid: str | None = None
|
|
720
|
+
timestamp_seconds: int | None = None
|
|
721
|
+
picture_id: int | None = None
|
|
722
|
+
contact_hash: str | None = None
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
@dataclass(frozen=True, slots=True)
|
|
726
|
+
class WaOwnUsernameNotificationEvent(WaIncomingBaseEvent):
|
|
727
|
+
"""The account's own username changed on another device."""
|
|
728
|
+
|
|
729
|
+
kind: str = "modify"
|
|
730
|
+
username: str | None = None
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
WaAppStateMutationSource = Literal["snapshot", "patch", "local"]
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
@dataclass(frozen=True, slots=True)
|
|
737
|
+
class WaAppStateMutationEvent:
|
|
738
|
+
"""A parsed app-state mutation (sibling app-state layer owns the union).
|
|
739
|
+
|
|
740
|
+
The large TS discriminated union over every collection schema is
|
|
741
|
+
represented here as a flat record; the sibling layer refines it.
|
|
742
|
+
"""
|
|
743
|
+
|
|
744
|
+
source: WaAppStateMutationSource = "patch"
|
|
745
|
+
schema: str = ""
|
|
746
|
+
operation: str = "set"
|
|
747
|
+
collection: str = ""
|
|
748
|
+
version: int = 0
|
|
749
|
+
timestamp: int = 0
|
|
750
|
+
details: dict[str, Any] = field(default_factory=dict)
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
@dataclass(frozen=True, slots=True)
|
|
754
|
+
class WaAppStateMessageKey:
|
|
755
|
+
"""Message key shape used in app-state events (mirrors TS)."""
|
|
756
|
+
|
|
757
|
+
chat_jid: str = ""
|
|
758
|
+
id: str = ""
|
|
759
|
+
from_me: bool = False
|
|
760
|
+
participant_jid: str | None = None
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
@dataclass(frozen=True, slots=True)
|
|
764
|
+
class WaGroupHistoryBundleEvent:
|
|
765
|
+
"""A processed group-history bundle shared after joining a group."""
|
|
766
|
+
|
|
767
|
+
group_jid: str = ""
|
|
768
|
+
sender_jid: str | None = None
|
|
769
|
+
bundle_message_id: str | None = None
|
|
770
|
+
messages_count: int = 0
|
|
771
|
+
out_of_window_pins_count: int = 0
|
|
772
|
+
dropped_count: int = 0
|
|
773
|
+
oldest_timestamp_ms: int | None = None
|
|
774
|
+
history_receivers: tuple[str, ...] = ()
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
@dataclass(frozen=True, slots=True)
|
|
778
|
+
class WaOfflineResumeEvent:
|
|
779
|
+
"""Offline-message queue progress after a reconnect."""
|
|
780
|
+
|
|
781
|
+
status: Literal["resuming", "complete"] = "complete"
|
|
782
|
+
total_stanzas: int = 0
|
|
783
|
+
remaining_stanzas: int = 0
|
|
784
|
+
forced: bool = False
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
@dataclass(frozen=True, slots=True)
|
|
788
|
+
class WaOfflineThreadMetadataEvent:
|
|
789
|
+
"""Preview manifest of the offline queue, sent before the flush."""
|
|
790
|
+
|
|
791
|
+
threads: tuple[Any, ...] = ()
|
|
792
|
+
read_watermarks: tuple[Any, ...] | None = None
|
|
793
|
+
pending_status_messages: dict[str, Any] | None = None
|
|
794
|
+
pending_notifications: dict[str, Any] | None = None
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
@dataclass(frozen=True, slots=True)
|
|
798
|
+
class WaPrivacyTokenUpdateEvent:
|
|
799
|
+
"""Trusted-contact-token cache update (``debug_privacy_token``)."""
|
|
800
|
+
|
|
801
|
+
jid: str = ""
|
|
802
|
+
timestamp_s: int = 0
|
|
803
|
+
type: str = ""
|
|
804
|
+
source: Literal["notification", "history_sync"] = "notification"
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
@dataclass(frozen=True, slots=True)
|
|
808
|
+
class WaConnectionEvent:
|
|
809
|
+
"""Connection-state transition (mirrors ``WaConnectionEvent``)."""
|
|
810
|
+
|
|
811
|
+
status: Literal["open", "close"] = "close"
|
|
812
|
+
reason: str = "client_disconnected"
|
|
813
|
+
code: str | int | None = None
|
|
814
|
+
is_logout: bool = False
|
|
815
|
+
is_new_login: bool = False
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
WaClientEventName = Literal[
|
|
819
|
+
"auth_qr",
|
|
820
|
+
"auth_pairing_code",
|
|
821
|
+
"auth_pairing_required",
|
|
822
|
+
"auth_paired",
|
|
823
|
+
"auth_passkey_required",
|
|
824
|
+
"connection",
|
|
825
|
+
"message",
|
|
826
|
+
"message_send",
|
|
827
|
+
"message_addon",
|
|
828
|
+
"message_bot_chunk",
|
|
829
|
+
"message_protocol",
|
|
830
|
+
"message_unavailable",
|
|
831
|
+
"receipt",
|
|
832
|
+
"newsletter",
|
|
833
|
+
"newsletter_message_update",
|
|
834
|
+
"presence",
|
|
835
|
+
"chatstate",
|
|
836
|
+
"call",
|
|
837
|
+
"mex_notification",
|
|
838
|
+
"group",
|
|
839
|
+
"business",
|
|
840
|
+
"picture",
|
|
841
|
+
"privacy",
|
|
842
|
+
"blocklist",
|
|
843
|
+
"own_username",
|
|
844
|
+
"mutation",
|
|
845
|
+
"mutation_send",
|
|
846
|
+
"history_sync_chunk",
|
|
847
|
+
"group_history_bundle",
|
|
848
|
+
"offline_resume",
|
|
849
|
+
"offline_thread_metadata",
|
|
850
|
+
"stream_failure",
|
|
851
|
+
"stanza_error",
|
|
852
|
+
"mobile_registration_code",
|
|
853
|
+
"mobile_account_takeover_notice",
|
|
854
|
+
"companion_host_linked",
|
|
855
|
+
"companion_host_revoked",
|
|
856
|
+
"companion_host_error",
|
|
857
|
+
"debug_connection_success",
|
|
858
|
+
"debug_notification",
|
|
859
|
+
"debug_privacy_token",
|
|
860
|
+
"debug_client_error",
|
|
861
|
+
"debug_unhandled_stanza",
|
|
862
|
+
"debug_decrypted_payload",
|
|
863
|
+
"debug_transport_frame_in",
|
|
864
|
+
"debug_transport_frame_out",
|
|
865
|
+
"debug_transport_node_in",
|
|
866
|
+
"debug_transport_node_out",
|
|
867
|
+
"debug_transport_decode_error",
|
|
868
|
+
]
|
|
869
|
+
|
|
870
|
+
WA_CLIENT_EVENT_NAMES: tuple[WaClientEventName, ...] = (
|
|
871
|
+
"auth_qr",
|
|
872
|
+
"auth_pairing_code",
|
|
873
|
+
"auth_pairing_required",
|
|
874
|
+
"auth_paired",
|
|
875
|
+
"auth_passkey_required",
|
|
876
|
+
"connection",
|
|
877
|
+
"message",
|
|
878
|
+
"message_send",
|
|
879
|
+
"message_addon",
|
|
880
|
+
"message_bot_chunk",
|
|
881
|
+
"message_protocol",
|
|
882
|
+
"message_unavailable",
|
|
883
|
+
"receipt",
|
|
884
|
+
"newsletter",
|
|
885
|
+
"newsletter_message_update",
|
|
886
|
+
"presence",
|
|
887
|
+
"chatstate",
|
|
888
|
+
"call",
|
|
889
|
+
"mex_notification",
|
|
890
|
+
"group",
|
|
891
|
+
"business",
|
|
892
|
+
"picture",
|
|
893
|
+
"privacy",
|
|
894
|
+
"blocklist",
|
|
895
|
+
"own_username",
|
|
896
|
+
"mutation",
|
|
897
|
+
"mutation_send",
|
|
898
|
+
"history_sync_chunk",
|
|
899
|
+
"group_history_bundle",
|
|
900
|
+
"offline_resume",
|
|
901
|
+
"offline_thread_metadata",
|
|
902
|
+
"stream_failure",
|
|
903
|
+
"stanza_error",
|
|
904
|
+
"mobile_registration_code",
|
|
905
|
+
"mobile_account_takeover_notice",
|
|
906
|
+
"companion_host_linked",
|
|
907
|
+
"companion_host_revoked",
|
|
908
|
+
"companion_host_error",
|
|
909
|
+
"debug_connection_success",
|
|
910
|
+
"debug_notification",
|
|
911
|
+
"debug_privacy_token",
|
|
912
|
+
"debug_client_error",
|
|
913
|
+
"debug_unhandled_stanza",
|
|
914
|
+
"debug_decrypted_payload",
|
|
915
|
+
"debug_transport_frame_in",
|
|
916
|
+
"debug_transport_frame_out",
|
|
917
|
+
"debug_transport_node_in",
|
|
918
|
+
"debug_transport_node_out",
|
|
919
|
+
"debug_transport_decode_error",
|
|
920
|
+
)
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
@dataclass(frozen=True, slots=True)
|
|
924
|
+
class WaSendMessageOptions:
|
|
925
|
+
"""Per-send overrides (mirrors ``WaSendMessageOptions``).
|
|
926
|
+
|
|
927
|
+
Context-info shapes (quote, mentions, disappearing mode, ...) belong to
|
|
928
|
+
the sibling message layer and are :data:`Any` here.
|
|
929
|
+
"""
|
|
930
|
+
|
|
931
|
+
id: str | None = None
|
|
932
|
+
expected_identity: bytes | None = None
|
|
933
|
+
context_info: Any | None = None
|
|
934
|
+
quote: Any | None = None
|
|
935
|
+
forward: bool | dict[str, Any] | None = None
|
|
936
|
+
mentions: tuple[str, ...] | None = None
|
|
937
|
+
expiration_seconds: int | None = None
|
|
938
|
+
ephemeral_setting_timestamp: int | None = None
|
|
939
|
+
disappearing_mode_trigger: Any | None = None
|
|
940
|
+
disable_group_ephemeral_auto_inject: bool = False
|
|
941
|
+
disable_direct_ephemeral_auto_inject: bool = False
|
|
942
|
+
custom_nodes: tuple[BinaryNode, ...] | None = None
|
|
943
|
+
view_once: bool = False
|
|
944
|
+
edit_key: Any | None = None
|
|
945
|
+
message_secret: bytes | None = None
|
|
946
|
+
additional_attributes: dict[str, str] | None = None
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
WaPrivacyAccountSyncResult = dict[str, Any]
|
|
950
|
+
"""Privacy account-sync refresh result (sibling privacy coordinator owns it)."""
|
|
951
|
+
|
|
952
|
+
WaBlocklistResult = dict[str, Any]
|
|
953
|
+
"""Account blocklist (sibling privacy coordinator owns it)."""
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
@dataclass(frozen=True, slots=True)
|
|
957
|
+
class WaClearChatOptions:
|
|
958
|
+
"""Options for clearing a chat."""
|
|
959
|
+
|
|
960
|
+
delete_starred: bool | None = None
|
|
961
|
+
delete_media: bool | None = None
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
@dataclass(frozen=True, slots=True)
|
|
965
|
+
class WaDeleteChatOptions:
|
|
966
|
+
"""Options for deleting a chat."""
|
|
967
|
+
|
|
968
|
+
delete_media: bool | None = None
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
@dataclass(frozen=True, slots=True)
|
|
972
|
+
class WaDeleteMessageForMeOptions:
|
|
973
|
+
"""Options for delete-for-me."""
|
|
974
|
+
|
|
975
|
+
delete_media: bool | None = None
|
|
976
|
+
message_timestamp_ms: int | None = None
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
@dataclass(frozen=True, slots=True)
|
|
980
|
+
class WaDownloadMediaOptions:
|
|
981
|
+
"""Options for media download."""
|
|
982
|
+
|
|
983
|
+
max_bytes: int | None = None
|
|
984
|
+
timeout_ms: float | None = None
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
# Re-exported for callers that only import this module.
|
|
988
|
+
__all__ += ["WaAuthCredentials", "WaStore", "BinaryNode"]
|