Skip to main content

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

Release files for coffrify 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coffrify 0.2.0
File Size Uploaded
coffrify-0.2.0.tar.gz 11.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coffrify 0.2.0
File Interpreter ABI Platform
coffrify-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.5 kB

Release files / coffrify-0.2.0.tar.gz

Download URL coffrify-0.2.0.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fb40911e9e26f60966b8e357548ef70c97457bccf70baf13ab6b25b5a02dfa35
BLAKE2b-256 checksum
How to use checksums
76413fa2faf057fc7ba278fd26e3f9d27ef63d86cb4a826d93aa1a00c7c5cf1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / coffrify-0.2.0-py3-none-any.whl

Download URL coffrify-0.2.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a75e55a73ef47d8b58b15c33b013cb10392621ef7a9a39244851ced041cf7128
BLAKE2b-256 checksum
How to use checksums
8903fef96ad161d1e1f8ae80f23dbce4620b84cec7f9d43358a68ac8814597c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page