Metadata-Version: 2.4
Name: algebracripto
Version: 0.1.0
Summary: Gerador de carteiras cripto determinísticas baseadas em funções algébricas.
Author: Marcelo Meloni
Project-URL: Homepage, https://github.com/marcelomeloni/algebracripto
Project-URL: Bug Tracker, https://github.com/marcelomeloni/algebracripto/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ecdsa>=0.18.0
Requires-Dist: cryptography>=41.0.0
Provides-Extra: visualizer
Requires-Dist: matplotlib>=3.7.0; extra == "visualizer"
Requires-Dist: numpy>=1.24.0; extra == "visualizer"
Dynamic: license-file

# AlgebraCripto 📐🔐

> [!CAUTION]
> **STRICTLY EDUCATIONAL / EXPERIMENTAL** 
> This library implements custom cryptographic seed generation based on linear and geometric functions. It does not follow audited industry standards (like BIP-39 mnemonic phrases) and is highly experimental. **Do NOT use this library to store real funds on mainnets.** You are entirely responsible for any loss of funds if you decide to use this in production.
> 
> Furthermore, using "mental" attributes (like birth dates) as coordinates without a strong password results in extremely weak entropy. This makes funds vulnerable to rapid brute-force attacks!

AlgebraCripto is a Python library that generates deterministic cryptocurrency wallets (EVM and Solana) based on mental coordinates and algebraic functions. Instead of saving 12 standard words, you remember geometric figures, mathematical limits, and an **optional (but highly recommended)** strong password!

## Installation

To install the core library (for backend generation without visual plotting):

```bash
pip install algebracripto
```

If you plan to use the visual CLI generator to plot the mathematical paths to a PDF, you must install the optional visualizer dependencies:

```bash
pip install algebracripto[visualizer]
```

## How It Works

AlgebraCripto uses the formulas of geometric curves to generate entropy. You define an origin point (e.g., `Point(x, y)`) and provide a `password`. The engine generates a random curve passing through that point to find a "Recovery Point". 

The mathematical properties of this curve, combined securely with a PBKDF2 HMAC SHA256 KDF (using your password as a salt), derive a deterministic 32-byte seed.

> [!NOTE]
> **The Password Parameter (`password`) is 100% Optional.** 
> If you omit the password (e.g., `password=""`), the library will fall back to a static generic salt. This is useful for rapid local testing but provides **zero cryptographic protection** if your base coordinates are predictable (like a birth year). Always use a strong password for real use cases.

## Usage Example

### Core Usage (Generating a Wallet)

```python
from algebracripto import AlgebraCrypto, Point, Network

# 1. Initialize the Crypto Manager
wallet_manager = AlgebraCrypto()

# 2. Define a mental point and a strong password (optional but secure)
origin = Point(x=5421, y=9912)
my_password = "SuperStrongPassword123!"

# 3. Create a deterministic Line-based wallet
wallet = wallet_manager.create_line_wallet(
    origin=origin, 
    network=Network.EVM, 
    password=my_password
)

# 4. Save the recovery data
recovery_point = wallet.recovery_data["recovery_point"]
print(f"Write this down! Recovery X: {recovery_point.x}, Y: {recovery_point.y}")

# 5. Access your keys
print(f"EVM Public Key: {wallet.keys.public_key}")
print(f"EVM Private Key: {wallet.keys.private_key}")
```

### Recovering the Wallet

If you lose your private key but remember your `password`, your `origin` mental coordinates, and the `recovery_point`, you can recover the exact same wallet:

```python
recovered_keys = wallet_manager.recover_line_wallet(
    origin=origin, 
    recovery_point=recovery_point, 
    network=Network.EVM, 
    password=my_password
)

assert recovered_keys.private_key == wallet.keys.private_key
```

## Complete API Reference

The `AlgebraCrypto` main class orchestrates all wallet generation capabilities. All generation methods return a `WalletData` (containing the recovery data and keys), and recovery methods return the `WalletKeys` itself.

### Parameters shared across methods:
- `network` (`Network` Enum): Target network, either `Network.EVM` or `Network.SOLANA`. Defaults to `Network.EVM`.
- `password` (`str`): User passphrase converted into a cryptographic salt. Defaults to `""` (no password).

### 1. Line Curvature
- `create_line_wallet(origin: Point, network, password) -> WalletData`: Uses linear slope equations relative to the mental `origin`.
- `recover_line_wallet(origin: Point, recovery_point: Point, network, password) -> WalletKeys`

### 2. Pythagorean Circle
- `create_circle_wallet(center: Point, network, password) -> WalletData`: Uses the radius created from Pythagorean pairs from the `center` point.
- `recover_circle_wallet(center: Point, recovery_point: Point, network, password) -> WalletKeys`

### 3. Parabolic Bounds
- `create_parabola_wallet(vertex: Point, network, password) -> WalletData`: Generates a random parabola intersecting the `vertex`.
- `recover_parabola_wallet(vertex: Point, recovery_point: Point, network, password) -> WalletKeys`

### 4. Equation Intersections
- `create_intersection_wallet(m1: int, m2: int, network, password) -> WalletData`: Computes the geometric intersection point of two linear system coordinates defined by slopes `m1` and `m2`.
- `recover_intersection_wallet(m1: int, m2: int, intercept_1: int, intercept_2: int, network, password) -> WalletKeys`

### 5. Trigonometric Waves
- `create_wave_wallet(amplitude: int, network, target_peak: int = 7, password) -> WalletData`: Utilizes frequency-based trigonometry. `target_peak` defaults to `7`. 
- `recover_wave_wallet(amplitude: int, peak_x_coordinate: int, network, target_peak: int = 7, password) -> WalletKeys`
