Jynsec 0.2
JynPopMod Python Module

SECURTY utils: from Jynsec import *

### **1. `popinp`**

This function creates a simple input dialog using the `Tkinter` library to collect user input.

**Parameters:**
- `_p` (str): Prompt text for the input dialog.
- `_t` (str): Title of the input dialog (default is `"Input"`).

**Example Usage:**
```python
name = popinp("What's your name?", "Name Input")  # Prompts for the user's name
```

---

### **2. `genSK`**

Generates a time-based one-time password (TOTP) using the provided secret key. Useful for 2FA (Two-Factor Authentication).

**Parameters:**
- `secret_key` (str): Base32 encoded secret key.
- `time_step` (int): Time step in seconds (default is 30).
- `digits` (int): Number of digits in the generated OTP (default is 6).

**Example Usage:**
```python
otp = genSK("JBSWY3DPEHPK3PXP")  # Generates a 6-digit OTP
```

---

### **3. `generate_qr`**

Generates a QR code for TOTP authentication and saves it as `qrcode.png`.

**Parameters:**
- `secret_key` (str): Base32 encoded secret key.
- `app_name` (str): Name of the application.
- `user_name` (str): Name of the user.

**Example Usage:**
```python
generate_qr("JBSWY3DPEHPK3PXP", "MyApp", "User123")  # Generates a QR code
```

---

### **4. `verify_code`**

Verifies the user-provided OTP against the generated TOTP.

**Parameters:**
- `secret_key` (str): Base32 encoded secret key.
- `func` (callable): Function to call upon successful verification.
- `result_label` (`Tk.Label`): Label widget to display the verification result.
- `window` (`Tk`): The parent window for the dialog.

**Example Usage:**
```python
verify_code("JBSWY3DPEHPK3PXP", some_function, result_label, main_window)  # Verifies OTP
```

---

### **5. `show_qr`**

Displays a QR code for TOTP setup and allows the user to verify their code through a GUI.

**Parameters:**
- `func` (callable): Function to execute after successful verification.
- `app_name` (str): Application name.
- `user_name` (str): User name.

**Example Usage:**
```python
show_qr(my_function, "MyApp", "User123")  # Displays a QR code and allows OTP verification
```

---

### **6. `Jynauth`**

A wrapper for the TOTP authentication process. It integrates the QR code display and verification in one function.

**Parameters:**
- `func` (callable): Function to execute after successful verification.
- `user_name` (str): Name of the user.
- `app_name` (str): Name of the application.

**Example Usage:**
```python
Jynauth(my_function, "User123", "MyApp")  # Initiates TOTP authentication
```

---

### **7. `Jctb`**

Converts a string into a binary representation where each character is encoded as a 10-bit binary value.

**Parameters:**
- `input_string` (str): The string to convert.

**Example Usage:**
```python
binary_string = Jctb("Hello World")
print(binary_string)  # Outputs the binary representation
```

---

### **8. `Jbtc`**

Converts a binary string (generated by `Jctb`) back into its original text form.

**Parameters:**
- `binary_input` (str): Binary string to decode.

**Example Usage:**
```python
original_string = Jbtc(binary_string)
print(original_string)  # Outputs the original text
```