Metadata-Version: 2.4
Name: ziffer
Version: 0.1.1
Summary: ZIFFER Python client: propose an action, wait for the decision, verify the receipt before you act
Author: code75 SASU
License: Proprietary
Project-URL: Homepage, https://ziffer.io
Project-URL: Documentation, https://ziffer.io/docs/developers/sdk
Project-URL: Support, https://ziffer.io/docs/support
Keywords: ziffer,agent,ai-agent,guardrail,approval,receipt
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: THIRD-PARTY-NOTICES
Requires-Dist: cryptography>=42
Requires-Dist: dilithium-py>=1.0
Dynamic: license-file

# ziffer

The ZIFFER client for Python. Propose an action, wait for the decision, and verify the signed
receipt in your own process before you act.

## Install

```bash
pip install ziffer
```

Python 3.10 or later.

## Quickstart

```python
import json, os
from ziffer import Client, TrustAnchor, verify

client = Client(base_url=os.environ["ZIFFER_API_URL"], api_key=os.environ["ZIFFER_API_KEY"])
anchor = TrustAnchor.from_file(
    os.environ["ZIFFER_TRUST_ANCHOR"], min_suite=os.environ["ZIFFER_SUITE_FLOOR"]
)

decision = client.wait(client.propose(proposal).decision_id, timeout=30.0)
if decision.outcome != "ALLOW":
    raise PermissionError(f"ziffer refused: {decision.clause}")

verify(decision.receipt, json.dumps(proposal).encode(), anchor)
bank.transfer(amount, to_account)   # your line, unchanged
```

You pass the proposal twice on purpose. The verifier hashes the bytes you hand it and compares
them with the receipt's claim. The check is against your copy, not against ours. Key order and
spacing do not matter.

`verify` checks the answer. Your own `if` is what stops the action.

An action that needs human approval answers `ATTEST` and no receipt. Keep polling `client.wait`
for the same decision id until `decision.receipt` is present, then verify it.

## Configuration

| Variable | What it is | Where the value comes from |
| --- | --- | --- |
| `ZIFFER_API_KEY` | Your API key. It carries your tenant, so no request names a tenant. | We issue it. It expires after 90 days unless you ask for another lifetime. |
| `ZIFFER_TRUST_ANCHOR` | Path to the public key file your receipts are signed under. | We give you the file. Take it from us, never from the API you are checking. |
| `ZIFFER_SUITE_FLOOR` | The weakest signature suite you will accept. | You choose it. There is no default. |
| `ZIFFER_API_URL` | The base URL of the ZIFFER deployment you call. | We give it to you with your key. |

## When a request is refused

Every refusal is a raised `RefusedError` whose `name` names the rule that fired; the table of
every clause, what it means and what to do is at https://ziffer.io/docs/refusals. Catch
`RefusedError`, record the name, and do not retry it. A `ConnectionError` from `propose` is a
different thing: you never got an answer at all.

## Documentation

- Quickstart: https://ziffer.io/docs/quickstart
- Integrating the SDK: https://ziffer.io/docs/developers/sdk
- Sandbox tenants: https://ziffer.io/docs/developers/sandbox
- Every refusal: https://ziffer.io/docs/refusals
- Policy by example: https://ziffer.io/docs/policy/by-example
- Glossary: https://ziffer.io/docs/glossary

## Support

Write to hello@ziffer.io. Your API key, your trust anchor file and your suite floor come from us.
So does an answer about a refusal you cannot explain.

## License

Proprietary. Copyright (c) 2026 code75 SASU, Paris, France. ZIFFER is a registered trademark of
code75 SASU. This package is not open source. Its use is governed by your agreement with code75
and by `LICENSE` beside this file. The open-source components it redistributes are listed in
`THIRD-PARTY-NOTICES`, under their own licences.
