Metadata-Version: 2.5
Name: yanez-agent-authorization
Version: 0.1.0a1
Summary: Yanez agent authorization: request human approval, verify signed receipts.
Project-URL: Homepage, https://github.com/yanez-compliance/yanez-agent-authorization
Project-URL: Repository, https://github.com/yanez-compliance/yanez-agent-authorization
Project-URL: Issues, https://github.com/yanez-compliance/yanez-agent-authorization/issues
License: MIT
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security
Requires-Python: >=3.11
Requires-Dist: cryptography>=42
Requires-Dist: httpx<1,>=0.27
Requires-Dist: pyjwt<3,>=2.8
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

# yanez-agent-authorization (Python)

Async client for requesting verifiable human approval through Yanez, and a verifier
for the signed receipts. Import package: `yanez_authz`.

```sh
pip install yanez-agent-authorization   # pre-release: not on PyPI yet; pip install -e packages/python
```

```python
from yanez_authz import AuthorizationClient, ReceiptVerifier

async with AuthorizationClient(base_url, agent_api_key) as client:
    pending = await client.request_authorization(terms={...})
    result = await client.wait_for_authorization(pending.request_id, 900)

receipt = ReceiptVerifier(base_url, expected_issuer).authorize_action(
    result.artifact, expected_terms, max_age_seconds=900, consume=True,
    expected_sub=account_yid)   # the YID your records tie to the account
```

`wait_for_authorization` raises the builtin `TimeoutError` when the local deadline
passes; rejection and expiry are returned as values. `expected_issuer` is the issuer
string your Yanez operator publishes for the deployment.

Docs and the full integration model: https://github.com/yanez-compliance/yanez-agent-authorization
