Metadata-Version: 2.4
Name: ethoryx
Version: 0.1.0
Summary: Official Python client for the Ethoryx prime-generation API (RSA, FHE, zk-SNARK, and NTT primes).
Project-URL: Homepage, https://ethoryx.io
Project-URL: Documentation, https://ethoryx.io/docs
Project-URL: Source, https://github.com/Teshgty/ethoryx-python
Project-URL: API Status, https://api.ethoryx.io/v1/status
Author-email: Ethoryx Research <research@ethoryx.io>
License: MIT
License-File: LICENSE
Keywords: cryptography,ethoryx,fhe,ntt,number-theory,prime,primes,rsa,zk-snark
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.8
Requires-Dist: requests>=2.20
Description-Content-Type: text/markdown

# ethoryx

Official Python client for the [Ethoryx](https://ethoryx.io) prime-generation API —
structurally-guided primes for **RSA, FHE, zk-SNARKs, and NTT**, backed by the Ethoryx
C/GMP core. Fewer Miller–Rabin tests, fewer candidates, same cryptographic strength.

- API: `https://api.ethoryx.io` · [Docs](https://ethoryx.io/docs) · [Status](https://api.ethoryx.io/v1/status)

## Install

```bash
pip install ethoryx
```

## Quick start

```python
import ethoryx

client = ethoryx.Client(api_key="tg_your_key")   # or set ETHORYX_API_KEY

# Generate primes
prime = client.generate(bits=2048)
rsa   = client.generate_rsa(bits=2048)
pair  = client.generate_rsa_pair(bits=2048)      # matched (p, q)
ntt   = client.generate_ntt(bits=256)
fhe   = client.generate_fhe(bits=2048)           # Starter tier or above

# Public endpoints — no API key required
ethoryx.verify(999983)                           # {"is_prime": true, ...}
ethoryx.optimize_next(prime=999983, gap=6)       # next-prime prediction
ethoryx.status()                                 # version, benchmarks
```

Get a free key (100 calls/month) at <https://ethoryx.io/register>.

## Authentication

Pass your key to the client, or set it once in the environment:

```bash
export ETHORYX_API_KEY="tg_your_key"
```

```python
client = ethoryx.Client()                 # picks up ETHORYX_API_KEY
```

The public endpoints (`verify`, `optimize_next`, `predict_gap`, `status`) work without a
key. Everything under `generate*` and `account*` requires one.

## API

| Method | Endpoint | Auth |
|--------|----------|------|
| `client.generate(bits=, method=)` | `GET /v1/generate` | 🔑 |
| `client.generate_rsa(bits=)` | `GET /v1/generate/rsa` | 🔑 |
| `client.generate_rsa_pair(bits=)` | `GET /v1/generate/rsa-pair` | 🔑 |
| `client.generate_ntt(bits=)` | `GET /v1/generate/ntt` | 🔑 |
| `client.generate_fhe(bits=)` | `GET /v1/generate/fhe` | 🔑 Starter+ |
| `client.generate_ecc(bits=)` | `GET /v1/generate/ecc` | 🔑 |
| `client.verify(n)` | `GET /v1/verify` | public |
| `client.optimize_next(prime=, gap=)` | `GET /v1/optimize/next` | public |
| `client.predict_gap(...)` | `GET /v1/predict/gap` | public |
| `client.account()` | `GET /v1/account` | 🔑 |
| `client.usage_history()` | `GET /v1/usage/history` | 🔑 |
| `client.status()` | `GET /v1/status` | public |

Every method returns the parsed JSON response as a `dict`.

## Errors

```python
from ethoryx import EthoryxError, AuthError, RateLimitError, APIError

try:
    client.generate(bits=2048)
except AuthError:
    ...        # missing/invalid key, or tier too low (401/403)
except RateLimitError:
    ...        # 429 — back off and retry
except APIError as e:
    print(e.status, e.response)
except EthoryxError:
    ...        # network/other
```

## License

MIT © Ethoryx Research
