Metadata-Version: 2.4
Name: creduent
Version: 0.1.0
Summary: Creduent Protocol SDK — cryptographic identity for AI agents
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: cryptography
Requires-Dist: requests
Requires-Dist: jcs
Requires-Dist: fastapi

# Creduent Python SDK

The official Python SDK for the **Creduent Protocol** — a federated, open trust-verification layer and cryptographic identity infrastructure for autonomous AI agents.

## Installation

Install the self-contained package from PyPI with a single command:

```bash
pip install creduent
```

## Quickstart

Below is a complete quickstart demonstrating keypair generation, self-signing, verification, registration, and attestation resolution using the SDK.

```python
from creduent import (
    generate_keys,
    sign,
    verify,
    register,
    attest,
    CreduEntError
)

try:
    # 1. Generate a new Ed25519 keypair
    private_key_pem, public_key_str = generate_keys()
    print(f"Generated Public Key: {public_key_str}\n")

    # 2. Sign a draft agent.json document
    draft_document = {
        "agent_id": "agent://creduent/reconbot",
        "owner": "Creduent",
        "public_key": public_key_str,
        "endpoint": "https://api.idevsec.com/recon",
        "capabilities": ["osint", "dns_lookup", "vulnerability_scan"]
    }
    
    signed_doc = sign(draft_document, private_key_pem)
    print("Signed agent.json:")
    print(signed_doc)
    print()

    # 3. Verify a self-signed agent.json (from dict, URL, domain, or agent:// URI)
    # Verification with a document dictionary
    result = verify(signed_doc)
    print(f"Self-Signed Verification Result (dict): {result.valid}")
    
    # Verification with a live agent URL
    live_result = verify("https://api.idevsec.com/.well-known/agent.json")
    print(f"Live Verification Result (URL): {live_result.valid}")
    print(f"Live Agent ID: {live_result.agent_id}")
    print(f"Live Capabilities: {live_result.capabilities}\n")

    # 4. Register an agent with the Creduent registry
    # Returns RegisterResult with success (bool), attestation (dict|None), error (str|None)
    reg_result = register(
        agent_id="agent://creduent/reconbot",
        domain="api.idevsec.com",
        agent_json_url="https://api.idevsec.com/.well-known/agent.json"
    )
    print(f"Registration Successful: {reg_result.success}")
    print(f"Attestation: {reg_result.attestation}\n")

    # 5. Fetch and validate an active attestation for an agent
    # Returns AttestResult with attested (bool), level (str), issued_at, expires_at, error (str|None)
    attest_result = attest("agent://creduent/reconbot")
    print(f"Is Attested: {attest_result.attested}")
    print(f"Attestation Level: {attest_result.level}")
    print(f"Issued At: {attest_result.issued_at}")
    print(f"Expires At: {attest_result.expires_at}\n")

except CreduEntError as e:
    print(f"Creduent Protocol Error occurred: {e}")
```

## Protocol Specification

For full information on the cryptographic standards, JCS canonicalization, and the federated verification workflows, read the complete [Creduent Protocol Specification](https://github.com/cyberfascinate/creduent).
