shellzapy 0.1.0__tar.gz
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/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
- shellzapy-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- shellzapy-0.1.0/.github/pull_request_template.md +14 -0
- shellzapy-0.1.0/.github/workflows/ci.yml +78 -0
- shellzapy-0.1.0/.github/workflows/docs.yml +51 -0
- shellzapy-0.1.0/.github/workflows/release.yml +31 -0
- shellzapy-0.1.0/.gitignore +30 -0
- shellzapy-0.1.0/.python-version +1 -0
- shellzapy-0.1.0/AGENTS.md +192 -0
- shellzapy-0.1.0/CHANGELOG.md +19 -0
- shellzapy-0.1.0/CONTRIBUTING.md +33 -0
- shellzapy-0.1.0/LICENSE +21 -0
- shellzapy-0.1.0/Makefile +2 -0
- shellzapy-0.1.0/NOTICE +9 -0
- shellzapy-0.1.0/PKG-INFO +112 -0
- shellzapy-0.1.0/README.md +91 -0
- shellzapy-0.1.0/SECURITY.md +26 -0
- shellzapy-0.1.0/docs/api/client.md +48 -0
- shellzapy-0.1.0/docs/api/errors.md +24 -0
- shellzapy-0.1.0/docs/api/events.md +49 -0
- shellzapy-0.1.0/docs/api/stores.md +16 -0
- shellzapy-0.1.0/docs/authentication.md +63 -0
- shellzapy-0.1.0/docs/events.md +44 -0
- shellzapy-0.1.0/docs/index.md +46 -0
- shellzapy-0.1.0/docs/media.md +38 -0
- shellzapy-0.1.0/docs/messages.md +63 -0
- shellzapy-0.1.0/docs/quickstart.md +56 -0
- shellzapy-0.1.0/docs/stores.md +32 -0
- shellzapy-0.1.0/examples/echo_bot.py +94 -0
- shellzapy-0.1.0/examples/llm_agent.py +140 -0
- shellzapy-0.1.0/examples/multi_session.py +126 -0
- shellzapy-0.1.0/mkdocs.yml +52 -0
- shellzapy-0.1.0/pyproject.toml +72 -0
- shellzapy-0.1.0/scripts/gen_abprops.py +166 -0
- shellzapy-0.1.0/scripts/gen_proto.py +172 -0
- shellzapy-0.1.0/scripts/gen_tokens.py +133 -0
- shellzapy-0.1.0/spec/README.md +19 -0
- shellzapy-0.1.0/spec/proto/WAProto.proto +9478 -0
- shellzapy-0.1.0/spec/purpose.md +63 -0
- shellzapy-0.1.0/spec/version/version.json +3 -0
- shellzapy-0.1.0/tests/_appstate/test_appstate.py +32 -0
- shellzapy-0.1.0/tests/_appstate/test_appstate_crypto.py +176 -0
- shellzapy-0.1.0/tests/_appstate/test_appstate_encoding.py +54 -0
- shellzapy-0.1.0/tests/_appstate/test_appstate_sync.py +650 -0
- shellzapy-0.1.0/tests/_appstate/test_response_parser.py +103 -0
- shellzapy-0.1.0/tests/_auth/pairing/test_companion_host.py +207 -0
- shellzapy-0.1.0/tests/_auth/pairing/test_pairing_code_crypto.py +114 -0
- shellzapy-0.1.0/tests/_auth/pairing/test_pairing_flow.py +506 -0
- shellzapy-0.1.0/tests/_auth/pairing/test_qr_flow.py +70 -0
- shellzapy-0.1.0/tests/_auth/pairing/test_shortcake_crypto.py +107 -0
- shellzapy-0.1.0/tests/_auth/pairing/test_shortcake_flow.py +215 -0
- shellzapy-0.1.0/tests/_auth/test_auth_client.py +139 -0
- shellzapy-0.1.0/tests/_auth/test_credentials_flow.py +209 -0
- shellzapy-0.1.0/tests/_auth/test_pairing_integration.py +277 -0
- shellzapy-0.1.0/tests/_client/test_app_state_mutation.py +615 -0
- shellzapy-0.1.0/tests/_client/test_bot.py +678 -0
- shellzapy-0.1.0/tests/_client/test_builders_connection.py +385 -0
- shellzapy-0.1.0/tests/_client/test_builders_extended.py +924 -0
- shellzapy-0.1.0/tests/_client/test_client.py +220 -0
- shellzapy-0.1.0/tests/_client/test_connection_pair_restart.py +344 -0
- shellzapy-0.1.0/tests/_client/test_connection_receipt_queue.py +145 -0
- shellzapy-0.1.0/tests/_client/test_coordinator_ab_props.py +119 -0
- shellzapy-0.1.0/tests/_client/test_coordinator_broadcast_list.py +121 -0
- shellzapy-0.1.0/tests/_client/test_coordinator_business.py +233 -0
- shellzapy-0.1.0/tests/_client/test_coordinator_email.py +142 -0
- shellzapy-0.1.0/tests/_client/test_coordinator_low_level.py +141 -0
- shellzapy-0.1.0/tests/_client/test_coordinator_newsletter.py +63 -0
- shellzapy-0.1.0/tests/_client/test_coordinator_offline_resume.py +242 -0
- shellzapy-0.1.0/tests/_client/test_coordinator_presence.py +96 -0
- shellzapy-0.1.0/tests/_client/test_coordinator_status.py +150 -0
- shellzapy-0.1.0/tests/_client/test_coordinator_stream_control.py +159 -0
- shellzapy-0.1.0/tests/_client/test_ephemeral_setting.py +315 -0
- shellzapy-0.1.0/tests/_client/test_events.py +1707 -0
- shellzapy-0.1.0/tests/_client/test_group_builders.py +260 -0
- shellzapy-0.1.0/tests/_client/test_group_coordinator.py +790 -0
- shellzapy-0.1.0/tests/_client/test_group_history.py +207 -0
- shellzapy-0.1.0/tests/_client/test_group_history_send.py +344 -0
- shellzapy-0.1.0/tests/_client/test_history_sync.py +248 -0
- shellzapy-0.1.0/tests/_client/test_incoming_node_coordinator.py +367 -0
- shellzapy-0.1.0/tests/_client/test_mailbox.py +250 -0
- shellzapy-0.1.0/tests/_client/test_media.py +276 -0
- shellzapy-0.1.0/tests/_client/test_message_coordinator.py +450 -0
- shellzapy-0.1.0/tests/_client/test_message_dispatch.py +561 -0
- shellzapy-0.1.0/tests/_client/test_newsletter_ops.py +567 -0
- shellzapy-0.1.0/tests/_client/test_newsletter_parse.py +222 -0
- shellzapy-0.1.0/tests/_client/test_passive_tasks.py +291 -0
- shellzapy-0.1.0/tests/_client/test_persistence_companion_host.py +53 -0
- shellzapy-0.1.0/tests/_client/test_plugins.py +188 -0
- shellzapy-0.1.0/tests/_client/test_privacy.py +667 -0
- shellzapy-0.1.0/tests/_client/test_profile_coordinator.py +1002 -0
- shellzapy-0.1.0/tests/_client/test_retry_builders.py +87 -0
- shellzapy-0.1.0/tests/_client/test_retry_coordinator.py +1017 -0
- shellzapy-0.1.0/tests/_client/test_tokens.py +49 -0
- shellzapy-0.1.0/tests/_client/test_trusted_contact_token.py +228 -0
- shellzapy-0.1.0/tests/_client/test_write_behind.py +224 -0
- shellzapy-0.1.0/tests/_crypto/core/test_core.py +207 -0
- shellzapy-0.1.0/tests/_crypto/core/test_xeddsa.py +55 -0
- shellzapy-0.1.0/tests/_crypto/curves/test_curves.py +93 -0
- shellzapy-0.1.0/tests/_crypto/math/test_fe_edwards.py +162 -0
- shellzapy-0.1.0/tests/_crypto/math/test_le_mod.py +38 -0
- shellzapy-0.1.0/tests/_crypto/test_barrel.py +12 -0
- shellzapy-0.1.0/tests/_crypto/test_native_backend.py +86 -0
- shellzapy-0.1.0/tests/_media/test_conn.py +99 -0
- shellzapy-0.1.0/tests/_media/test_container.py +108 -0
- shellzapy-0.1.0/tests/_media/test_media_crypto.py +299 -0
- shellzapy-0.1.0/tests/_media/test_media_messages.py +670 -0
- shellzapy-0.1.0/tests/_media/test_sticker_pack.py +98 -0
- shellzapy-0.1.0/tests/_media/test_transfer.py +182 -0
- shellzapy-0.1.0/tests/_message/test_context_info.py +618 -0
- shellzapy-0.1.0/tests/_message/test_link_preview_builder.py +95 -0
- shellzapy-0.1.0/tests/_message/test_link_preview_detect.py +64 -0
- shellzapy-0.1.0/tests/_message/test_link_preview_fetcher.py +372 -0
- shellzapy-0.1.0/tests/_message/test_message_client.py +347 -0
- shellzapy-0.1.0/tests/_message/test_message_crypto_addon.py +603 -0
- shellzapy-0.1.0/tests/_message/test_message_crypto_icdc.py +301 -0
- shellzapy-0.1.0/tests/_message/test_message_crypto_phash.py +86 -0
- shellzapy-0.1.0/tests/_message/test_message_crypto_reporting_token.py +151 -0
- shellzapy-0.1.0/tests/_message/test_message_encode_content.py +395 -0
- shellzapy-0.1.0/tests/_message/test_message_encode_media_payload.py +188 -0
- shellzapy-0.1.0/tests/_message/test_message_kinds.py +434 -0
- shellzapy-0.1.0/tests/_message/test_messaging_builders.py +196 -0
- shellzapy-0.1.0/tests/_message/test_messaging_companion_host.py +96 -0
- shellzapy-0.1.0/tests/_message/test_messaging_fanout.py +170 -0
- shellzapy-0.1.0/tests/_message/test_messaging_group_metadata.py +264 -0
- shellzapy-0.1.0/tests/_message/test_messaging_ignore_key.py +296 -0
- shellzapy-0.1.0/tests/_message/test_messaging_key_protocol.py +148 -0
- shellzapy-0.1.0/tests/_message/test_messaging_link_preview.py +256 -0
- shellzapy-0.1.0/tests/_message/test_messaging_messages.py +624 -0
- shellzapy-0.1.0/tests/_message/test_primitives.py +1953 -0
- shellzapy-0.1.0/tests/_retry/test_retry.py +415 -0
- shellzapy-0.1.0/tests/_retry/test_tracker.py +159 -0
- shellzapy-0.1.0/tests/_signal/test_attestation.py +140 -0
- shellzapy-0.1.0/tests/_signal/test_encoding.py +129 -0
- shellzapy-0.1.0/tests/_signal/test_registration.py +74 -0
- shellzapy-0.1.0/tests/_signal/test_sender_key.py +227 -0
- shellzapy-0.1.0/tests/_signal/test_session.py +531 -0
- shellzapy-0.1.0/tests/_signal/test_session_encoding.py +114 -0
- shellzapy-0.1.0/tests/_signal/test_session_resolver.py +460 -0
- shellzapy-0.1.0/tests/_signal/test_signal_api.py +2033 -0
- shellzapy-0.1.0/tests/_store/test_contracts.py +236 -0
- shellzapy-0.1.0/tests/_store/test_memory_directory.py +174 -0
- shellzapy-0.1.0/tests/_store/test_memory_keys.py +470 -0
- shellzapy-0.1.0/tests/_store/test_memory_messaging.py +116 -0
- shellzapy-0.1.0/tests/_store/test_store_infra.py +1468 -0
- shellzapy-0.1.0/tests/_transport/binary/test_codec.py +75 -0
- shellzapy-0.1.0/tests/_transport/binary/test_codec_golden.py +54 -0
- shellzapy-0.1.0/tests/_transport/keepalive/test_keepalive.py +263 -0
- shellzapy-0.1.0/tests/_transport/node/test_id_generators.py +57 -0
- shellzapy-0.1.0/tests/_transport/node/test_node.py +291 -0
- shellzapy-0.1.0/tests/_transport/node/test_transport.py +80 -0
- shellzapy-0.1.0/tests/_transport/noise/test_frame_codec.py +56 -0
- shellzapy-0.1.0/tests/_transport/noise/test_handshake.py +221 -0
- shellzapy-0.1.0/tests/_transport/noise/test_noise.py +220 -0
- shellzapy-0.1.0/tests/_transport/noise/test_noise_session.py +77 -0
- shellzapy-0.1.0/tests/_transport/test_node_integration.py +236 -0
- shellzapy-0.1.0/tests/_transport/test_wa_version_fetcher.py +81 -0
- shellzapy-0.1.0/tests/_util/test_bytes.py +55 -0
- shellzapy-0.1.0/tests/conftest.py +19 -0
- shellzapy-0.1.0/tests/test_client_facade.py +551 -0
- shellzapy-0.1.0/tests/test_facade_live.py +367 -0
- shellzapy-0.1.0/tests/test_init.py +7 -0
- shellzapy-0.1.0/tests/test_stores.py +762 -0
- shellzapy-0.1.0/tests/vectors/codec_golden.json +3435 -0
- shellzapy-0.1.0/tests/vectors/crypto.json +397 -0
- shellzapy-0.1.0/tests/vectors/noise_handshake.json +23 -0
- shellzapy-0.1.0/tools/fake_server_runner/run.mjs +111 -0
- shellzapy-0.1.0/tools/gen_vectors/crypto.mjs +365 -0
- shellzapy-0.1.0/tools/gen_vectors/noise_handshake.mjs +202 -0
- shellzapy-0.1.0/tools/gen_vectors/smoke.mjs +25 -0
- shellzapy-0.1.0/uv.lock +1215 -0
- shellzapy-0.1.0/wrangler.jsonc +8 -0
- shellzapy-0.1.0/zapy/__init__.py +58 -0
- shellzapy-0.1.0/zapy/_appstate/__init__.py +59 -0
- shellzapy-0.1.0/zapy/_appstate/constants.py +82 -0
- shellzapy-0.1.0/zapy/_appstate/crypto/__init__.py +17 -0
- shellzapy-0.1.0/zapy/_appstate/crypto/app_state_crypto.py +401 -0
- shellzapy-0.1.0/zapy/_appstate/parsers/__init__.py +23 -0
- shellzapy-0.1.0/zapy/_appstate/parsers/encoding.py +157 -0
- shellzapy-0.1.0/zapy/_appstate/parsers/response_parser.py +135 -0
- shellzapy-0.1.0/zapy/_appstate/sync/__init__.py +11 -0
- shellzapy-0.1.0/zapy/_appstate/sync/sync_client.py +1559 -0
- shellzapy-0.1.0/zapy/_appstate/types.py +137 -0
- shellzapy-0.1.0/zapy/_appstate/utils.py +100 -0
- shellzapy-0.1.0/zapy/_auth/__init__.py +3 -0
- shellzapy-0.1.0/zapy/_auth/auth_client.py +618 -0
- shellzapy-0.1.0/zapy/_auth/credentials_flow.py +290 -0
- shellzapy-0.1.0/zapy/_auth/pairing/__init__.py +3 -0
- shellzapy-0.1.0/zapy/_auth/pairing/companion_host.py +239 -0
- shellzapy-0.1.0/zapy/_auth/pairing/flow.py +808 -0
- shellzapy-0.1.0/zapy/_auth/pairing/pairing_code_crypto.py +143 -0
- shellzapy-0.1.0/zapy/_auth/pairing/qr_flow.py +123 -0
- shellzapy-0.1.0/zapy/_auth/pairing/shortcake_crypto.py +122 -0
- shellzapy-0.1.0/zapy/_auth/pairing/shortcake_flow.py +393 -0
- shellzapy-0.1.0/zapy/_auth/types.py +110 -0
- shellzapy-0.1.0/zapy/_client/__init__.py +26 -0
- shellzapy-0.1.0/zapy/_client/client.py +972 -0
- shellzapy-0.1.0/zapy/_client/connection/__init__.py +6 -0
- shellzapy-0.1.0/zapy/_client/connection/manager.py +525 -0
- shellzapy-0.1.0/zapy/_client/connection/receipt_queue.py +74 -0
- shellzapy-0.1.0/zapy/_client/coordinators/__init__.py +81 -0
- shellzapy-0.1.0/zapy/_client/coordinators/ab_props.py +260 -0
- shellzapy-0.1.0/zapy/_client/coordinators/app_state_mutation.py +2538 -0
- shellzapy-0.1.0/zapy/_client/coordinators/bot.py +830 -0
- shellzapy-0.1.0/zapy/_client/coordinators/broadcast_list.py +101 -0
- shellzapy-0.1.0/zapy/_client/coordinators/business.py +247 -0
- shellzapy-0.1.0/zapy/_client/coordinators/email.py +158 -0
- shellzapy-0.1.0/zapy/_client/coordinators/group.py +1478 -0
- shellzapy-0.1.0/zapy/_client/coordinators/incoming_node.py +758 -0
- shellzapy-0.1.0/zapy/_client/coordinators/low_level.py +119 -0
- shellzapy-0.1.0/zapy/_client/coordinators/message.py +1153 -0
- shellzapy-0.1.0/zapy/_client/coordinators/message_dispatch.py +1637 -0
- shellzapy-0.1.0/zapy/_client/coordinators/newsletter.py +110 -0
- shellzapy-0.1.0/zapy/_client/coordinators/offline_resume.py +271 -0
- shellzapy-0.1.0/zapy/_client/coordinators/passive_tasks.py +447 -0
- shellzapy-0.1.0/zapy/_client/coordinators/presence.py +103 -0
- shellzapy-0.1.0/zapy/_client/coordinators/privacy.py +623 -0
- shellzapy-0.1.0/zapy/_client/coordinators/profile.py +1024 -0
- shellzapy-0.1.0/zapy/_client/coordinators/retry.py +1878 -0
- shellzapy-0.1.0/zapy/_client/coordinators/status.py +132 -0
- shellzapy-0.1.0/zapy/_client/coordinators/stream_control.py +260 -0
- shellzapy-0.1.0/zapy/_client/coordinators/trusted_contact_token.py +417 -0
- shellzapy-0.1.0/zapy/_client/events/__init__.py +266 -0
- shellzapy-0.1.0/zapy/_client/events/abprops.py +58 -0
- shellzapy-0.1.0/zapy/_client/events/appstate_mutation.py +248 -0
- shellzapy-0.1.0/zapy/_client/events/business.py +565 -0
- shellzapy-0.1.0/zapy/_client/events/call.py +144 -0
- shellzapy-0.1.0/zapy/_client/events/chatstate.py +41 -0
- shellzapy-0.1.0/zapy/_client/events/devices.py +122 -0
- shellzapy-0.1.0/zapy/_client/events/dirty.py +384 -0
- shellzapy-0.1.0/zapy/_client/events/group.py +655 -0
- shellzapy-0.1.0/zapy/_client/events/identity.py +40 -0
- shellzapy-0.1.0/zapy/_client/events/incoming.py +1079 -0
- shellzapy-0.1.0/zapy/_client/events/mex_notification.py +317 -0
- shellzapy-0.1.0/zapy/_client/events/offline.py +123 -0
- shellzapy-0.1.0/zapy/_client/events/picture.py +67 -0
- shellzapy-0.1.0/zapy/_client/events/presence.py +74 -0
- shellzapy-0.1.0/zapy/_client/events/privacy.py +187 -0
- shellzapy-0.1.0/zapy/_client/events/privacy_token.py +72 -0
- shellzapy-0.1.0/zapy/_client/events/receipt.py +109 -0
- shellzapy-0.1.0/zapy/_client/events/registration.py +70 -0
- shellzapy-0.1.0/zapy/_client/events/username.py +76 -0
- shellzapy-0.1.0/zapy/_client/factory.py +2020 -0
- shellzapy-0.1.0/zapy/_client/media.py +829 -0
- shellzapy-0.1.0/zapy/_client/newsletter/__init__.py +90 -0
- shellzapy-0.1.0/zapy/_client/newsletter/admin.py +323 -0
- shellzapy-0.1.0/zapy/_client/newsletter/content.py +499 -0
- shellzapy-0.1.0/zapy/_client/newsletter/discovery.py +233 -0
- shellzapy-0.1.0/zapy/_client/newsletter/messaging.py +396 -0
- shellzapy-0.1.0/zapy/_client/newsletter/mex.py +99 -0
- shellzapy-0.1.0/zapy/_client/newsletter/parse.py +406 -0
- shellzapy-0.1.0/zapy/_client/newsletter/types.py +393 -0
- shellzapy-0.1.0/zapy/_client/persistence/__init__.py +89 -0
- shellzapy-0.1.0/zapy/_client/persistence/companion_host.py +133 -0
- shellzapy-0.1.0/zapy/_client/persistence/ephemeral_setting.py +245 -0
- shellzapy-0.1.0/zapy/_client/persistence/group_history.py +361 -0
- shellzapy-0.1.0/zapy/_client/persistence/history_blob.py +169 -0
- shellzapy-0.1.0/zapy/_client/persistence/history_sync.py +646 -0
- shellzapy-0.1.0/zapy/_client/persistence/mailbox.py +232 -0
- shellzapy-0.1.0/zapy/_client/persistence/write_behind_persistence.py +368 -0
- shellzapy-0.1.0/zapy/_client/plugins/__init__.py +23 -0
- shellzapy-0.1.0/zapy/_client/plugins/define.py +44 -0
- shellzapy-0.1.0/zapy/_client/plugins/install.py +254 -0
- shellzapy-0.1.0/zapy/_client/plugins/types.py +64 -0
- shellzapy-0.1.0/zapy/_client/tokens/__init__.py +21 -0
- shellzapy-0.1.0/zapy/_client/tokens/cs_token.py +47 -0
- shellzapy-0.1.0/zapy/_client/tokens/tc_token.py +43 -0
- shellzapy-0.1.0/zapy/_client/types.py +988 -0
- shellzapy-0.1.0/zapy/_crypto/__init__.py +65 -0
- shellzapy-0.1.0/zapy/_crypto/core/__init__.py +62 -0
- shellzapy-0.1.0/zapy/_crypto/core/hkdf.py +41 -0
- shellzapy-0.1.0/zapy/_crypto/core/keys.py +51 -0
- shellzapy-0.1.0/zapy/_crypto/core/nonce.py +25 -0
- shellzapy-0.1.0/zapy/_crypto/core/primitives.py +179 -0
- shellzapy-0.1.0/zapy/_crypto/core/random.py +32 -0
- shellzapy-0.1.0/zapy/_crypto/core/xeddsa.py +72 -0
- shellzapy-0.1.0/zapy/_crypto/curves/__init__.py +3 -0
- shellzapy-0.1.0/zapy/_crypto/curves/constants.py +10 -0
- shellzapy-0.1.0/zapy/_crypto/curves/ed25519.py +61 -0
- shellzapy-0.1.0/zapy/_crypto/curves/types.py +18 -0
- shellzapy-0.1.0/zapy/_crypto/curves/x25519.py +117 -0
- shellzapy-0.1.0/zapy/_crypto/math/__init__.py +3 -0
- shellzapy-0.1.0/zapy/_crypto/math/constants.py +35 -0
- shellzapy-0.1.0/zapy/_crypto/math/edwards.py +174 -0
- shellzapy-0.1.0/zapy/_crypto/math/fe.py +120 -0
- shellzapy-0.1.0/zapy/_crypto/math/le.py +13 -0
- shellzapy-0.1.0/zapy/_crypto/math/mod.py +15 -0
- shellzapy-0.1.0/zapy/_crypto/math/prime.py +11 -0
- shellzapy-0.1.0/zapy/_crypto/math/types.py +25 -0
- shellzapy-0.1.0/zapy/_crypto/native_backend.py +40 -0
- shellzapy-0.1.0/zapy/_infra/__init__.py +3 -0
- shellzapy-0.1.0/zapy/_infra/log.py +142 -0
- shellzapy-0.1.0/zapy/_infra/perf.py +77 -0
- shellzapy-0.1.0/zapy/_media/__init__.py +64 -0
- shellzapy-0.1.0/zapy/_media/constants.py +133 -0
- shellzapy-0.1.0/zapy/_media/container.py +110 -0
- shellzapy-0.1.0/zapy/_media/crypto/__init__.py +19 -0
- shellzapy-0.1.0/zapy/_media/crypto/crypto.py +633 -0
- shellzapy-0.1.0/zapy/_media/crypto/media_retry.py +107 -0
- shellzapy-0.1.0/zapy/_media/processor.py +100 -0
- shellzapy-0.1.0/zapy/_media/sticker/__init__.py +8 -0
- shellzapy-0.1.0/zapy/_media/sticker/pack.py +188 -0
- shellzapy-0.1.0/zapy/_media/transfer/__init__.py +15 -0
- shellzapy-0.1.0/zapy/_media/transfer/client.py +635 -0
- shellzapy-0.1.0/zapy/_media/transfer/conn.py +48 -0
- shellzapy-0.1.0/zapy/_media/types.py +169 -0
- shellzapy-0.1.0/zapy/_message/__init__.py +121 -0
- shellzapy-0.1.0/zapy/_message/addons/__init__.py +5 -0
- shellzapy-0.1.0/zapy/_message/addons/link_preview/__init__.py +54 -0
- shellzapy-0.1.0/zapy/_message/addons/link_preview/builder.py +56 -0
- shellzapy-0.1.0/zapy/_message/addons/link_preview/detect.py +72 -0
- shellzapy-0.1.0/zapy/_message/addons/link_preview/fetcher.py +553 -0
- shellzapy-0.1.0/zapy/_message/addons/link_preview/types.py +100 -0
- shellzapy-0.1.0/zapy/_message/client.py +486 -0
- shellzapy-0.1.0/zapy/_message/context_info.py +424 -0
- shellzapy-0.1.0/zapy/_message/crypto/__init__.py +71 -0
- shellzapy-0.1.0/zapy/_message/crypto/addon_crypto.py +656 -0
- shellzapy-0.1.0/zapy/_message/crypto/icdc.py +138 -0
- shellzapy-0.1.0/zapy/_message/crypto/phash.py +87 -0
- shellzapy-0.1.0/zapy/_message/crypto/reporting_token.py +498 -0
- shellzapy-0.1.0/zapy/_message/crypto/use_case_secret.py +113 -0
- shellzapy-0.1.0/zapy/_message/encode/__init__.py +84 -0
- shellzapy-0.1.0/zapy/_message/encode/content.py +636 -0
- shellzapy-0.1.0/zapy/_message/encode/device_sent.py +88 -0
- shellzapy-0.1.0/zapy/_message/encode/media_payload.py +122 -0
- shellzapy-0.1.0/zapy/_message/encode/padding.py +27 -0
- shellzapy-0.1.0/zapy/_message/kinds/__init__.py +1 -0
- shellzapy-0.1.0/zapy/_message/kinds/bot.py +179 -0
- shellzapy-0.1.0/zapy/_message/kinds/group_history.py +206 -0
- shellzapy-0.1.0/zapy/_message/kinds/newsletter.py +388 -0
- shellzapy-0.1.0/zapy/_message/kinds/sticker_pack.py +74 -0
- shellzapy-0.1.0/zapy/_message/messaging/__init__.py +336 -0
- shellzapy-0.1.0/zapy/_message/messaging/companion_host.py +117 -0
- shellzapy-0.1.0/zapy/_message/messaging/fanout.py +311 -0
- shellzapy-0.1.0/zapy/_message/messaging/group_metadata.py +444 -0
- shellzapy-0.1.0/zapy/_message/messaging/ignore_key.py +264 -0
- shellzapy-0.1.0/zapy/_message/messaging/key_protocol.py +217 -0
- shellzapy-0.1.0/zapy/_message/messaging/link_preview.py +448 -0
- shellzapy-0.1.0/zapy/_message/messaging/messages.py +1429 -0
- shellzapy-0.1.0/zapy/_message/primitives/__init__.py +1 -0
- shellzapy-0.1.0/zapy/_message/primitives/ack.py +232 -0
- shellzapy-0.1.0/zapy/_message/primitives/incoming.py +1141 -0
- shellzapy-0.1.0/zapy/_message/primitives/media_retry.py +451 -0
- shellzapy-0.1.0/zapy/_message/primitives/peer_data_operation.py +271 -0
- shellzapy-0.1.0/zapy/_message/types.py +434 -0
- shellzapy-0.1.0/zapy/_proto/WAProto_pb2.py +2584 -0
- shellzapy-0.1.0/zapy/_proto/__init__.py +1 -0
- shellzapy-0.1.0/zapy/_protocol/__init__.py +3 -0
- shellzapy-0.1.0/zapy/_protocol/abprops_spec.py +6216 -0
- shellzapy-0.1.0/zapy/_protocol/auth.py +17 -0
- shellzapy-0.1.0/zapy/_protocol/browser.py +57 -0
- shellzapy-0.1.0/zapy/_protocol/defaults.py +38 -0
- shellzapy-0.1.0/zapy/_protocol/device_identity.py +54 -0
- shellzapy-0.1.0/zapy/_protocol/jid.py +241 -0
- shellzapy-0.1.0/zapy/_protocol/message.py +127 -0
- shellzapy-0.1.0/zapy/_protocol/nodes.py +144 -0
- shellzapy-0.1.0/zapy/_protocol/notification.py +18 -0
- shellzapy-0.1.0/zapy/_retry/__init__.py +77 -0
- shellzapy-0.1.0/zapy/_retry/codec.py +209 -0
- shellzapy-0.1.0/zapy/_retry/constants.py +28 -0
- shellzapy-0.1.0/zapy/_retry/parse.py +132 -0
- shellzapy-0.1.0/zapy/_retry/reason.py +65 -0
- shellzapy-0.1.0/zapy/_retry/replay.py +483 -0
- shellzapy-0.1.0/zapy/_retry/tracker.py +161 -0
- shellzapy-0.1.0/zapy/_retry/types.py +122 -0
- shellzapy-0.1.0/zapy/_signal/__init__.py +171 -0
- shellzapy-0.1.0/zapy/_signal/api/__init__.py +133 -0
- shellzapy-0.1.0/zapy/_signal/api/codec.py +164 -0
- shellzapy-0.1.0/zapy/_signal/api/constants.py +14 -0
- shellzapy-0.1.0/zapy/_signal/api/device_sync.py +915 -0
- shellzapy-0.1.0/zapy/_signal/api/digest_sync.py +363 -0
- shellzapy-0.1.0/zapy/_signal/api/identity_sync.py +250 -0
- shellzapy-0.1.0/zapy/_signal/api/missing_pre_keys_sync.py +267 -0
- shellzapy-0.1.0/zapy/_signal/api/prekeys.py +191 -0
- shellzapy-0.1.0/zapy/_signal/api/result_map.py +40 -0
- shellzapy-0.1.0/zapy/_signal/api/rotate_key.py +111 -0
- shellzapy-0.1.0/zapy/_signal/api/session_sync.py +297 -0
- shellzapy-0.1.0/zapy/_signal/attestation.py +145 -0
- shellzapy-0.1.0/zapy/_signal/constants.py +22 -0
- shellzapy-0.1.0/zapy/_signal/encoding.py +78 -0
- shellzapy-0.1.0/zapy/_signal/group/__init__.py +35 -0
- shellzapy-0.1.0/zapy/_signal/group/chain.py +139 -0
- shellzapy-0.1.0/zapy/_signal/group/codec.py +78 -0
- shellzapy-0.1.0/zapy/_signal/group/encoding.py +166 -0
- shellzapy-0.1.0/zapy/_signal/group/manager.py +361 -0
- shellzapy-0.1.0/zapy/_signal/registration/__init__.py +44 -0
- shellzapy-0.1.0/zapy/_signal/registration/keygen.py +46 -0
- shellzapy-0.1.0/zapy/_signal/registration/reg_encoding.py +66 -0
- shellzapy-0.1.0/zapy/_signal/registration/reg_utils.py +52 -0
- shellzapy-0.1.0/zapy/_signal/session/__init__.py +114 -0
- shellzapy-0.1.0/zapy/_signal/session/encoding.py +385 -0
- shellzapy-0.1.0/zapy/_signal/session/protocol.py +590 -0
- shellzapy-0.1.0/zapy/_signal/session/ratchet.py +381 -0
- shellzapy-0.1.0/zapy/_signal/session/resolver.py +630 -0
- shellzapy-0.1.0/zapy/_signal/session/serializer.py +96 -0
- shellzapy-0.1.0/zapy/_signal/session/session.py +272 -0
- shellzapy-0.1.0/zapy/_signal/types.py +214 -0
- shellzapy-0.1.0/zapy/_store/__init__.py +118 -0
- shellzapy-0.1.0/zapy/_store/cache/__init__.py +166 -0
- shellzapy-0.1.0/zapy/_store/cache/identity.py +130 -0
- shellzapy-0.1.0/zapy/_store/cache/privacy_token.py +116 -0
- shellzapy-0.1.0/zapy/_store/cache/sender_key.py +168 -0
- shellzapy-0.1.0/zapy/_store/cache/session.py +142 -0
- shellzapy-0.1.0/zapy/_store/contracts/__init__.py +84 -0
- shellzapy-0.1.0/zapy/_store/contracts/appstate.py +82 -0
- shellzapy-0.1.0/zapy/_store/contracts/auth.py +16 -0
- shellzapy-0.1.0/zapy/_store/contracts/chat_metadata.py +29 -0
- shellzapy-0.1.0/zapy/_store/contracts/contact.py +31 -0
- shellzapy-0.1.0/zapy/_store/contracts/device_list.py +35 -0
- shellzapy-0.1.0/zapy/_store/contracts/group_metadata.py +33 -0
- shellzapy-0.1.0/zapy/_store/contracts/identity.py +18 -0
- shellzapy-0.1.0/zapy/_store/contracts/message.py +36 -0
- shellzapy-0.1.0/zapy/_store/contracts/message_secret.py +41 -0
- shellzapy-0.1.0/zapy/_store/contracts/pre_key.py +32 -0
- shellzapy-0.1.0/zapy/_store/contracts/privacy_token.py +32 -0
- shellzapy-0.1.0/zapy/_store/contracts/retry.py +47 -0
- shellzapy-0.1.0/zapy/_store/contracts/sender_key.py +37 -0
- shellzapy-0.1.0/zapy/_store/contracts/session.py +21 -0
- shellzapy-0.1.0/zapy/_store/contracts/signal.py +23 -0
- shellzapy-0.1.0/zapy/_store/contracts/thread.py +35 -0
- shellzapy-0.1.0/zapy/_store/create_store.py +890 -0
- shellzapy-0.1.0/zapy/_store/locks.py +1154 -0
- shellzapy-0.1.0/zapy/_store/memory/__init__.py +40 -0
- shellzapy-0.1.0/zapy/_store/memory/appstate.py +200 -0
- shellzapy-0.1.0/zapy/_store/memory/auth.py +24 -0
- shellzapy-0.1.0/zapy/_store/memory/chat_metadata.py +124 -0
- shellzapy-0.1.0/zapy/_store/memory/contact.py +125 -0
- shellzapy-0.1.0/zapy/_store/memory/device_list.py +161 -0
- shellzapy-0.1.0/zapy/_store/memory/group_metadata.py +125 -0
- shellzapy-0.1.0/zapy/_store/memory/identity.py +86 -0
- shellzapy-0.1.0/zapy/_store/memory/message.py +85 -0
- shellzapy-0.1.0/zapy/_store/memory/message_secret.py +145 -0
- shellzapy-0.1.0/zapy/_store/memory/pre_key.py +112 -0
- shellzapy-0.1.0/zapy/_store/memory/privacy_token.py +103 -0
- shellzapy-0.1.0/zapy/_store/memory/retry.py +250 -0
- shellzapy-0.1.0/zapy/_store/memory/sender_key.py +162 -0
- shellzapy-0.1.0/zapy/_store/memory/session.py +111 -0
- shellzapy-0.1.0/zapy/_store/memory/signal.py +45 -0
- shellzapy-0.1.0/zapy/_store/memory/thread.py +66 -0
- shellzapy-0.1.0/zapy/_store/noop.py +279 -0
- shellzapy-0.1.0/zapy/_transport/__init__.py +3 -0
- shellzapy-0.1.0/zapy/_transport/binary/__init__.py +77 -0
- shellzapy-0.1.0/zapy/_transport/binary/constants.py +80 -0
- shellzapy-0.1.0/zapy/_transport/binary/decoder.py +260 -0
- shellzapy-0.1.0/zapy/_transport/binary/encoder.py +279 -0
- shellzapy-0.1.0/zapy/_transport/binary/tokens.py +1289 -0
- shellzapy-0.1.0/zapy/_transport/comms.py +759 -0
- shellzapy-0.1.0/zapy/_transport/keepalive/__init__.py +3 -0
- shellzapy-0.1.0/zapy/_transport/keepalive/keep_alive.py +252 -0
- shellzapy-0.1.0/zapy/_transport/node/__init__.py +3 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/__init__.py +9 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/abprops.py +33 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/account_sync.py +120 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/bot.py +56 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/business.py +261 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/chatstate.py +74 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/community.py +116 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/device.py +30 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/email.py +181 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/global_.py +74 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/group.py +279 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/media.py +21 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/message.py +436 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/mobile.py +227 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/newsletter.py +293 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/offline.py +20 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/pairing.py +130 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/passive.py +28 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/prekeys.py +215 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/presence.py +100 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/privacy.py +243 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/privacy_token.py +94 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/profile.py +176 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/retry.py +156 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/shortcake.py +87 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/tos.py +92 -0
- shellzapy-0.1.0/zapy/_transport/node/builders/usync.py +185 -0
- shellzapy-0.1.0/zapy/_transport/node/helpers.py +201 -0
- shellzapy-0.1.0/zapy/_transport/node/orchestrator.py +210 -0
- shellzapy-0.1.0/zapy/_transport/node/query.py +82 -0
- shellzapy-0.1.0/zapy/_transport/node/transport.py +105 -0
- shellzapy-0.1.0/zapy/_transport/node/usync.py +33 -0
- shellzapy-0.1.0/zapy/_transport/node/xml.py +38 -0
- shellzapy-0.1.0/zapy/_transport/noise/__init__.py +7 -0
- shellzapy-0.1.0/zapy/_transport/noise/cert.py +85 -0
- shellzapy-0.1.0/zapy/_transport/noise/client_payload.py +344 -0
- shellzapy-0.1.0/zapy/_transport/noise/constants.py +12 -0
- shellzapy-0.1.0/zapy/_transport/noise/frame_codec.py +120 -0
- shellzapy-0.1.0/zapy/_transport/noise/handshake.py +92 -0
- shellzapy-0.1.0/zapy/_transport/noise/session.py +493 -0
- shellzapy-0.1.0/zapy/_transport/noise/socket.py +45 -0
- shellzapy-0.1.0/zapy/_transport/noise/types.py +66 -0
- shellzapy-0.1.0/zapy/_transport/noise/version.json +3 -0
- shellzapy-0.1.0/zapy/_transport/proxy.py +35 -0
- shellzapy-0.1.0/zapy/_transport/types.py +19 -0
- shellzapy-0.1.0/zapy/_transport/wa_version_fetcher.py +159 -0
- shellzapy-0.1.0/zapy/_transport/web_socket.py +602 -0
- shellzapy-0.1.0/zapy/_util/__init__.py +3 -0
- shellzapy-0.1.0/zapy/_util/bytes.py +131 -0
- shellzapy-0.1.0/zapy/_util/coercion.py +29 -0
- shellzapy-0.1.0/zapy/_util/collections.py +45 -0
- shellzapy-0.1.0/zapy/_util/primitives.py +49 -0
- shellzapy-0.1.0/zapy/client.py +840 -0
- shellzapy-0.1.0/zapy/errors.py +148 -0
- shellzapy-0.1.0/zapy/events.py +564 -0
- shellzapy-0.1.0/zapy/jid.py +140 -0
- shellzapy-0.1.0/zapy/py.typed +0 -0
- shellzapy-0.1.0/zapy/stores/__init__.py +50 -0
- shellzapy-0.1.0/zapy/stores/base.py +1627 -0
- shellzapy-0.1.0/zapy/stores/json_file.py +359 -0
- shellzapy-0.1.0/zapy/stores/memory.py +322 -0
- shellzapy-0.1.0/zapy/stores/sqlite.py +343 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
description: Something broken in zapy
|
|
4
|
+
labels: [bug]
|
|
5
|
+
body:
|
|
6
|
+
- type: input
|
|
7
|
+
attributes:
|
|
8
|
+
label: zapy version
|
|
9
|
+
description: Output of `pip show zapy` or the commit hash.
|
|
10
|
+
- type: input
|
|
11
|
+
attributes:
|
|
12
|
+
label: Python version
|
|
13
|
+
description: e.g. 3.12.4
|
|
14
|
+
- type: textarea
|
|
15
|
+
attributes:
|
|
16
|
+
label: What happened
|
|
17
|
+
description: What you did, what you expected, what you got (logs help).
|
|
18
|
+
- type: textarea
|
|
19
|
+
attributes:
|
|
20
|
+
label: Minimal reproduction
|
|
21
|
+
description: Smallest snippet that shows it (no credentials, no real JIDs).
|
|
22
|
+
- type: checkboxes
|
|
23
|
+
attributes:
|
|
24
|
+
label: Safety
|
|
25
|
+
options:
|
|
26
|
+
- label: I used a dedicated test number, and pasted no credentials or message content.
|
|
27
|
+
required: true
|
|
28
|
+
---
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
description: An idea for zapy
|
|
4
|
+
labels: [enhancement]
|
|
5
|
+
body:
|
|
6
|
+
- type: textarea
|
|
7
|
+
attributes:
|
|
8
|
+
label: Proposal
|
|
9
|
+
description: What should it do, and what would the API look like?
|
|
10
|
+
- type: textarea
|
|
11
|
+
attributes:
|
|
12
|
+
label: Use case
|
|
13
|
+
description: What does this unlock for you?
|
|
14
|
+
- type: checkboxes
|
|
15
|
+
attributes:
|
|
16
|
+
label: Scope
|
|
17
|
+
options:
|
|
18
|
+
- label: This is not spam/bulk-messaging tooling, scraping, or abuse-control evasion.
|
|
19
|
+
required: true
|
|
20
|
+
---
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# What
|
|
2
|
+
|
|
3
|
+
Short description of the change.
|
|
4
|
+
|
|
5
|
+
# Why
|
|
6
|
+
|
|
7
|
+
Link the issue, or explain the motivation in a sentence.
|
|
8
|
+
|
|
9
|
+
# Checks
|
|
10
|
+
|
|
11
|
+
- [ ] `ruff check .` clean
|
|
12
|
+
- [ ] `mypy zapy scripts tests` clean
|
|
13
|
+
- [ ] `pytest -m "not integration"` green (+ touched integration tests)
|
|
14
|
+
- [ ] No credentials, session files, or real message content included
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
11
|
+
env:
|
|
12
|
+
ZAPO_ORACLE: ${{ github.workspace }}/zapo-oracle
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
repository: vinikjkkj/zapo
|
|
18
|
+
# Pinned in NOTICE; keep in sync.
|
|
19
|
+
ref: 702fefc7de5cab0eedd43a24fbeb359caf6160ef
|
|
20
|
+
path: zapo-oracle
|
|
21
|
+
- uses: astral-sh/setup-uv@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
enable-cache: true
|
|
25
|
+
- run: uv sync --frozen --python ${{ matrix.python-version }}
|
|
26
|
+
- run: uv run python scripts/gen_tokens.py && uv run python scripts/gen_proto.py && git diff --exit-code -- zapy/
|
|
27
|
+
- run: uv run ruff check .
|
|
28
|
+
- run: uv run mypy zapy scripts tests
|
|
29
|
+
- run: uv run pytest -m "not integration"
|
|
30
|
+
|
|
31
|
+
smoke-macos:
|
|
32
|
+
runs-on: macos-latest
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
- uses: astral-sh/setup-uv@v5
|
|
36
|
+
with:
|
|
37
|
+
python-version: "3.12"
|
|
38
|
+
enable-cache: true
|
|
39
|
+
- run: uv sync --frozen
|
|
40
|
+
- run: uv run pytest -m "not integration"
|
|
41
|
+
|
|
42
|
+
install-check:
|
|
43
|
+
# Non-editable install: proves packaging ships everything runtime
|
|
44
|
+
# needs (vendored data files, implicit resources) outside the repo.
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v4
|
|
48
|
+
- uses: astral-sh/setup-uv@v5
|
|
49
|
+
with:
|
|
50
|
+
python-version: "3.12"
|
|
51
|
+
- run: uv build -o /tmp/dist
|
|
52
|
+
- run: uv venv /tmp/icheck && uv pip install --python /tmp/icheck/bin/python /tmp/dist/*.whl
|
|
53
|
+
- run: >
|
|
54
|
+
/tmp/icheck/bin/python -c "from zapy import Client;
|
|
55
|
+
from zapy._transport.noise.client_payload import _WA_VERSION;
|
|
56
|
+
print('zapy', _WA_VERSION, Client)"
|
|
57
|
+
|
|
58
|
+
integration:
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
steps:
|
|
61
|
+
- uses: actions/checkout@v4
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
with:
|
|
64
|
+
repository: vinikjkkj/zapo
|
|
65
|
+
# Pinned in NOTICE; keep in sync.
|
|
66
|
+
ref: 702fefc7de5cab0eedd43a24fbeb359caf6160ef
|
|
67
|
+
path: zapo-oracle
|
|
68
|
+
- uses: actions/setup-node@v4
|
|
69
|
+
with:
|
|
70
|
+
node-version: "22"
|
|
71
|
+
- uses: astral-sh/setup-uv@v5
|
|
72
|
+
with:
|
|
73
|
+
python-version: "3.12"
|
|
74
|
+
enable-cache: true
|
|
75
|
+
- run: uv sync --frozen
|
|
76
|
+
- run: npm install ws --no-save --no-audit --no-fund
|
|
77
|
+
working-directory: zapo-oracle/packages/fake-server
|
|
78
|
+
- run: ZAPO_ORACLE=$PWD/zapo-oracle uv run pytest -m integration
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- "docs/**"
|
|
8
|
+
- "mkdocs.yml"
|
|
9
|
+
- "wrangler.jsonc"
|
|
10
|
+
- "README.md"
|
|
11
|
+
- ".github/workflows/docs.yml"
|
|
12
|
+
workflow_dispatch:
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: docs
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
# Deploys to GitHub Pages on every push (enable once: repo Settings →
|
|
19
|
+
# Pages → Source: "GitHub Actions"). Cloudflare stays available for
|
|
20
|
+
# manual deploys from your logged-in terminal:
|
|
21
|
+
# mkdocs build --strict && wrangler deploy
|
|
22
|
+
|
|
23
|
+
permissions:
|
|
24
|
+
contents: read
|
|
25
|
+
pages: write
|
|
26
|
+
id-token: write
|
|
27
|
+
|
|
28
|
+
concurrency:
|
|
29
|
+
group: pages
|
|
30
|
+
cancel-in-progress: true
|
|
31
|
+
|
|
32
|
+
jobs:
|
|
33
|
+
build:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
- uses: astral-sh/setup-uv@v5
|
|
38
|
+
- name: Build
|
|
39
|
+
run: uvx --with mkdocs-material mkdocs build --strict
|
|
40
|
+
- uses: actions/upload-pages-artifact@v3
|
|
41
|
+
with:
|
|
42
|
+
path: site
|
|
43
|
+
deploy:
|
|
44
|
+
needs: build
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
environment:
|
|
47
|
+
name: github-pages
|
|
48
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
49
|
+
steps:
|
|
50
|
+
- id: deployment
|
|
51
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
id-token: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build-and-publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment:
|
|
16
|
+
name: pypi
|
|
17
|
+
url: https://pypi.org/p/shellzapy
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: astral-sh/setup-uv@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
- name: Build
|
|
24
|
+
run: uv build -o dist
|
|
25
|
+
- name: Publish to PyPI
|
|
26
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
27
|
+
- name: GitHub release
|
|
28
|
+
uses: softprops/action-gh-release@v2
|
|
29
|
+
with:
|
|
30
|
+
generate_release_notes: true
|
|
31
|
+
files: dist/*
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.venv/
|
|
6
|
+
venv/
|
|
7
|
+
|
|
8
|
+
# zapy sessions and credentials — never commit
|
|
9
|
+
.zapy/
|
|
10
|
+
*.sqlite
|
|
11
|
+
*.sqlite-journal
|
|
12
|
+
auth.json
|
|
13
|
+
|
|
14
|
+
# local dev and working memory — never commit
|
|
15
|
+
.venv/
|
|
16
|
+
.hstack/
|
|
17
|
+
|
|
18
|
+
# Test and tool output
|
|
19
|
+
.pytest_cache/
|
|
20
|
+
.mypy_cache/
|
|
21
|
+
.ruff_cache/
|
|
22
|
+
coverage.xml
|
|
23
|
+
htmlcov/
|
|
24
|
+
|
|
25
|
+
# built docs (deployed from CI/your terminal, never committed)
|
|
26
|
+
site/
|
|
27
|
+
# wrangler local state
|
|
28
|
+
.wrangler/
|
|
29
|
+
# uv
|
|
30
|
+
.uv/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# AGENTS.md - Maintaining `zapy`
|
|
2
|
+
|
|
3
|
+
> `zapy` is a WhatsApp Web client library for Python: a simple `asyncio`
|
|
4
|
+
> API for AI agents, focused on ease and performance. Protocol behavior
|
|
5
|
+
> is verified against a reference implementation (MIT `zapo-js` v1.12.x,
|
|
6
|
+
> pinned commit in `Module coverage`); see `NOTICE` for attribution.
|
|
7
|
+
> Read this whole file before writing code. Re-read section 3 before
|
|
8
|
+
> every task.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. Goal and non-goals
|
|
13
|
+
|
|
14
|
+
**Goal.** A library that speaks the WhatsApp Web protocol exactly, with
|
|
15
|
+
an API so simple that a Python developer building an AI agent can be
|
|
16
|
+
sending and receiving messages in under 10 lines.
|
|
17
|
+
|
|
18
|
+
**Two priorities, in this order:**
|
|
19
|
+
1. **Protocol parity.** Byte-for-byte identical wire behavior to the
|
|
20
|
+
reference implementation. A wrong byte means a banned session or a
|
|
21
|
+
silent failure. There is no "close enough".
|
|
22
|
+
2. **Python ergonomics.** The public API must feel native to Python
|
|
23
|
+
(asyncio, snake_case, dataclasses, decorators). Never leak foreign
|
|
24
|
+
idioms to the user.
|
|
25
|
+
|
|
26
|
+
**Non-goals (do not build unless the maintainer asks):**
|
|
27
|
+
- VoIP / calls, WAM telemetry, mobile registration flows (`WaMobile*`),
|
|
28
|
+
the MCP server package, the native crypto package.
|
|
29
|
+
- Performance micro-optimizations (zero-copy tricks, scratch buffers,
|
|
30
|
+
batched random pools). Match the **behavior**, not the optimizations.
|
|
31
|
+
- A "better" protocol design. Restructure only the public API surface.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 2. Source of truth
|
|
36
|
+
|
|
37
|
+
1. **The reference implementation is the spec for wire behavior.**
|
|
38
|
+
Local clone: a sibling `zapo` checkout (read-only; never edit it),
|
|
39
|
+
overridable with `ZAPO_ORACLE`.
|
|
40
|
+
2. **Pin the commit.** The exact reference commit hash lives at the top
|
|
41
|
+
of `Module coverage`. Verify against that commit only.
|
|
42
|
+
3. `spec/` holds vendored protocol data and is **reused, not rewritten**:
|
|
43
|
+
- `spec/proto/WAProto.proto` (`proto3`) -> generate Python bindings
|
|
44
|
+
from it. Never hand-write a message class.
|
|
45
|
+
- `spec/tokens/`, `spec/version/`, `spec/abprops/`,
|
|
46
|
+
`spec/appstate/`, `spec/mex/` -> converted with `scripts/gen_*.py`.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 3. Iron rules (re-read before every task)
|
|
51
|
+
|
|
52
|
+
1. **Read first.** Search every call site of the symbol you are changing;
|
|
53
|
+
read the existing tests, types, and callers. They encode the real
|
|
54
|
+
contract: error types, return shapes, defaults, identity/caching
|
|
55
|
+
semantics. Match sibling code; reuse its helpers.
|
|
56
|
+
2. **Cover every clause.** Happy path plus error, edge, and boundary
|
|
57
|
+
inputs (empty/None/malformed, reset mid-operation, concurrency).
|
|
58
|
+
A happy-path-only patch is incomplete.
|
|
59
|
+
3. **Tests come with the change.** Committed tests live next to the code
|
|
60
|
+
(`tests/` mirrors `zapy/`). Unit tests never touch the network: golden
|
|
61
|
+
vectors and fake-server fixtures only. Live-server tests are marked
|
|
62
|
+
`integration`; CI splits unit vs integration jobs.
|
|
63
|
+
4. **TypeScript `throw new Error(msg)` maps to `ValueError(msg)`** with
|
|
64
|
+
the message text preserved. (One deliberate exception: GCM auth
|
|
65
|
+
failure raises `cryptography.exceptions.InvalidTag`.)
|
|
66
|
+
5. **No stubs pretending to work.** Unsupported features raise
|
|
67
|
+
`NotImplementedError("zapy.<module>: <feature> is not supported yet")`.
|
|
68
|
+
Never return fake data.
|
|
69
|
+
6. **Keep crypto synchronous; no thread pools.** The reference wraps
|
|
70
|
+
some ops in async only for its own threading; call `cryptography`
|
|
71
|
+
synchronously in the same order of operations.
|
|
72
|
+
7. **Import rule.** Submodules import store contracts from their leaf
|
|
73
|
+
modules (e.g. `zapy._store.contracts.device_list`), never from the
|
|
74
|
+
`zapy._store.contracts` package `__init__` — or the
|
|
75
|
+
store→auth→signal→store cycle breaks isolated test collection.
|
|
76
|
+
8. **`WaMobile*` flows are explicit non-goals.**
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 4. Gates (every task ends here)
|
|
81
|
+
|
|
82
|
+
- `ruff check .` clean; changed files `ruff format` clean.
|
|
83
|
+
- `mypy zapy scripts tests` clean under `--strict`.
|
|
84
|
+
- `pytest -m "not integration"` green, plus the touched integration
|
|
85
|
+
tests where they exist (`pytest -m integration` needs node + oracle).
|
|
86
|
+
- `Module coverage` updated; one focused commit, conventional-commit
|
|
87
|
+
style (`feat(signal): ...`, `fix(auth): ...`).
|
|
88
|
+
|
|
89
|
+
When working in parallel (multiple agents): agents own disjoint modules,
|
|
90
|
+
never edit the same file, and never change shared contracts
|
|
91
|
+
(`_protocol/`, store Protocols, the public API) without recording it.
|
|
92
|
+
CI runs the same gates on Python 3.10–3.13 (Linux) plus a macOS smoke job.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 5. Code conventions
|
|
97
|
+
|
|
98
|
+
| Area | Rule |
|
|
99
|
+
|---|---|
|
|
100
|
+
| XEdDSA / Edwards math | pure Python (`zapy/_crypto/math/`); `int` is arbitrary precision, verify with vectors |
|
|
101
|
+
| Models | frozen dataclasses with `slots` |
|
|
102
|
+
| Bytes | `bytes` / `bytearray` / `memoryview`, never `str`; never mutate `bytes` |
|
|
103
|
+
| Logging | stdlib `logging` under `zapy.<module>` |
|
|
104
|
+
| Errors | small public hierarchy in `zapy/errors.py` (`ZapyError` -> `ConnectionError`, `AuthError`, `SendError`, `TimeoutError`); stable `.code`, human-readable messages |
|
|
105
|
+
| JIDs | plain `str` in the public API; helpers in `zapy/jid.py` |
|
|
106
|
+
| Events | names identical to the reference (`message`, `qr`, `paired`, ...); sync dispatch in listener order; handler exceptions are logged, never fatal |
|
|
107
|
+
| Async | `asyncio.Lock` per key for ratchet/session read-modify-write; single writer queue for socket writes; `asyncio.timeout`/`wait_for` with the `WA_DEFAULTS` values |
|
|
108
|
+
| Protobuf | `proto3`; use `HasField()` where the reference checks presence, not truthiness |
|
|
109
|
+
| Timing-safe compare | `hmac.compare_digest` wherever the reference uses timing-safe equality |
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 6. Public API design (the whole point)
|
|
114
|
+
|
|
115
|
+
The library has two layers: a **simple facade** for 95% of users, and
|
|
116
|
+
the faithful low-level coordinators underneath (`client.message`,
|
|
117
|
+
`client.group`, ...) for advanced use. Never force the user through the
|
|
118
|
+
low-level layer for common tasks.
|
|
119
|
+
|
|
120
|
+
### Target experience (this must keep working, verbatim)
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from zapy import Client
|
|
124
|
+
|
|
125
|
+
client = Client() # session "default", SQLite at ./.zapy/default.sqlite, QR printed in terminal
|
|
126
|
+
|
|
127
|
+
@client.on("message")
|
|
128
|
+
async def on_message(msg):
|
|
129
|
+
if msg.text == "ping":
|
|
130
|
+
await msg.reply("pong")
|
|
131
|
+
|
|
132
|
+
client.run() # connects, pairs on first run, reconnects automatically, handles Ctrl+C
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Rules for the facade
|
|
136
|
+
|
|
137
|
+
1. **Zero-config start.** `Client()` with no arguments must work.
|
|
138
|
+
2. **Pluggable auth/persistence in one argument.**
|
|
139
|
+
`Client(store=SqliteStore("auth.db"))`, `JsonFileStore`, `MemoryStore`.
|
|
140
|
+
3. **Two ways to run:** blocking `client.run()` and
|
|
141
|
+
`await client.start()` / `await client.stop()`, plus `async with`.
|
|
142
|
+
4. **Events:** decorator and direct `@client.on("message")` forms;
|
|
143
|
+
handlers may be sync or async; `await client.wait_for(...)` for
|
|
144
|
+
agent-style flows.
|
|
145
|
+
5. **Event payloads are dataclasses** (`msg.text/sender/chat/is_group/from_me/id/timestamp/raw/media`,
|
|
146
|
+
`await msg.reply/react/download`).
|
|
147
|
+
6. **Send helpers:** `send_text/image/video/audio/document/reaction/poll`,
|
|
148
|
+
groups, receipts, `request_pairing_code`. Accept JIDs or bare phone
|
|
149
|
+
numbers; paths, `bytes`, or file-likes for media.
|
|
150
|
+
7. **Type hints everywhere** and `py.typed` shipped. Docstrings with a
|
|
151
|
+
short example on every public symbol.
|
|
152
|
+
8. Public API additions must be thin wrappers over covered behavior and
|
|
153
|
+
must never change protocol behavior.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 7. Testing strategy
|
|
158
|
+
|
|
159
|
+
1. **Unit tests:** same scenarios, same inputs, same expected outputs
|
|
160
|
+
as the reference suites. Golden vectors live in `tests/vectors/`
|
|
161
|
+
(hex strings); Python tests load the JSON and assert equality.
|
|
162
|
+
2. **Integration tests** run the reference fake server as a subprocess
|
|
163
|
+
(launcher in `tools/fake_server_runner/`, `ws://127.0.0.1:<port>`)
|
|
164
|
+
through test-only socket/CA overrides. Pairing, login, send,
|
|
165
|
+
receive, retry, and groups are verified without touching WhatsApp.
|
|
166
|
+
3. **Coverage:** every public function has at least one test.
|
|
167
|
+
4. Never commit credentials, session files, QR codes, phone numbers, or
|
|
168
|
+
real message content. `.zapy/` and `*.sqlite` are gitignored.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 8. Definition of done (per change)
|
|
173
|
+
|
|
174
|
+
- [ ] Python code complete and typed (`mypy --strict` clean)
|
|
175
|
+
- [ ] Tests added/updated, all passing (unit + touched integration)
|
|
176
|
+
- [ ] Golden vectors match (for byte-level changes)
|
|
177
|
+
- [ ] Public docstrings with an example (for public symbols)
|
|
178
|
+
- [ ] `Module coverage` row updated, deviations logged
|
|
179
|
+
- [ ] No TODOs left unrecorded
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 9. Safety and responsibility
|
|
184
|
+
|
|
185
|
+
- This is an unofficial implementation of a protocol owned by Meta. The
|
|
186
|
+
README must say so, explain the account-ban risk, and recommend using
|
|
187
|
+
a dedicated number.
|
|
188
|
+
- Do not add anything designed for spam, bulk unsolicited messaging,
|
|
189
|
+
scraping people's data, or evading WhatsApp's abuse controls. Do not
|
|
190
|
+
add "anti-ban" evasion features.
|
|
191
|
+
- Never commit credentials, session files, QR codes, phone numbers, or
|
|
192
|
+
real message content. `.zapy/` and `*.sqlite` are gitignored.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are recorded here.
|
|
4
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-12-03
|
|
9
|
+
|
|
10
|
+
First public release.
|
|
11
|
+
|
|
12
|
+
- Public `Client` facade: QR + link-code pairing, SQLite/JSON/memory
|
|
13
|
+
stores, decorator events, quoted replies.
|
|
14
|
+
- 1:1 and group messaging: text, media, reactions, polls, receipts,
|
|
15
|
+
retry, sender-key groups.
|
|
16
|
+
- Media: encrypted upload/download, thumbnails, stickers.
|
|
17
|
+
- App-state sync, newsletters, presence, privacy, profile, groups.
|
|
18
|
+
- 1200+ unit tests on golden vectors, fake-server integration coverage,
|
|
19
|
+
`ruff` + `mypy --strict` clean.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for helping out. Small, focused pull requests beat big ones.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv sync # creates .venv and installs everything (Python 3.12 via .python-version)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`uv.lock` is committed — CI runs `uv sync --frozen`, so what you test is
|
|
12
|
+
what CI tests.
|
|
13
|
+
|
|
14
|
+
## Checks (run all before pushing)
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
uv run ruff check .
|
|
18
|
+
uv run ruff format --check zapy tests scripts # only these trees are format-gated
|
|
19
|
+
uv run mypy zapy scripts tests
|
|
20
|
+
uv run pytest -m "not integration"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Unit tests never touch the network — golden vectors in `tests/vectors/`
|
|
24
|
+
and the fake-server fixtures only. Live-server tests are marked
|
|
25
|
+
`integration` and need node plus a `zapo` checkout (`ZAPO_ORACLE`).
|
|
26
|
+
|
|
27
|
+
## Style
|
|
28
|
+
|
|
29
|
+
- Python 3.10+, `ruff` + `mypy --strict` clean.
|
|
30
|
+
- Meaningful comments explain *why*; no filler comments.
|
|
31
|
+
- New behavior needs a test; bug fixes need a regression test.
|
|
32
|
+
- TypeScript `throw new Error(msg)` maps to `ValueError(msg)`; see
|
|
33
|
+
[AGENTS.md](AGENTS.md) for the full contributor guide.
|
shellzapy-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shellhaki
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
shellzapy-0.1.0/Makefile
ADDED
shellzapy-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# NOTICE
|
|
2
|
+
|
|
3
|
+
`zapy` is a Python port of [`zapo`](https://github.com/vinikjkkj/zapo)
|
|
4
|
+
(MIT, `zapo-js` v1.12.2), copyright (c) 2026 vinikjkkj <contact@vinicius.email>.
|
|
5
|
+
|
|
6
|
+
Pinned upstream commit: `702fefc7de5cab0eedd43a24fbeb359caf6160ef`.
|
|
7
|
+
|
|
8
|
+
Protocol behavior, constants, and flows are ported from that commit.
|
|
9
|
+
See `AGENTS.md` and `spec/` for the porting spec.
|
shellzapy-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: shellzapy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: WhatsApp Web client library for Python, simple asyncio API for AI agents, focused on ease and performance
|
|
5
|
+
Author: shellhaki
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
License-File: NOTICE
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Requires-Dist: cryptography
|
|
11
|
+
Requires-Dist: protobuf
|
|
12
|
+
Requires-Dist: websockets
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: grpcio-tools; extra == 'dev'
|
|
15
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
16
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
17
|
+
Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
18
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
19
|
+
Requires-Dist: types-protobuf; extra == 'dev'
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# zapy
|
|
23
|
+
|
|
24
|
+
**WhatsApp client library for Python — easy and performant.**
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from zapy import Client
|
|
28
|
+
|
|
29
|
+
client = Client() # SQLite session in ./.zapy/, QR pairing on first run
|
|
30
|
+
|
|
31
|
+
@client.on("message")
|
|
32
|
+
async def on_message(msg):
|
|
33
|
+
if msg.text == "ping":
|
|
34
|
+
await msg.reply("pong")
|
|
35
|
+
|
|
36
|
+
client.run()
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
[](https://github.com/shellhaki/zapy/actions/workflows/ci.yml)
|
|
40
|
+
[](https://www.python.org/)
|
|
41
|
+
[](LICENSE)
|
|
42
|
+
[](https://shellhaki.github.io/zapy/)
|
|
43
|
+
|
|
44
|
+
[Documentation](https://shellhaki.github.io/zapy/) ·
|
|
45
|
+
[Quickstart](https://shellhaki.github.io/zapy/quickstart/) ·
|
|
46
|
+
[API reference](https://shellhaki.github.io/zapy/api/client/) ·
|
|
47
|
+
[Examples](https://github.com/shellhaki/zapy/tree/main/examples)
|
|
48
|
+
|
|
49
|
+
## Why zapy?
|
|
50
|
+
|
|
51
|
+
- **Easy** — one `Client`, decorator handlers, quoted replies in one
|
|
52
|
+
call. Sessions, reconnects, and retries are handled inside.
|
|
53
|
+
- **Performant** — `asyncio` throughout, binary Noise transport, and
|
|
54
|
+
bounded memory caches. No threads, no heavyweight dependencies.
|
|
55
|
+
- **Complete** — text, media, reactions, polls, groups, newsletters,
|
|
56
|
+
presence, receipts, app-state sync, and multi-device signal encryption.
|
|
57
|
+
- **Durable** — auth and signal state persist in SQLite, JSON, or memory
|
|
58
|
+
stores. Pair once, restart freely.
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
Requires Python 3.10+.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
uv pip install shellzapy
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Pairing
|
|
69
|
+
|
|
70
|
+
First run prints a QR — scan it with **WhatsApp → Linked devices**.
|
|
71
|
+
Headless instead? Request a link code:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
await client.start()
|
|
75
|
+
code = await client.request_pairing_code("+15551234567")
|
|
76
|
+
print("enter on your phone:", code) # WhatsApp > Linked devices
|
|
77
|
+
await client.wait_for("paired", timeout=300.0)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
See the [authentication guide](https://shellhaki.github.io/zapy/authentication/).
|
|
81
|
+
|
|
82
|
+
## More examples
|
|
83
|
+
|
|
84
|
+
`examples/` has runnable bots — [echo_bot.py](examples/echo_bot.py),
|
|
85
|
+
[llm_agent.py](examples/llm_agent.py), and
|
|
86
|
+
[multi_session.py](examples/multi_session.py) — plus a full production
|
|
87
|
+
example in [zapy-chatbot](https://github.com/shellhaki/zapy-chatbot)
|
|
88
|
+
(QR + link-code auth, SQLite sessions, Meta Muse Spark chat).
|
|
89
|
+
|
|
90
|
+
## Developing
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
uv sync # creates .venv, installs zapy + dev tools (Python 3.12)
|
|
94
|
+
uv run pytest # unit suite (offline: golden vectors + fake server)
|
|
95
|
+
uv run ruff check . && uv run mypy zapy scripts tests
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Protocol behavior is verified against the zapo-js reference implementation
|
|
99
|
+
(see [NOTICE](NOTICE)).
|
|
100
|
+
|
|
101
|
+
`ruff` and `mypy --strict` must be clean; unit tests stay offline
|
|
102
|
+
(golden vectors and the fake server). See [AGENTS.md](AGENTS.md) for
|
|
103
|
+
conventions, and [CHANGELOG.md](CHANGELOG.md) for release history.
|
|
104
|
+
|
|
105
|
+
> Unofficial implementation of a Meta-owned protocol. Accounts used for
|
|
106
|
+
> testing can be banned; use a dedicated number. See
|
|
107
|
+
> [`spec/purpose.md`](spec/purpose.md) for the safety rules.
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
MIT — see [LICENSE](LICENSE). Protocol lineage is attributed in
|
|
112
|
+
[NOTICE](NOTICE).
|