Metadata-Version: 2.4
Name: trisec
Version: 0.1.0a1
Summary: Configurable three-stage security protocol framework for Python
Author: IBrop
License-Expression: MIT
Project-URL: Homepage, https://github.com/IBrop/trisec
Project-URL: Repository, https://github.com/IBrop/trisec
Project-URL: Issues, https://github.com/IBrop/trisec/issues
Keywords: security,protocol,authentication,challenge-response,cryptography,server
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Classifier: Topic :: Security
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography>=42.0.0
Provides-Extra: dev
Requires-Dist: build>=1.2.2; extra == "dev"
Requires-Dist: twine>=5.1.1; extra == "dev"
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: aiohttp>=3.9.0; extra == "dev"
Dynamic: license-file

# TriSec

TriSec is a configurable three-stage security protocol framework for Python.

Core architecture:

```text
Sender
  ↓
Server 1 / Gate
  ↓
Server 2 / Verifier
  ↓
Server 3 / Executor
```

TSP/1 flow:

```text
HELLO
  ↓
CHALLENGE
  ↓
PROOF + PAYLOAD
  ↓
AUTHORIZED
  ↓
EXECUTOR
```

TriSec provides:

- HELLO → CHALLENGE → PROOF
- Ed25519 signatures
- anti-replay protection
- transaction expiry
- Sender identity verification
- configurable payloads
- customizable Executor
- configurable custom checks
- Primary / Secondary / Emergency channel model
- Vault enrollment and revocation

TriSec does **not** automatically collect device IDs, IP identities, Discord IDs,
browser fingerprints, or other application-specific data. The Sender sends only
the payload supplied by your application.

## Install

```bash
pip install trisec
```

For local development:

```bash
pip install -e ".[dev]"
```

## Minimal example

```python
import asyncio
from trisec import Vault, KeyPair, Gate, Verifier, Executor, Sender

async def main():
    vault = Vault()

    enrollment = vault.create_enrollment()

    sender_key = KeyPair.generate()
    registration = vault.register(enrollment, sender_key.public_b64())

    executor = Executor()

    @executor.action("hello")
    def hello(payload):
        return {"received": payload}

    gate_key = KeyPair.generate()
    verifier = Verifier(
        vault=vault,
        gate_public_key=gate_key.public_b64(),
        executor=executor,
    )
    gate = Gate(verifier=verifier, keypair=gate_key)

    sender = Sender(
        sender_id=registration.data["sender_id"],
        keypair=sender_key,
        primary=gate,
    )

    result = await sender.send(
        action="hello",
        payload={"message": "Hello from TriSec"},
    )

    print(result)

asyncio.run(main())
```

## Build

```bash
python -m pip install -e ".[dev]"
python -m pytest
python -m build
python -m twine check dist/*
```

## Security status

TriSec 0.1.0a1 is alpha software.

It has not undergone an independent security audit and should not yet be used
to protect production password vaults, financial systems, or other high-value
secrets.
