Metadata-Version: 2.4
Name: lorica-sdk
Version: 0.1.0
Summary: Python SDK for the Lorica biometric verification API
Author-email: Tristan Linardos <tristan@loricaapi.com>
License: MIT
Project-URL: Homepage, https://loricaapi.com
Project-URL: Documentation, https://loricaapi.com/docs
Project-URL: Repository, https://github.com/LeoMirren/lorica
Project-URL: Demo, https://loricaapi.com/demo
Keywords: biometric,verification,identity,liveness,jwt,api
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# lorica

Python SDK for the [Lorica](https://loricaapi.com) biometric verification API.

Prove a human did it. One API call before any high-risk action. 16 security layers. Under 2 seconds. $0.05.

## Install

```bash
pip install lorica
```

## Quick Start

```python
from lorica import LoricaClient

client = LoricaClient("lrca_live_...")

# Enroll a user (once)
client.enroll(user_id="usr_123", image=face_base64)

# Verify before any high-risk action
result = client.verify(
    user_id="usr_123",
    image=face_base64,
    action_context="wire_transfer_50k",
    liveness_mode="passive"  # or "dual_frame" or "motion"
)

if result["match"]:
    jwt = result["token"]  # signed proof of authorization
    process_transfer(jwt)
else:
    block_action(result["rejection_reason"])
```

## Read Image from File

```python
image_b64 = LoricaClient.image_from_file("photo.jpg")
client.verify(user_id="usr_123", image=image_b64, action_context="trade")
```

## Multi-Party Verification

```python
result = client.verify_multi(
    verifications=[
        {"user_id": "trader_001", "image": trader_face, "role": "trader"},
        {"user_id": "risk_mgr", "image": manager_face, "role": "risk_manager"},
    ],
    action_context="otc_block_trade",
    require_all=True
)
# result["all_verified"] == True, result["token"] = single JWT
```

## Pre-Action Identity Lock

```python
lock = client.create_lock(
    user_id="usr_123",
    image=face_base64,
    action_context="multi_venue_execution",
    duration_seconds=120
)
# lock["session_id"], lock["expires_at"]

client.lock_heartbeat(lock["session_id"])  # extend
client.lock_revoke(lock["session_id"])     # revoke
```

## Analytics

```python
client.stats(period="30d")
client.user_report(user_id="usr_123")
client.billing_usage()
client.thresholds()  # AI-recommended thresholds
```

## Error Handling

```python
from lorica import LoricaClient
from lorica.client import LoricaError

try:
    result = client.verify(user_id="usr_123", image=face)
except LoricaError as e:
    print(e.status_code)  # 404
    print(e.error_code)   # "user_not_enrolled"
    print(e.message)      # "No enrollment found..."
```

## Links

- [Documentation](https://loricaapi.com/docs)
- [Live Demo](https://loricaapi.com/demo)
- [Security](https://loricaapi.com/security)
- [Blog](https://loricaapi.com/blog/)

## License

MIT
