Metadata-Version: 2.4
Name: nachalo
Version: 0.1.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security :: Cryptography
Summary: Python bindings for Nachalo (CPace + X25519 + ML-KEM-768 first contact from a few words) and Nachalo Channel v1.
Keywords: pake,cpace,ml-kem,post-quantum,handshake
Author: Ramsis Peñaloza
License-Expression: MIT OR Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/RamsisDev/Nachalo
Project-URL: Specification, https://github.com/RamsisDev/Nachalo/blob/main/spec/nachalo.md

# nachalo (Python)

Python bindings for [Nachalo](https://github.com/RamsisDev/Nachalo), generated by UniFFI and
built with maturin. One `py3-none-<platform>` wheel per platform serves every Python version,
because the generated code uses `ctypes`.

It exposes the live, appointment and physical-token handshakes and Nachalo Channel v1
(`spec/channel.md`). The protocol is a draft and has not been audited.

```python
import time
import nachalo

def clock():
    return nachalo.Clock(now=int(time.clock_gettime(time.CLOCK_MONOTONIC)), now_unix=int(time.time()))

config = nachalo.Config(nachalo.Profile.INTERACTIVE)
words = nachalo.words(6)                                  # A gives these to B out of band
a = nachalo.Initiator.start(nachalo.Invitation.live(words, b"my-app v1", config), b"A", clock())
answer = nachalo.Listener(nachalo.Invitation.live(words, b"my-app v1", config)).respond(a.msg1(), b"B", clock())
finished = a.finish(answer.msg2, clock())
b = answer.responder.finish(finished.msg3, clock())
established_a = finished.unconfirmed.verify(b.safety_words(), clock())   # A types what B reads
established_b = b.confirm(clock())

channel = nachalo.Channel.from_established(established_a, b"PEER-ID")
frame = channel.seal(nachalo.FrameKind.DATA, b"hola", int(time.time()))  # 512 bytes
```

Build locally:

```sh
cd bindings/python
maturin build --release          # or: maturin develop
python -m pytest tests
```

