Metadata-Version: 2.4
Name: sirraya-did-kr
Version: 2.1.2
Summary: A production-hardened enterprise solution for Decentralized Identifier (DID) key recovery by Sirraya Labs, offering three complementary recovery architectures—social threshold recovery with multiple guardians, deterministic seed-based recovery, and distributed MPC recovery with proactive security. Built with AES-256-GCM encryption, circuit breakers, audit logging, and metrics collection, it ensures secure key recovery without vendor lock-in. Deploy as a Python library, CLI tool, or REST API server.
Home-page: https://github.com/sirraya-labs/did-kr
Author: Amir Hameed Mir
Author-email: amsaalegal@gmail.com
License: Apache 2.0
Project-URL: Source Code, https://github.com/sirraya-labs/did-kr
Project-URL: W3C CCG Proposal, https://lists.w3.org/Archives/Public/public-credentials/2026Feb/0054.html
Project-URL: Bug Tracker, https://github.com/sirraya-labs/did-kr/issues
Keywords: did,decentralized-identifier,key-recovery,feldman-vss,secret-sharing,threshold-cryptography,self-sovereign-identity,w3c,sirraya
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Distributed Computing
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: cryptography>=41.0.0
Provides-Extra: flask
Requires-Dist: flask>=2.0.0; extra == "flask"
Requires-Dist: flask-cors>=4.0.0; extra == "flask"
Provides-Extra: eth
Requires-Dist: eth-account>=0.8.0; extra == "eth"
Requires-Dist: web3>=6.0.0; extra == "eth"
Provides-Extra: full
Requires-Dist: flask>=2.0.0; extra == "full"
Requires-Dist: flask-cors>=4.0.0; extra == "full"
Requires-Dist: eth-account>=0.8.0; extra == "full"
Requires-Dist: web3>=6.0.0; extra == "full"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Sirraya DID Key Recovery (DID-KR) Enterprise v2.1

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)

A **production-hardened** implementation of Decentralized Identifier (DID) key recovery by **Sirraya Labs**.

## 🏢 **Sirraya Labs - Enterprise Implementation**

This is the official reference implementation from Sirraya Labs, designed for enterprise-grade DID key recovery with production-ready security and mathematical rigor.

## 🔥 Key Features

- **Three Recovery Architectures**:
  - 🔐 **Social ZKP Recovery** - Feldman Verifiable Secret Sharing with t-of-n guardians
  - ⏰ **Deterministic Temporal Recovery** - Seed-based recovery with PBKDF2
  - 🤝 **MPC-Mediated Recovery** - Threshold cryptography with proactive refresh
  
- **Enterprise-Grade Security**:
  - AES-256-GCM encryption with AAD
  - Circuit breakers for fault tolerance
  - Comprehensive audit logging
  - Metrics collection
  
- **Multiple Interfaces**:
  - 🖥️ CLI tool
  - 🌐 REST API (Flask)
  - 📦 Python library

## 📦 Installation

```bash
# Basic installation (core crypto)
pip install sirraya-did-kr

# With API server support
pip install sirraya-did-kr[flask]

# With Ethereum DID support
pip install sirraya-did-kr[eth]

# Full installation (all features)
pip install sirraya-did-kr[full]
```

## 🚀 Quick Start

### As a CLI tool:
```bash
# Generate DIDs
sirraya-did-kr generate-dids --count 5

# Setup social recovery
sirraya-did-kr social-setup --did did:key:z6Mk... --guardians did:key:z6Mk... --threshold 2

# Start API server
sirraya-did-kr --api --port 8080
```

### As a Python library:
```python
from sirraya_did_kr import RecoveryService, RecoveryDatabase, MemoryCache

# Initialize
db = RecoveryDatabase("did_kr.db")
cache = MemoryCache()
service = RecoveryService(db, cache)

# Setup social recovery
result = service.setup_social_recovery(
    did="did:key:z6Mk...",
    guardian_dids=["did:key:z6Mk...", "did:key:z6Mk..."],
    threshold=2
)
print(f"Recovery setup: {result['recovery_id']}")
```

### As an API server:
```bash
# Terminal 1: Start the server
sirraya-did-kr --api --port 8080

# Terminal 2: Test the API
curl -X POST http://localhost:8080/api/v1/did/generate \
  -H "Content-Type: application/json" \
  -d '{"method": "key"}'
```

## 📚 Documentation

### API Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/health` | Health check |
| GET | `/metrics` | System metrics |
| POST | `/api/v1/did/generate` | Generate new DID |
| POST | `/api/v1/recovery/social/setup` | Setup social recovery |
| POST | `/api/v1/recovery/social/refresh/<did>` | Proactive refresh |
| POST | `/api/v1/recovery/deterministic/setup` | Setup seed recovery |
| POST | `/api/v1/recovery/deterministic/recover` | Recover with seed |
| POST | `/api/v1/recovery/mpc/setup` | Setup MPC recovery |
| GET | `/api/v1/recovery/validate/<did>` | Validate recovery graph |
| GET | `/api/v1/recovery/status/<did>` | Get recovery status |

### CLI Commands

```bash
sirraya-did-kr generate-dids [--count N] [--method key|ethr]
sirraya-did-kr social-setup --did DID --guardians DIDS... [--threshold N] [--auto-refresh DAYS]
sirraya-did-kr refresh --did DID
sirraya-did-kr det-setup --did DID --seed-phrase WORDS...
sirraya-did-kr det-recover --did DID --seed-phrase WORDS...
sirraya-did-kr mpc-setup --did DID --providers DIDS...
sirraya-did-kr status --did DID
sirraya-did-kr validate --did DID
sirraya-did-kr --api [--port PORT]
```

## 👨‍💻 Author

**Amir Hameed Mir** - *Principal Architect* - [Sirraya Labs](https://github.com/sirraya-labs)

## 📄 License

Apache 2.0 - See [LICENSE](LICENSE) file.

---
*Built by Sirraya Labs for production-grade decentralized identity systems*
