Server-only VACT client: mint access tokens and verify webhooks. No dependencies.
Project description
vact-server
Server-only VACT client for Python. No dependencies — standard library only.
pip install vact-server
Your backend is the only place the App Secret ever lives. It authenticates your own user, then asks VACT for a short-lived token scoped to them.
from vact_server import VactServer
vact = VactServer(
app_id=os.environ["VACT_APP_ID"],
app_secret=os.environ["VACT_APP_SECRET"],
)
# After YOUR login has decided who this is:
token = vact.create_access_token(
user_id=current_user.id,
allowed_callee_ids=["user_42"], # optional: restrict who they may call
)
return {"accessToken": token["accessToken"]}
Verifying webhooks
Pass the raw request bytes. Re-serializing parsed JSON changes the bytes and the signature will not match.
from vact_server import verify_vact_webhook, VactServerError
@app.post("/webhooks/vact")
async def webhook(request):
try:
event = verify_vact_webhook(
await request.body(), # raw bytes, not the parsed dict
dict(request.headers),
os.environ["VACT_WEBHOOK_SECRET"],
)
except VactServerError:
return Response(status_code=400) # never process an unverified body
# Deduplicate on event["eventId"] — delivery is retried.
if event["type"] == "incoming_call":
send_push(event["data"]["toUserId"], event["data"])
return Response(status_code=200)
Signature verification is timing-safe and rejects deliveries whose timestamp is more than five minutes old, which stops replay.
Deleting a user's data
result = vact.delete_user_data(user_id) # pages internally until complete
Full documentation: https://vact.online/docs.html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vact_server-1.0.0.tar.gz.
File metadata
- Download URL: vact_server-1.0.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24e468fc59c53a48f556594d1dc5fc02b087e65f37f39fbdcaade5f7680a0cd9
|
|
| MD5 |
51621a0fef13b52fa36af92808021964
|
|
| BLAKE2b-256 |
73bd9366c17747aa406cd9092b12d6fd7cc9966de0a969ab4a0389cb2b0b956b
|
File details
Details for the file vact_server-1.0.0-py3-none-any.whl.
File metadata
- Download URL: vact_server-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed8c6de5b83c13138db10eea19ce430fcee3019bd153c1cb80ac078d33381830
|
|
| MD5 |
f011c67fd403ccea34aff5df37458b2d
|
|
| BLAKE2b-256 |
667b1cfbae2a90959ac62372f79a1da18c216b4f26b607f5750c8944a448a875
|