Official Python SDK for Coffrify — encrypted file transfer infrastructure.
Project description
coffrify
Official Python SDK for Coffrify — encrypted file transfer infrastructure.
Install
pip install coffrify
# or with uv
uv add coffrify
# or with poetry
poetry add coffrify
Requires Python 3.9+.
Quickstart
from coffrify import Coffrify
client = Coffrify(api_key="cfy_live_...") # or set COFFRIFY_API_KEY env var
# Create a transfer
result = client.transfers.create(
files=[{"name": "rapport.pdf", "size": 1_240_000, "mime_type": "application/pdf"}],
expires_in_hours=72,
max_downloads=10,
password="secret",
)
print(result["share_url"])
# List webhooks
webhooks = client.webhooks.list()
# Subscribe to a webhook (secret returned ONCE)
created = client.webhooks.create(
name="Production",
url="https://app.example.com/hooks/coffrify",
events=["transfer.created", "transfer.downloaded"],
)
print("SAVE THIS SECRET:", created["secret"])
Webhook signature verification
from flask import Flask, request, abort
from coffrify.webhooks import verify
app = Flask(__name__)
@app.post("/hooks/coffrify")
def webhook():
result = verify(
raw_body=request.data.decode("utf-8"),
signature_header=request.headers.get("X-Coffrify-Signature"),
secret=os.environ["COFFRIFY_WEBHOOK_SECRET"],
)
if not result.valid:
abort(400, result.reason)
event = result.event
if event["type"] == "transfer.downloaded":
# ...
pass
return ("", 200)
The signature header X-Coffrify-Signature: t=<ts>,v1=<hex> is verified with constant-time comparison and a ±5 minute timestamp tolerance.
Auto-retry & Idempotency
The SDK auto-injects Idempotency-Key headers on every POST/PUT/PATCH/DELETE for safe retries. Network errors and 5xx/429 responses retry up to 3 times with exponential backoff.
Disable with Coffrify(api_key=..., max_retries=0, auto_idempotency=False).
Auth
Authentication uses Bearer tokens with your API key:
- Live keys:
cfy_<64 hex>— production data - Test keys:
cfy_test_<64 hex>— sandbox
key = client.api_keys.create(
name="CI deploy bot",
scopes=["transfers:write", "webhooks:manage"],
expires_in_days=90,
allowed_ips=["1.2.3.4/32"],
)
print("SAVE:", key["key"])
License
MIT
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 coffrify-0.2.0.tar.gz.
File metadata
- Download URL: coffrify-0.2.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb40911e9e26f60966b8e357548ef70c97457bccf70baf13ab6b25b5a02dfa35
|
|
| MD5 |
2d8d35f61151a91cd2cf0a000ef95202
|
|
| BLAKE2b-256 |
76413fa2faf057fc7ba278fd26e3f9d27ef63d86cb4a826d93aa1a00c7c5cf1e
|
File details
Details for the file coffrify-0.2.0-py3-none-any.whl.
File metadata
- Download URL: coffrify-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a75e55a73ef47d8b58b15c33b013cb10392621ef7a9a39244851ced041cf7128
|
|
| MD5 |
e6ef55260e21cdb2b29ae43fb101830a
|
|
| BLAKE2b-256 |
8903fef96ad161d1e1f8ae80f23dbce4620b84cec7f9d43358a68ac8814597c7
|