Webex KMS SDK
Async Python SDK slice for Webex Mercury communication and KMS-backed message decryption, with an optional thread-backed synchronous facade for scripts.
Based on https://github.com/WebexCommunity/webex-go-sdk, this package provides a focused implementation of the Webex Mercury protocol and KMS interactions needed for E2EE message decryption and conversation activity handling. It is designed to be used in conjunction with other Webex SDK components or as a standalone library for applications that need to interact with Webex conversations and messages.
This package intentionally covers a narrow part of the Webex Go SDK behavior:
- WDM device registration needed for Mercury
- Mercury WebSocket connection and event dispatch
- KMS ECDH setup, key retrieval, async Mercury response correlation, and key caching
- JWE text decryption and lightweight conversation activity helpers
- Thread-backed synchronous key retrieval for non-async scripts
It does not implement the full Webex REST API, WebRTC calling, outbound E2EE message encryption, or KMS administration.
Architecture
WebexClient is the async owner for the SDK sub-clients. ThreadedWebexClient is an optional
synchronous facade that runs the async client on a private background event loop and delegates KMS
operations to the same EncryptionClient implementation.
The message flow diagram shows the REST calls and websocket messages used for WDM registration, Mercury authorization and keepalive, KMS ECDH setup, and KMS key retrieval.
Install
pip install webex-kms-sdk
For local development:
uv sync --group dev
Async Quick Example
import asyncio
import os
from webex_kms_sdk import WebexClient
async def main() -> None:
client = WebexClient(os.environ["WEBEX_ACCESS_TOKEN"])
conversation = client.conversation
async def on_post(activity):
content = await conversation.get_message_content(activity)
print(content)
conversation.on("post", on_post)
await conversation.connect()
try:
await asyncio.Event().wait()
finally:
await conversation.disconnect()
await client.aclose()
asyncio.run(main())
Threaded Synchronous Example
Use ThreadedWebexClient when caller code is synchronous but KMS responses may still arrive
asynchronously over Mercury. The client starts an event loop and Mercury connection in a background
thread, then blocking methods such as get_key() wait for completion.
import os
from webex_kms_sdk import ThreadedWebexClient
with ThreadedWebexClient(os.environ["WEBEX_ACCESS_TOKEN"]) as client:
key = client.get_key(os.environ["KMS_KEY_URI"])
print(f"Retrieved key {key.uri}")
For a runnable script, see examples/threaded_get_key.py.
Metadata
Release files for webex-kms-sdk 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| webex_kms_sdk-0.4.0.tar.gz | 50.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| webex_kms_sdk-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 91.4 kB
Release files / webex_kms_sdk-0.4.0.tar.gz
| Download URL | webex_kms_sdk-0.4.0.tar.gz |
|---|---|
| Size | 50.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c3a18f51412a3792843396ede6599e0c05a7995609f38a7620e047d051595c9c
|
|
BLAKE2b-256 checksum How to use checksums |
babaef7d2d289bf20b24c3091bd0726a8c5aad91b564509e39faf2042c160fee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.2
|
Release files / webex_kms_sdk-0.4.0-py3-none-any.whl
| Download URL | webex_kms_sdk-0.4.0-py3-none-any.whl |
|---|---|
| Size | 40.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
14fb22d2ced4fc5c99eea02f64064d20de17ee30f93b6aacc8782abe51624774
|
|
BLAKE2b-256 checksum How to use checksums |
173ca10cfa71a5434cde39a7f451f9ceca85a6437086a50191d36ce4681c10c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.2
|
Security for webex-kms-sdk 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.