Metadata-Version: 2.4
Name: rare-platform-sdk
Version: 0.1.1
Summary: Rare platform integration kit for Python services
License-Expression: Apache-2.0
Project-URL: Homepage, https://rareid.cc
Project-URL: Repository, https://github.com/Rare-ID/Rare
Project-URL: Documentation, https://github.com/Rare-ID/Rare/tree/main/packages/platform/python/rare-platform-sdk-python
Project-URL: Issues, https://github.com/Rare-ID/Rare/issues
Keywords: rare,platform,identity,delegation,attestation
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.115.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: rare-identity-protocol>=0.1.0
Requires-Dist: rare-identity-verifier>=0.1.0
Provides-Extra: redis
Requires-Dist: redis>=5.0.0; extra == "redis"
Provides-Extra: test
Requires-Dist: pytest>=8.2.0; extra == "test"

# rare-platform-sdk

Python toolkit for third-party platforms integrating Rare with local verification-first defaults.

## What It Is

`rare-platform-sdk` helps Python services issue Rare auth challenges, complete login, verify delegated signed actions, manage platform sessions, and optionally ingest signed negative-event signals back into Rare.

## Who It Is For

- Python and FastAPI platforms adding Rare login
- Backend teams that want local identity/delegation verification
- Integrators that need Redis-backed replay protection and session storage

## Quick Start

```bash
pip install rare-platform-sdk
```

```python
from rare_platform_sdk import (
    InMemoryChallengeStore,
    InMemoryReplayStore,
    InMemorySessionStore,
    RareApiClient,
    RarePlatformKitConfig,
    create_rare_platform_kit,
)

rare = RareApiClient(rare_base_url="https://api.rareid.cc")
kit = create_rare_platform_kit(
    RarePlatformKitConfig(
        aud="platform",
        rare_api_client=rare,
        challenge_store=InMemoryChallengeStore(),
        replay_store=InMemoryReplayStore(),
        session_store=InMemorySessionStore(),
    )
)
```

FastAPI integration:

```python
from fastapi import FastAPI
from rare_platform_sdk import create_fastapi_rare_router

app = FastAPI()
app.include_router(create_fastapi_rare_router(kit, prefix="/rare"))
```

## Production Notes

- Challenge nonces must be one-time use.
- Delegation replay protection must be atomic.
- Full identity mode requires `payload.aud == expected_aud`.
- Identity triad must match:
  `auth_complete.agent_id == delegation.agent_id == attestation.sub`
- Public identity mode is capped to `L1` effective governance.

## Development

```bash
pip install -r requirements-test.lock
pip install -e .[test] --no-deps
pytest -q
python -m build
```
