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.
Files changed (511) hide show
  1. shellzapy-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
  2. shellzapy-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  3. shellzapy-0.1.0/.github/pull_request_template.md +14 -0
  4. shellzapy-0.1.0/.github/workflows/ci.yml +78 -0
  5. shellzapy-0.1.0/.github/workflows/docs.yml +51 -0
  6. shellzapy-0.1.0/.github/workflows/release.yml +31 -0
  7. shellzapy-0.1.0/.gitignore +30 -0
  8. shellzapy-0.1.0/.python-version +1 -0
  9. shellzapy-0.1.0/AGENTS.md +192 -0
  10. shellzapy-0.1.0/CHANGELOG.md +19 -0
  11. shellzapy-0.1.0/CONTRIBUTING.md +33 -0
  12. shellzapy-0.1.0/LICENSE +21 -0
  13. shellzapy-0.1.0/Makefile +2 -0
  14. shellzapy-0.1.0/NOTICE +9 -0
  15. shellzapy-0.1.0/PKG-INFO +112 -0
  16. shellzapy-0.1.0/README.md +91 -0
  17. shellzapy-0.1.0/SECURITY.md +26 -0
  18. shellzapy-0.1.0/docs/api/client.md +48 -0
  19. shellzapy-0.1.0/docs/api/errors.md +24 -0
  20. shellzapy-0.1.0/docs/api/events.md +49 -0
  21. shellzapy-0.1.0/docs/api/stores.md +16 -0
  22. shellzapy-0.1.0/docs/authentication.md +63 -0
  23. shellzapy-0.1.0/docs/events.md +44 -0
  24. shellzapy-0.1.0/docs/index.md +46 -0
  25. shellzapy-0.1.0/docs/media.md +38 -0
  26. shellzapy-0.1.0/docs/messages.md +63 -0
  27. shellzapy-0.1.0/docs/quickstart.md +56 -0
  28. shellzapy-0.1.0/docs/stores.md +32 -0
  29. shellzapy-0.1.0/examples/echo_bot.py +94 -0
  30. shellzapy-0.1.0/examples/llm_agent.py +140 -0
  31. shellzapy-0.1.0/examples/multi_session.py +126 -0
  32. shellzapy-0.1.0/mkdocs.yml +52 -0
  33. shellzapy-0.1.0/pyproject.toml +72 -0
  34. shellzapy-0.1.0/scripts/gen_abprops.py +166 -0
  35. shellzapy-0.1.0/scripts/gen_proto.py +172 -0
  36. shellzapy-0.1.0/scripts/gen_tokens.py +133 -0
  37. shellzapy-0.1.0/spec/README.md +19 -0
  38. shellzapy-0.1.0/spec/proto/WAProto.proto +9478 -0
  39. shellzapy-0.1.0/spec/purpose.md +63 -0
  40. shellzapy-0.1.0/spec/version/version.json +3 -0
  41. shellzapy-0.1.0/tests/_appstate/test_appstate.py +32 -0
  42. shellzapy-0.1.0/tests/_appstate/test_appstate_crypto.py +176 -0
  43. shellzapy-0.1.0/tests/_appstate/test_appstate_encoding.py +54 -0
  44. shellzapy-0.1.0/tests/_appstate/test_appstate_sync.py +650 -0
  45. shellzapy-0.1.0/tests/_appstate/test_response_parser.py +103 -0
  46. shellzapy-0.1.0/tests/_auth/pairing/test_companion_host.py +207 -0
  47. shellzapy-0.1.0/tests/_auth/pairing/test_pairing_code_crypto.py +114 -0
  48. shellzapy-0.1.0/tests/_auth/pairing/test_pairing_flow.py +506 -0
  49. shellzapy-0.1.0/tests/_auth/pairing/test_qr_flow.py +70 -0
  50. shellzapy-0.1.0/tests/_auth/pairing/test_shortcake_crypto.py +107 -0
  51. shellzapy-0.1.0/tests/_auth/pairing/test_shortcake_flow.py +215 -0
  52. shellzapy-0.1.0/tests/_auth/test_auth_client.py +139 -0
  53. shellzapy-0.1.0/tests/_auth/test_credentials_flow.py +209 -0
  54. shellzapy-0.1.0/tests/_auth/test_pairing_integration.py +277 -0
  55. shellzapy-0.1.0/tests/_client/test_app_state_mutation.py +615 -0
  56. shellzapy-0.1.0/tests/_client/test_bot.py +678 -0
  57. shellzapy-0.1.0/tests/_client/test_builders_connection.py +385 -0
  58. shellzapy-0.1.0/tests/_client/test_builders_extended.py +924 -0
  59. shellzapy-0.1.0/tests/_client/test_client.py +220 -0
  60. shellzapy-0.1.0/tests/_client/test_connection_pair_restart.py +344 -0
  61. shellzapy-0.1.0/tests/_client/test_connection_receipt_queue.py +145 -0
  62. shellzapy-0.1.0/tests/_client/test_coordinator_ab_props.py +119 -0
  63. shellzapy-0.1.0/tests/_client/test_coordinator_broadcast_list.py +121 -0
  64. shellzapy-0.1.0/tests/_client/test_coordinator_business.py +233 -0
  65. shellzapy-0.1.0/tests/_client/test_coordinator_email.py +142 -0
  66. shellzapy-0.1.0/tests/_client/test_coordinator_low_level.py +141 -0
  67. shellzapy-0.1.0/tests/_client/test_coordinator_newsletter.py +63 -0
  68. shellzapy-0.1.0/tests/_client/test_coordinator_offline_resume.py +242 -0
  69. shellzapy-0.1.0/tests/_client/test_coordinator_presence.py +96 -0
  70. shellzapy-0.1.0/tests/_client/test_coordinator_status.py +150 -0
  71. shellzapy-0.1.0/tests/_client/test_coordinator_stream_control.py +159 -0
  72. shellzapy-0.1.0/tests/_client/test_ephemeral_setting.py +315 -0
  73. shellzapy-0.1.0/tests/_client/test_events.py +1707 -0
  74. shellzapy-0.1.0/tests/_client/test_group_builders.py +260 -0
  75. shellzapy-0.1.0/tests/_client/test_group_coordinator.py +790 -0
  76. shellzapy-0.1.0/tests/_client/test_group_history.py +207 -0
  77. shellzapy-0.1.0/tests/_client/test_group_history_send.py +344 -0
  78. shellzapy-0.1.0/tests/_client/test_history_sync.py +248 -0
  79. shellzapy-0.1.0/tests/_client/test_incoming_node_coordinator.py +367 -0
  80. shellzapy-0.1.0/tests/_client/test_mailbox.py +250 -0
  81. shellzapy-0.1.0/tests/_client/test_media.py +276 -0
  82. shellzapy-0.1.0/tests/_client/test_message_coordinator.py +450 -0
  83. shellzapy-0.1.0/tests/_client/test_message_dispatch.py +561 -0
  84. shellzapy-0.1.0/tests/_client/test_newsletter_ops.py +567 -0
  85. shellzapy-0.1.0/tests/_client/test_newsletter_parse.py +222 -0
  86. shellzapy-0.1.0/tests/_client/test_passive_tasks.py +291 -0
  87. shellzapy-0.1.0/tests/_client/test_persistence_companion_host.py +53 -0
  88. shellzapy-0.1.0/tests/_client/test_plugins.py +188 -0
  89. shellzapy-0.1.0/tests/_client/test_privacy.py +667 -0
  90. shellzapy-0.1.0/tests/_client/test_profile_coordinator.py +1002 -0
  91. shellzapy-0.1.0/tests/_client/test_retry_builders.py +87 -0
  92. shellzapy-0.1.0/tests/_client/test_retry_coordinator.py +1017 -0
  93. shellzapy-0.1.0/tests/_client/test_tokens.py +49 -0
  94. shellzapy-0.1.0/tests/_client/test_trusted_contact_token.py +228 -0
  95. shellzapy-0.1.0/tests/_client/test_write_behind.py +224 -0
  96. shellzapy-0.1.0/tests/_crypto/core/test_core.py +207 -0
  97. shellzapy-0.1.0/tests/_crypto/core/test_xeddsa.py +55 -0
  98. shellzapy-0.1.0/tests/_crypto/curves/test_curves.py +93 -0
  99. shellzapy-0.1.0/tests/_crypto/math/test_fe_edwards.py +162 -0
  100. shellzapy-0.1.0/tests/_crypto/math/test_le_mod.py +38 -0
  101. shellzapy-0.1.0/tests/_crypto/test_barrel.py +12 -0
  102. shellzapy-0.1.0/tests/_crypto/test_native_backend.py +86 -0
  103. shellzapy-0.1.0/tests/_media/test_conn.py +99 -0
  104. shellzapy-0.1.0/tests/_media/test_container.py +108 -0
  105. shellzapy-0.1.0/tests/_media/test_media_crypto.py +299 -0
  106. shellzapy-0.1.0/tests/_media/test_media_messages.py +670 -0
  107. shellzapy-0.1.0/tests/_media/test_sticker_pack.py +98 -0
  108. shellzapy-0.1.0/tests/_media/test_transfer.py +182 -0
  109. shellzapy-0.1.0/tests/_message/test_context_info.py +618 -0
  110. shellzapy-0.1.0/tests/_message/test_link_preview_builder.py +95 -0
  111. shellzapy-0.1.0/tests/_message/test_link_preview_detect.py +64 -0
  112. shellzapy-0.1.0/tests/_message/test_link_preview_fetcher.py +372 -0
  113. shellzapy-0.1.0/tests/_message/test_message_client.py +347 -0
  114. shellzapy-0.1.0/tests/_message/test_message_crypto_addon.py +603 -0
  115. shellzapy-0.1.0/tests/_message/test_message_crypto_icdc.py +301 -0
  116. shellzapy-0.1.0/tests/_message/test_message_crypto_phash.py +86 -0
  117. shellzapy-0.1.0/tests/_message/test_message_crypto_reporting_token.py +151 -0
  118. shellzapy-0.1.0/tests/_message/test_message_encode_content.py +395 -0
  119. shellzapy-0.1.0/tests/_message/test_message_encode_media_payload.py +188 -0
  120. shellzapy-0.1.0/tests/_message/test_message_kinds.py +434 -0
  121. shellzapy-0.1.0/tests/_message/test_messaging_builders.py +196 -0
  122. shellzapy-0.1.0/tests/_message/test_messaging_companion_host.py +96 -0
  123. shellzapy-0.1.0/tests/_message/test_messaging_fanout.py +170 -0
  124. shellzapy-0.1.0/tests/_message/test_messaging_group_metadata.py +264 -0
  125. shellzapy-0.1.0/tests/_message/test_messaging_ignore_key.py +296 -0
  126. shellzapy-0.1.0/tests/_message/test_messaging_key_protocol.py +148 -0
  127. shellzapy-0.1.0/tests/_message/test_messaging_link_preview.py +256 -0
  128. shellzapy-0.1.0/tests/_message/test_messaging_messages.py +624 -0
  129. shellzapy-0.1.0/tests/_message/test_primitives.py +1953 -0
  130. shellzapy-0.1.0/tests/_retry/test_retry.py +415 -0
  131. shellzapy-0.1.0/tests/_retry/test_tracker.py +159 -0
  132. shellzapy-0.1.0/tests/_signal/test_attestation.py +140 -0
  133. shellzapy-0.1.0/tests/_signal/test_encoding.py +129 -0
  134. shellzapy-0.1.0/tests/_signal/test_registration.py +74 -0
  135. shellzapy-0.1.0/tests/_signal/test_sender_key.py +227 -0
  136. shellzapy-0.1.0/tests/_signal/test_session.py +531 -0
  137. shellzapy-0.1.0/tests/_signal/test_session_encoding.py +114 -0
  138. shellzapy-0.1.0/tests/_signal/test_session_resolver.py +460 -0
  139. shellzapy-0.1.0/tests/_signal/test_signal_api.py +2033 -0
  140. shellzapy-0.1.0/tests/_store/test_contracts.py +236 -0
  141. shellzapy-0.1.0/tests/_store/test_memory_directory.py +174 -0
  142. shellzapy-0.1.0/tests/_store/test_memory_keys.py +470 -0
  143. shellzapy-0.1.0/tests/_store/test_memory_messaging.py +116 -0
  144. shellzapy-0.1.0/tests/_store/test_store_infra.py +1468 -0
  145. shellzapy-0.1.0/tests/_transport/binary/test_codec.py +75 -0
  146. shellzapy-0.1.0/tests/_transport/binary/test_codec_golden.py +54 -0
  147. shellzapy-0.1.0/tests/_transport/keepalive/test_keepalive.py +263 -0
  148. shellzapy-0.1.0/tests/_transport/node/test_id_generators.py +57 -0
  149. shellzapy-0.1.0/tests/_transport/node/test_node.py +291 -0
  150. shellzapy-0.1.0/tests/_transport/node/test_transport.py +80 -0
  151. shellzapy-0.1.0/tests/_transport/noise/test_frame_codec.py +56 -0
  152. shellzapy-0.1.0/tests/_transport/noise/test_handshake.py +221 -0
  153. shellzapy-0.1.0/tests/_transport/noise/test_noise.py +220 -0
  154. shellzapy-0.1.0/tests/_transport/noise/test_noise_session.py +77 -0
  155. shellzapy-0.1.0/tests/_transport/test_node_integration.py +236 -0
  156. shellzapy-0.1.0/tests/_transport/test_wa_version_fetcher.py +81 -0
  157. shellzapy-0.1.0/tests/_util/test_bytes.py +55 -0
  158. shellzapy-0.1.0/tests/conftest.py +19 -0
  159. shellzapy-0.1.0/tests/test_client_facade.py +551 -0
  160. shellzapy-0.1.0/tests/test_facade_live.py +367 -0
  161. shellzapy-0.1.0/tests/test_init.py +7 -0
  162. shellzapy-0.1.0/tests/test_stores.py +762 -0
  163. shellzapy-0.1.0/tests/vectors/codec_golden.json +3435 -0
  164. shellzapy-0.1.0/tests/vectors/crypto.json +397 -0
  165. shellzapy-0.1.0/tests/vectors/noise_handshake.json +23 -0
  166. shellzapy-0.1.0/tools/fake_server_runner/run.mjs +111 -0
  167. shellzapy-0.1.0/tools/gen_vectors/crypto.mjs +365 -0
  168. shellzapy-0.1.0/tools/gen_vectors/noise_handshake.mjs +202 -0
  169. shellzapy-0.1.0/tools/gen_vectors/smoke.mjs +25 -0
  170. shellzapy-0.1.0/uv.lock +1215 -0
  171. shellzapy-0.1.0/wrangler.jsonc +8 -0
  172. shellzapy-0.1.0/zapy/__init__.py +58 -0
  173. shellzapy-0.1.0/zapy/_appstate/__init__.py +59 -0
  174. shellzapy-0.1.0/zapy/_appstate/constants.py +82 -0
  175. shellzapy-0.1.0/zapy/_appstate/crypto/__init__.py +17 -0
  176. shellzapy-0.1.0/zapy/_appstate/crypto/app_state_crypto.py +401 -0
  177. shellzapy-0.1.0/zapy/_appstate/parsers/__init__.py +23 -0
  178. shellzapy-0.1.0/zapy/_appstate/parsers/encoding.py +157 -0
  179. shellzapy-0.1.0/zapy/_appstate/parsers/response_parser.py +135 -0
  180. shellzapy-0.1.0/zapy/_appstate/sync/__init__.py +11 -0
  181. shellzapy-0.1.0/zapy/_appstate/sync/sync_client.py +1559 -0
  182. shellzapy-0.1.0/zapy/_appstate/types.py +137 -0
  183. shellzapy-0.1.0/zapy/_appstate/utils.py +100 -0
  184. shellzapy-0.1.0/zapy/_auth/__init__.py +3 -0
  185. shellzapy-0.1.0/zapy/_auth/auth_client.py +618 -0
  186. shellzapy-0.1.0/zapy/_auth/credentials_flow.py +290 -0
  187. shellzapy-0.1.0/zapy/_auth/pairing/__init__.py +3 -0
  188. shellzapy-0.1.0/zapy/_auth/pairing/companion_host.py +239 -0
  189. shellzapy-0.1.0/zapy/_auth/pairing/flow.py +808 -0
  190. shellzapy-0.1.0/zapy/_auth/pairing/pairing_code_crypto.py +143 -0
  191. shellzapy-0.1.0/zapy/_auth/pairing/qr_flow.py +123 -0
  192. shellzapy-0.1.0/zapy/_auth/pairing/shortcake_crypto.py +122 -0
  193. shellzapy-0.1.0/zapy/_auth/pairing/shortcake_flow.py +393 -0
  194. shellzapy-0.1.0/zapy/_auth/types.py +110 -0
  195. shellzapy-0.1.0/zapy/_client/__init__.py +26 -0
  196. shellzapy-0.1.0/zapy/_client/client.py +972 -0
  197. shellzapy-0.1.0/zapy/_client/connection/__init__.py +6 -0
  198. shellzapy-0.1.0/zapy/_client/connection/manager.py +525 -0
  199. shellzapy-0.1.0/zapy/_client/connection/receipt_queue.py +74 -0
  200. shellzapy-0.1.0/zapy/_client/coordinators/__init__.py +81 -0
  201. shellzapy-0.1.0/zapy/_client/coordinators/ab_props.py +260 -0
  202. shellzapy-0.1.0/zapy/_client/coordinators/app_state_mutation.py +2538 -0
  203. shellzapy-0.1.0/zapy/_client/coordinators/bot.py +830 -0
  204. shellzapy-0.1.0/zapy/_client/coordinators/broadcast_list.py +101 -0
  205. shellzapy-0.1.0/zapy/_client/coordinators/business.py +247 -0
  206. shellzapy-0.1.0/zapy/_client/coordinators/email.py +158 -0
  207. shellzapy-0.1.0/zapy/_client/coordinators/group.py +1478 -0
  208. shellzapy-0.1.0/zapy/_client/coordinators/incoming_node.py +758 -0
  209. shellzapy-0.1.0/zapy/_client/coordinators/low_level.py +119 -0
  210. shellzapy-0.1.0/zapy/_client/coordinators/message.py +1153 -0
  211. shellzapy-0.1.0/zapy/_client/coordinators/message_dispatch.py +1637 -0
  212. shellzapy-0.1.0/zapy/_client/coordinators/newsletter.py +110 -0
  213. shellzapy-0.1.0/zapy/_client/coordinators/offline_resume.py +271 -0
  214. shellzapy-0.1.0/zapy/_client/coordinators/passive_tasks.py +447 -0
  215. shellzapy-0.1.0/zapy/_client/coordinators/presence.py +103 -0
  216. shellzapy-0.1.0/zapy/_client/coordinators/privacy.py +623 -0
  217. shellzapy-0.1.0/zapy/_client/coordinators/profile.py +1024 -0
  218. shellzapy-0.1.0/zapy/_client/coordinators/retry.py +1878 -0
  219. shellzapy-0.1.0/zapy/_client/coordinators/status.py +132 -0
  220. shellzapy-0.1.0/zapy/_client/coordinators/stream_control.py +260 -0
  221. shellzapy-0.1.0/zapy/_client/coordinators/trusted_contact_token.py +417 -0
  222. shellzapy-0.1.0/zapy/_client/events/__init__.py +266 -0
  223. shellzapy-0.1.0/zapy/_client/events/abprops.py +58 -0
  224. shellzapy-0.1.0/zapy/_client/events/appstate_mutation.py +248 -0
  225. shellzapy-0.1.0/zapy/_client/events/business.py +565 -0
  226. shellzapy-0.1.0/zapy/_client/events/call.py +144 -0
  227. shellzapy-0.1.0/zapy/_client/events/chatstate.py +41 -0
  228. shellzapy-0.1.0/zapy/_client/events/devices.py +122 -0
  229. shellzapy-0.1.0/zapy/_client/events/dirty.py +384 -0
  230. shellzapy-0.1.0/zapy/_client/events/group.py +655 -0
  231. shellzapy-0.1.0/zapy/_client/events/identity.py +40 -0
  232. shellzapy-0.1.0/zapy/_client/events/incoming.py +1079 -0
  233. shellzapy-0.1.0/zapy/_client/events/mex_notification.py +317 -0
  234. shellzapy-0.1.0/zapy/_client/events/offline.py +123 -0
  235. shellzapy-0.1.0/zapy/_client/events/picture.py +67 -0
  236. shellzapy-0.1.0/zapy/_client/events/presence.py +74 -0
  237. shellzapy-0.1.0/zapy/_client/events/privacy.py +187 -0
  238. shellzapy-0.1.0/zapy/_client/events/privacy_token.py +72 -0
  239. shellzapy-0.1.0/zapy/_client/events/receipt.py +109 -0
  240. shellzapy-0.1.0/zapy/_client/events/registration.py +70 -0
  241. shellzapy-0.1.0/zapy/_client/events/username.py +76 -0
  242. shellzapy-0.1.0/zapy/_client/factory.py +2020 -0
  243. shellzapy-0.1.0/zapy/_client/media.py +829 -0
  244. shellzapy-0.1.0/zapy/_client/newsletter/__init__.py +90 -0
  245. shellzapy-0.1.0/zapy/_client/newsletter/admin.py +323 -0
  246. shellzapy-0.1.0/zapy/_client/newsletter/content.py +499 -0
  247. shellzapy-0.1.0/zapy/_client/newsletter/discovery.py +233 -0
  248. shellzapy-0.1.0/zapy/_client/newsletter/messaging.py +396 -0
  249. shellzapy-0.1.0/zapy/_client/newsletter/mex.py +99 -0
  250. shellzapy-0.1.0/zapy/_client/newsletter/parse.py +406 -0
  251. shellzapy-0.1.0/zapy/_client/newsletter/types.py +393 -0
  252. shellzapy-0.1.0/zapy/_client/persistence/__init__.py +89 -0
  253. shellzapy-0.1.0/zapy/_client/persistence/companion_host.py +133 -0
  254. shellzapy-0.1.0/zapy/_client/persistence/ephemeral_setting.py +245 -0
  255. shellzapy-0.1.0/zapy/_client/persistence/group_history.py +361 -0
  256. shellzapy-0.1.0/zapy/_client/persistence/history_blob.py +169 -0
  257. shellzapy-0.1.0/zapy/_client/persistence/history_sync.py +646 -0
  258. shellzapy-0.1.0/zapy/_client/persistence/mailbox.py +232 -0
  259. shellzapy-0.1.0/zapy/_client/persistence/write_behind_persistence.py +368 -0
  260. shellzapy-0.1.0/zapy/_client/plugins/__init__.py +23 -0
  261. shellzapy-0.1.0/zapy/_client/plugins/define.py +44 -0
  262. shellzapy-0.1.0/zapy/_client/plugins/install.py +254 -0
  263. shellzapy-0.1.0/zapy/_client/plugins/types.py +64 -0
  264. shellzapy-0.1.0/zapy/_client/tokens/__init__.py +21 -0
  265. shellzapy-0.1.0/zapy/_client/tokens/cs_token.py +47 -0
  266. shellzapy-0.1.0/zapy/_client/tokens/tc_token.py +43 -0
  267. shellzapy-0.1.0/zapy/_client/types.py +988 -0
  268. shellzapy-0.1.0/zapy/_crypto/__init__.py +65 -0
  269. shellzapy-0.1.0/zapy/_crypto/core/__init__.py +62 -0
  270. shellzapy-0.1.0/zapy/_crypto/core/hkdf.py +41 -0
  271. shellzapy-0.1.0/zapy/_crypto/core/keys.py +51 -0
  272. shellzapy-0.1.0/zapy/_crypto/core/nonce.py +25 -0
  273. shellzapy-0.1.0/zapy/_crypto/core/primitives.py +179 -0
  274. shellzapy-0.1.0/zapy/_crypto/core/random.py +32 -0
  275. shellzapy-0.1.0/zapy/_crypto/core/xeddsa.py +72 -0
  276. shellzapy-0.1.0/zapy/_crypto/curves/__init__.py +3 -0
  277. shellzapy-0.1.0/zapy/_crypto/curves/constants.py +10 -0
  278. shellzapy-0.1.0/zapy/_crypto/curves/ed25519.py +61 -0
  279. shellzapy-0.1.0/zapy/_crypto/curves/types.py +18 -0
  280. shellzapy-0.1.0/zapy/_crypto/curves/x25519.py +117 -0
  281. shellzapy-0.1.0/zapy/_crypto/math/__init__.py +3 -0
  282. shellzapy-0.1.0/zapy/_crypto/math/constants.py +35 -0
  283. shellzapy-0.1.0/zapy/_crypto/math/edwards.py +174 -0
  284. shellzapy-0.1.0/zapy/_crypto/math/fe.py +120 -0
  285. shellzapy-0.1.0/zapy/_crypto/math/le.py +13 -0
  286. shellzapy-0.1.0/zapy/_crypto/math/mod.py +15 -0
  287. shellzapy-0.1.0/zapy/_crypto/math/prime.py +11 -0
  288. shellzapy-0.1.0/zapy/_crypto/math/types.py +25 -0
  289. shellzapy-0.1.0/zapy/_crypto/native_backend.py +40 -0
  290. shellzapy-0.1.0/zapy/_infra/__init__.py +3 -0
  291. shellzapy-0.1.0/zapy/_infra/log.py +142 -0
  292. shellzapy-0.1.0/zapy/_infra/perf.py +77 -0
  293. shellzapy-0.1.0/zapy/_media/__init__.py +64 -0
  294. shellzapy-0.1.0/zapy/_media/constants.py +133 -0
  295. shellzapy-0.1.0/zapy/_media/container.py +110 -0
  296. shellzapy-0.1.0/zapy/_media/crypto/__init__.py +19 -0
  297. shellzapy-0.1.0/zapy/_media/crypto/crypto.py +633 -0
  298. shellzapy-0.1.0/zapy/_media/crypto/media_retry.py +107 -0
  299. shellzapy-0.1.0/zapy/_media/processor.py +100 -0
  300. shellzapy-0.1.0/zapy/_media/sticker/__init__.py +8 -0
  301. shellzapy-0.1.0/zapy/_media/sticker/pack.py +188 -0
  302. shellzapy-0.1.0/zapy/_media/transfer/__init__.py +15 -0
  303. shellzapy-0.1.0/zapy/_media/transfer/client.py +635 -0
  304. shellzapy-0.1.0/zapy/_media/transfer/conn.py +48 -0
  305. shellzapy-0.1.0/zapy/_media/types.py +169 -0
  306. shellzapy-0.1.0/zapy/_message/__init__.py +121 -0
  307. shellzapy-0.1.0/zapy/_message/addons/__init__.py +5 -0
  308. shellzapy-0.1.0/zapy/_message/addons/link_preview/__init__.py +54 -0
  309. shellzapy-0.1.0/zapy/_message/addons/link_preview/builder.py +56 -0
  310. shellzapy-0.1.0/zapy/_message/addons/link_preview/detect.py +72 -0
  311. shellzapy-0.1.0/zapy/_message/addons/link_preview/fetcher.py +553 -0
  312. shellzapy-0.1.0/zapy/_message/addons/link_preview/types.py +100 -0
  313. shellzapy-0.1.0/zapy/_message/client.py +486 -0
  314. shellzapy-0.1.0/zapy/_message/context_info.py +424 -0
  315. shellzapy-0.1.0/zapy/_message/crypto/__init__.py +71 -0
  316. shellzapy-0.1.0/zapy/_message/crypto/addon_crypto.py +656 -0
  317. shellzapy-0.1.0/zapy/_message/crypto/icdc.py +138 -0
  318. shellzapy-0.1.0/zapy/_message/crypto/phash.py +87 -0
  319. shellzapy-0.1.0/zapy/_message/crypto/reporting_token.py +498 -0
  320. shellzapy-0.1.0/zapy/_message/crypto/use_case_secret.py +113 -0
  321. shellzapy-0.1.0/zapy/_message/encode/__init__.py +84 -0
  322. shellzapy-0.1.0/zapy/_message/encode/content.py +636 -0
  323. shellzapy-0.1.0/zapy/_message/encode/device_sent.py +88 -0
  324. shellzapy-0.1.0/zapy/_message/encode/media_payload.py +122 -0
  325. shellzapy-0.1.0/zapy/_message/encode/padding.py +27 -0
  326. shellzapy-0.1.0/zapy/_message/kinds/__init__.py +1 -0
  327. shellzapy-0.1.0/zapy/_message/kinds/bot.py +179 -0
  328. shellzapy-0.1.0/zapy/_message/kinds/group_history.py +206 -0
  329. shellzapy-0.1.0/zapy/_message/kinds/newsletter.py +388 -0
  330. shellzapy-0.1.0/zapy/_message/kinds/sticker_pack.py +74 -0
  331. shellzapy-0.1.0/zapy/_message/messaging/__init__.py +336 -0
  332. shellzapy-0.1.0/zapy/_message/messaging/companion_host.py +117 -0
  333. shellzapy-0.1.0/zapy/_message/messaging/fanout.py +311 -0
  334. shellzapy-0.1.0/zapy/_message/messaging/group_metadata.py +444 -0
  335. shellzapy-0.1.0/zapy/_message/messaging/ignore_key.py +264 -0
  336. shellzapy-0.1.0/zapy/_message/messaging/key_protocol.py +217 -0
  337. shellzapy-0.1.0/zapy/_message/messaging/link_preview.py +448 -0
  338. shellzapy-0.1.0/zapy/_message/messaging/messages.py +1429 -0
  339. shellzapy-0.1.0/zapy/_message/primitives/__init__.py +1 -0
  340. shellzapy-0.1.0/zapy/_message/primitives/ack.py +232 -0
  341. shellzapy-0.1.0/zapy/_message/primitives/incoming.py +1141 -0
  342. shellzapy-0.1.0/zapy/_message/primitives/media_retry.py +451 -0
  343. shellzapy-0.1.0/zapy/_message/primitives/peer_data_operation.py +271 -0
  344. shellzapy-0.1.0/zapy/_message/types.py +434 -0
  345. shellzapy-0.1.0/zapy/_proto/WAProto_pb2.py +2584 -0
  346. shellzapy-0.1.0/zapy/_proto/__init__.py +1 -0
  347. shellzapy-0.1.0/zapy/_protocol/__init__.py +3 -0
  348. shellzapy-0.1.0/zapy/_protocol/abprops_spec.py +6216 -0
  349. shellzapy-0.1.0/zapy/_protocol/auth.py +17 -0
  350. shellzapy-0.1.0/zapy/_protocol/browser.py +57 -0
  351. shellzapy-0.1.0/zapy/_protocol/defaults.py +38 -0
  352. shellzapy-0.1.0/zapy/_protocol/device_identity.py +54 -0
  353. shellzapy-0.1.0/zapy/_protocol/jid.py +241 -0
  354. shellzapy-0.1.0/zapy/_protocol/message.py +127 -0
  355. shellzapy-0.1.0/zapy/_protocol/nodes.py +144 -0
  356. shellzapy-0.1.0/zapy/_protocol/notification.py +18 -0
  357. shellzapy-0.1.0/zapy/_retry/__init__.py +77 -0
  358. shellzapy-0.1.0/zapy/_retry/codec.py +209 -0
  359. shellzapy-0.1.0/zapy/_retry/constants.py +28 -0
  360. shellzapy-0.1.0/zapy/_retry/parse.py +132 -0
  361. shellzapy-0.1.0/zapy/_retry/reason.py +65 -0
  362. shellzapy-0.1.0/zapy/_retry/replay.py +483 -0
  363. shellzapy-0.1.0/zapy/_retry/tracker.py +161 -0
  364. shellzapy-0.1.0/zapy/_retry/types.py +122 -0
  365. shellzapy-0.1.0/zapy/_signal/__init__.py +171 -0
  366. shellzapy-0.1.0/zapy/_signal/api/__init__.py +133 -0
  367. shellzapy-0.1.0/zapy/_signal/api/codec.py +164 -0
  368. shellzapy-0.1.0/zapy/_signal/api/constants.py +14 -0
  369. shellzapy-0.1.0/zapy/_signal/api/device_sync.py +915 -0
  370. shellzapy-0.1.0/zapy/_signal/api/digest_sync.py +363 -0
  371. shellzapy-0.1.0/zapy/_signal/api/identity_sync.py +250 -0
  372. shellzapy-0.1.0/zapy/_signal/api/missing_pre_keys_sync.py +267 -0
  373. shellzapy-0.1.0/zapy/_signal/api/prekeys.py +191 -0
  374. shellzapy-0.1.0/zapy/_signal/api/result_map.py +40 -0
  375. shellzapy-0.1.0/zapy/_signal/api/rotate_key.py +111 -0
  376. shellzapy-0.1.0/zapy/_signal/api/session_sync.py +297 -0
  377. shellzapy-0.1.0/zapy/_signal/attestation.py +145 -0
  378. shellzapy-0.1.0/zapy/_signal/constants.py +22 -0
  379. shellzapy-0.1.0/zapy/_signal/encoding.py +78 -0
  380. shellzapy-0.1.0/zapy/_signal/group/__init__.py +35 -0
  381. shellzapy-0.1.0/zapy/_signal/group/chain.py +139 -0
  382. shellzapy-0.1.0/zapy/_signal/group/codec.py +78 -0
  383. shellzapy-0.1.0/zapy/_signal/group/encoding.py +166 -0
  384. shellzapy-0.1.0/zapy/_signal/group/manager.py +361 -0
  385. shellzapy-0.1.0/zapy/_signal/registration/__init__.py +44 -0
  386. shellzapy-0.1.0/zapy/_signal/registration/keygen.py +46 -0
  387. shellzapy-0.1.0/zapy/_signal/registration/reg_encoding.py +66 -0
  388. shellzapy-0.1.0/zapy/_signal/registration/reg_utils.py +52 -0
  389. shellzapy-0.1.0/zapy/_signal/session/__init__.py +114 -0
  390. shellzapy-0.1.0/zapy/_signal/session/encoding.py +385 -0
  391. shellzapy-0.1.0/zapy/_signal/session/protocol.py +590 -0
  392. shellzapy-0.1.0/zapy/_signal/session/ratchet.py +381 -0
  393. shellzapy-0.1.0/zapy/_signal/session/resolver.py +630 -0
  394. shellzapy-0.1.0/zapy/_signal/session/serializer.py +96 -0
  395. shellzapy-0.1.0/zapy/_signal/session/session.py +272 -0
  396. shellzapy-0.1.0/zapy/_signal/types.py +214 -0
  397. shellzapy-0.1.0/zapy/_store/__init__.py +118 -0
  398. shellzapy-0.1.0/zapy/_store/cache/__init__.py +166 -0
  399. shellzapy-0.1.0/zapy/_store/cache/identity.py +130 -0
  400. shellzapy-0.1.0/zapy/_store/cache/privacy_token.py +116 -0
  401. shellzapy-0.1.0/zapy/_store/cache/sender_key.py +168 -0
  402. shellzapy-0.1.0/zapy/_store/cache/session.py +142 -0
  403. shellzapy-0.1.0/zapy/_store/contracts/__init__.py +84 -0
  404. shellzapy-0.1.0/zapy/_store/contracts/appstate.py +82 -0
  405. shellzapy-0.1.0/zapy/_store/contracts/auth.py +16 -0
  406. shellzapy-0.1.0/zapy/_store/contracts/chat_metadata.py +29 -0
  407. shellzapy-0.1.0/zapy/_store/contracts/contact.py +31 -0
  408. shellzapy-0.1.0/zapy/_store/contracts/device_list.py +35 -0
  409. shellzapy-0.1.0/zapy/_store/contracts/group_metadata.py +33 -0
  410. shellzapy-0.1.0/zapy/_store/contracts/identity.py +18 -0
  411. shellzapy-0.1.0/zapy/_store/contracts/message.py +36 -0
  412. shellzapy-0.1.0/zapy/_store/contracts/message_secret.py +41 -0
  413. shellzapy-0.1.0/zapy/_store/contracts/pre_key.py +32 -0
  414. shellzapy-0.1.0/zapy/_store/contracts/privacy_token.py +32 -0
  415. shellzapy-0.1.0/zapy/_store/contracts/retry.py +47 -0
  416. shellzapy-0.1.0/zapy/_store/contracts/sender_key.py +37 -0
  417. shellzapy-0.1.0/zapy/_store/contracts/session.py +21 -0
  418. shellzapy-0.1.0/zapy/_store/contracts/signal.py +23 -0
  419. shellzapy-0.1.0/zapy/_store/contracts/thread.py +35 -0
  420. shellzapy-0.1.0/zapy/_store/create_store.py +890 -0
  421. shellzapy-0.1.0/zapy/_store/locks.py +1154 -0
  422. shellzapy-0.1.0/zapy/_store/memory/__init__.py +40 -0
  423. shellzapy-0.1.0/zapy/_store/memory/appstate.py +200 -0
  424. shellzapy-0.1.0/zapy/_store/memory/auth.py +24 -0
  425. shellzapy-0.1.0/zapy/_store/memory/chat_metadata.py +124 -0
  426. shellzapy-0.1.0/zapy/_store/memory/contact.py +125 -0
  427. shellzapy-0.1.0/zapy/_store/memory/device_list.py +161 -0
  428. shellzapy-0.1.0/zapy/_store/memory/group_metadata.py +125 -0
  429. shellzapy-0.1.0/zapy/_store/memory/identity.py +86 -0
  430. shellzapy-0.1.0/zapy/_store/memory/message.py +85 -0
  431. shellzapy-0.1.0/zapy/_store/memory/message_secret.py +145 -0
  432. shellzapy-0.1.0/zapy/_store/memory/pre_key.py +112 -0
  433. shellzapy-0.1.0/zapy/_store/memory/privacy_token.py +103 -0
  434. shellzapy-0.1.0/zapy/_store/memory/retry.py +250 -0
  435. shellzapy-0.1.0/zapy/_store/memory/sender_key.py +162 -0
  436. shellzapy-0.1.0/zapy/_store/memory/session.py +111 -0
  437. shellzapy-0.1.0/zapy/_store/memory/signal.py +45 -0
  438. shellzapy-0.1.0/zapy/_store/memory/thread.py +66 -0
  439. shellzapy-0.1.0/zapy/_store/noop.py +279 -0
  440. shellzapy-0.1.0/zapy/_transport/__init__.py +3 -0
  441. shellzapy-0.1.0/zapy/_transport/binary/__init__.py +77 -0
  442. shellzapy-0.1.0/zapy/_transport/binary/constants.py +80 -0
  443. shellzapy-0.1.0/zapy/_transport/binary/decoder.py +260 -0
  444. shellzapy-0.1.0/zapy/_transport/binary/encoder.py +279 -0
  445. shellzapy-0.1.0/zapy/_transport/binary/tokens.py +1289 -0
  446. shellzapy-0.1.0/zapy/_transport/comms.py +759 -0
  447. shellzapy-0.1.0/zapy/_transport/keepalive/__init__.py +3 -0
  448. shellzapy-0.1.0/zapy/_transport/keepalive/keep_alive.py +252 -0
  449. shellzapy-0.1.0/zapy/_transport/node/__init__.py +3 -0
  450. shellzapy-0.1.0/zapy/_transport/node/builders/__init__.py +9 -0
  451. shellzapy-0.1.0/zapy/_transport/node/builders/abprops.py +33 -0
  452. shellzapy-0.1.0/zapy/_transport/node/builders/account_sync.py +120 -0
  453. shellzapy-0.1.0/zapy/_transport/node/builders/bot.py +56 -0
  454. shellzapy-0.1.0/zapy/_transport/node/builders/business.py +261 -0
  455. shellzapy-0.1.0/zapy/_transport/node/builders/chatstate.py +74 -0
  456. shellzapy-0.1.0/zapy/_transport/node/builders/community.py +116 -0
  457. shellzapy-0.1.0/zapy/_transport/node/builders/device.py +30 -0
  458. shellzapy-0.1.0/zapy/_transport/node/builders/email.py +181 -0
  459. shellzapy-0.1.0/zapy/_transport/node/builders/global_.py +74 -0
  460. shellzapy-0.1.0/zapy/_transport/node/builders/group.py +279 -0
  461. shellzapy-0.1.0/zapy/_transport/node/builders/media.py +21 -0
  462. shellzapy-0.1.0/zapy/_transport/node/builders/message.py +436 -0
  463. shellzapy-0.1.0/zapy/_transport/node/builders/mobile.py +227 -0
  464. shellzapy-0.1.0/zapy/_transport/node/builders/newsletter.py +293 -0
  465. shellzapy-0.1.0/zapy/_transport/node/builders/offline.py +20 -0
  466. shellzapy-0.1.0/zapy/_transport/node/builders/pairing.py +130 -0
  467. shellzapy-0.1.0/zapy/_transport/node/builders/passive.py +28 -0
  468. shellzapy-0.1.0/zapy/_transport/node/builders/prekeys.py +215 -0
  469. shellzapy-0.1.0/zapy/_transport/node/builders/presence.py +100 -0
  470. shellzapy-0.1.0/zapy/_transport/node/builders/privacy.py +243 -0
  471. shellzapy-0.1.0/zapy/_transport/node/builders/privacy_token.py +94 -0
  472. shellzapy-0.1.0/zapy/_transport/node/builders/profile.py +176 -0
  473. shellzapy-0.1.0/zapy/_transport/node/builders/retry.py +156 -0
  474. shellzapy-0.1.0/zapy/_transport/node/builders/shortcake.py +87 -0
  475. shellzapy-0.1.0/zapy/_transport/node/builders/tos.py +92 -0
  476. shellzapy-0.1.0/zapy/_transport/node/builders/usync.py +185 -0
  477. shellzapy-0.1.0/zapy/_transport/node/helpers.py +201 -0
  478. shellzapy-0.1.0/zapy/_transport/node/orchestrator.py +210 -0
  479. shellzapy-0.1.0/zapy/_transport/node/query.py +82 -0
  480. shellzapy-0.1.0/zapy/_transport/node/transport.py +105 -0
  481. shellzapy-0.1.0/zapy/_transport/node/usync.py +33 -0
  482. shellzapy-0.1.0/zapy/_transport/node/xml.py +38 -0
  483. shellzapy-0.1.0/zapy/_transport/noise/__init__.py +7 -0
  484. shellzapy-0.1.0/zapy/_transport/noise/cert.py +85 -0
  485. shellzapy-0.1.0/zapy/_transport/noise/client_payload.py +344 -0
  486. shellzapy-0.1.0/zapy/_transport/noise/constants.py +12 -0
  487. shellzapy-0.1.0/zapy/_transport/noise/frame_codec.py +120 -0
  488. shellzapy-0.1.0/zapy/_transport/noise/handshake.py +92 -0
  489. shellzapy-0.1.0/zapy/_transport/noise/session.py +493 -0
  490. shellzapy-0.1.0/zapy/_transport/noise/socket.py +45 -0
  491. shellzapy-0.1.0/zapy/_transport/noise/types.py +66 -0
  492. shellzapy-0.1.0/zapy/_transport/noise/version.json +3 -0
  493. shellzapy-0.1.0/zapy/_transport/proxy.py +35 -0
  494. shellzapy-0.1.0/zapy/_transport/types.py +19 -0
  495. shellzapy-0.1.0/zapy/_transport/wa_version_fetcher.py +159 -0
  496. shellzapy-0.1.0/zapy/_transport/web_socket.py +602 -0
  497. shellzapy-0.1.0/zapy/_util/__init__.py +3 -0
  498. shellzapy-0.1.0/zapy/_util/bytes.py +131 -0
  499. shellzapy-0.1.0/zapy/_util/coercion.py +29 -0
  500. shellzapy-0.1.0/zapy/_util/collections.py +45 -0
  501. shellzapy-0.1.0/zapy/_util/primitives.py +49 -0
  502. shellzapy-0.1.0/zapy/client.py +840 -0
  503. shellzapy-0.1.0/zapy/errors.py +148 -0
  504. shellzapy-0.1.0/zapy/events.py +564 -0
  505. shellzapy-0.1.0/zapy/jid.py +140 -0
  506. shellzapy-0.1.0/zapy/py.typed +0 -0
  507. shellzapy-0.1.0/zapy/stores/__init__.py +50 -0
  508. shellzapy-0.1.0/zapy/stores/base.py +1627 -0
  509. shellzapy-0.1.0/zapy/stores/json_file.py +359 -0
  510. shellzapy-0.1.0/zapy/stores/memory.py +322 -0
  511. 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.
@@ -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.
@@ -0,0 +1,2 @@
1
+ agent:
2
+ muse resume 01a236cd-b076-7c40-89b0-8132e1226d35
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.
@@ -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
+ [![CI](https://github.com/shellhaki/zapy/actions/workflows/ci.yml/badge.svg)](https://github.com/shellhaki/zapy/actions/workflows/ci.yml)
40
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
41
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
42
+ [![Docs](https://img.shields.io/badge/docs-github%20pages-blueviolet.svg)](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).