Metadata-Version: 2.4
Name: rare-platform-sdk
Version: 0.2.0
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.3.0,>=8.2.0; extra == "test"

# rare-platform-sdk

Python toolkit for platforms integrating Rare with adoption-first defaults.

## Integration Modes

- `public-only / quickstart`: start here
- `full-mode / production`: add platform registration, durable stores, full attestation, and event ingest

Quickstart reduces first integration to:

- one required env: `PLATFORM_AUD`
- two auth endpoints
- one session dependency or helper

## Quickstart

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

```python
from rare_platform_sdk import (
    InMemoryChallengeStore,
    InMemoryReplayStore,
    InMemorySessionStore,
    create_rare_platform_kit_from_env,
)

challenge_store = InMemoryChallengeStore()
replay_store = InMemoryReplayStore()
session_store = InMemorySessionStore()

kit = create_rare_platform_kit_from_env(
    challenge_store=challenge_store,
    replay_store=replay_store,
    session_store=session_store,
)
```

Defaults:

- `RARE_BASE_URL=https://api.rareid.cc`
- `RARE_SIGNER_PUBLIC_KEY_B64` auto-discovered from Rare JWKS when omitted
- `PLATFORM_ID` derived from `PLATFORM_AUD` for full-mode workflows

## FastAPI

```python
from fastapi import Depends, FastAPI
from rare_platform_sdk import (
    create_fastapi_rare_router_from_env,
    create_fastapi_session_dependency,
)

app = FastAPI()
app.include_router(
    create_fastapi_rare_router_from_env(
        challenge_store=challenge_store,
        replay_store=replay_store,
        session_store=session_store,
        prefix="/rare",
    )
)

require_rare_session = create_fastapi_session_dependency(session_store)
```

FastAPI is the preferred Python integration path.

## Security Notes

Quickstart still enforces:

- challenge nonce one-time use
- delegation replay protection
- identity/delegation triad consistency
- local attestation verification
- public-mode governance cap to `L1`

## Production Notes

- Replace in-memory stores before production
- Move to full-mode only when platform registration or full attestation is required
- Keep bearer-token session transport supported even if you add cookie convenience helpers
