# beeos-bridge-client

Python SDK for connecting agents to the BeeOS Bridge server via Ed25519 authenticated WebSocket.

Mirrors the Node.js SDK (`@beeos-ai/bridge-client`) — same protocol, same key file format, fully interoperable.

## Install

```bash
pip install beeos-bridge-client
```

## Quick Start

```python
import asyncio
from beeos_bridge_client import BridgeClient, BridgeClientOptions

async def main():
    client = BridgeClient(BridgeClientOptions(
        bridge_url="wss://bridge.beeos.ai",
        service="acp",
        key_file="~/.beeos/device-agent.key",
    ))

    client.on("connected", lambda: print("Connected!"))
    client.on("message", lambda data: print("Received:", data))

    await client.connect()
    await client.send('{"jsonrpc":"2.0","method":"ping","id":1}')

asyncio.run(main())
```

## Key Management

```python
from beeos_bridge_client import generate_key_pair, load_key_pair, fingerprint

# Generate and save
kp = generate_key_pair(save_to="~/.beeos/key.json")

# Load (auto-generates if missing)
kp = load_key_pair("~/.beeos/key.json")

# Fingerprint (SHA-256 hex, matches Go Bridge)
print(fingerprint(kp.public_key))
```

Supports two key file formats (same as Node.js SDK):
1. JSON: `{"publicKey": "<base64>", "privateKey": "<base64>"}`
2. Raw base64 seed (32 bytes) — for K8s Secret mounts
