small corrections
This commit is contained in:
@@ -9,6 +9,7 @@ repos:
|
||||
- id: check-added-large-files
|
||||
- id: debug-statements
|
||||
- id: name-tests-test
|
||||
exclude: ^tests/test_data/
|
||||
- id: check-merge-conflict
|
||||
|
||||
# Python linting and formatting with Ruff
|
||||
|
||||
@@ -82,7 +82,7 @@ uv run python-encrypt-code generate-password
|
||||
Encrypt a Python module or package directory.
|
||||
|
||||
```bash
|
||||
uv run python-encrypt-code encrypt <source_path> -o <output.pec> -p <password> [-aad <json-string>]
|
||||
uv run python-encrypt-code encrypt <source> -o <output> -p <password> [-aad <json-string>]
|
||||
```
|
||||
|
||||
**Options:**
|
||||
@@ -97,12 +97,12 @@ uv run python-encrypt-code encrypt <source_path> -o <output.pec> -p <password> [
|
||||
Decrypt a file and extract contents to disk.
|
||||
|
||||
```bash
|
||||
uv run python-encrypt-code decrypt <encrypted_file> -o <output_dir>
|
||||
uv run python-encrypt-code decrypt <source> -o <output>
|
||||
```
|
||||
|
||||
**Options:**
|
||||
|
||||
- `encrypted.pec`: Path to encrypted file
|
||||
- `source`: Path to encrypted file
|
||||
- `-o, --output`: Directory to extract decrypted files
|
||||
|
||||
### `run-insecure`
|
||||
@@ -111,13 +111,13 @@ Decrypt and execute a Python script from an encrypted package.
|
||||
**N.B. this writes decrypted files to a temporary folder on the disk before executing!**
|
||||
|
||||
```bash
|
||||
uv run python-encrypt-code run-insecure <encrypted_file> --script <script_name>
|
||||
uv run python-encrypt-code run-insecure <source> --script <script>
|
||||
```
|
||||
|
||||
**Options:**
|
||||
|
||||
- `encrypted.pec`: Path to encrypted file
|
||||
- `-s, --script`: Python script to execute (default: `main.py`)
|
||||
- `source`: Path to encrypted file
|
||||
- `-s, --script`: Python script to execute
|
||||
|
||||
## Use Cases
|
||||
|
||||
@@ -129,8 +129,8 @@ export PASSWORD=$(uv run python-encrypt-code generate-password)
|
||||
uv run python-encrypt-code encrypt ./my_app -o my_app.pec -p ${PASSWORD}
|
||||
|
||||
# Setup your own authentication source and subclass the PasswordProvider
|
||||
# Distribute the .pec file to customers and let
|
||||
# them run it without seeing the source code
|
||||
# Distribute the .pec file to customers and
|
||||
# let them run it without seeing the source code
|
||||
uv run python-encrypt-code run-insecure ./my_app.pec -p ${PASSWORD} --script main.py
|
||||
```
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ from io import BytesIO
|
||||
import os
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
|
||||
from .data_zipper_interface import DataZipperInterface
|
||||
|
||||
@@ -44,7 +43,7 @@ class DataZipper(DataZipperInterface):
|
||||
@staticmethod
|
||||
def unzip_data(
|
||||
input_data: BytesIO,
|
||||
) -> Dict[str, BytesIO]:
|
||||
) -> dict[str, BytesIO]:
|
||||
"""Unzips the data of a zip file into memory.
|
||||
|
||||
Args:
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Definition of DataZipperInterface."""
|
||||
|
||||
from io import BytesIO
|
||||
from typing import Dict
|
||||
from abc import ABC, abstractmethod
|
||||
from pathlib import Path
|
||||
|
||||
@@ -26,7 +25,7 @@ class DataZipperInterface(ABC):
|
||||
@abstractmethod
|
||||
def unzip_data(
|
||||
input_data: BytesIO,
|
||||
) -> Dict[str, BytesIO]:
|
||||
) -> dict[str, BytesIO]:
|
||||
"""Unzips data from the input path and saves it in memory.
|
||||
|
||||
Args:
|
||||
|
||||
@@ -4,7 +4,6 @@ import os
|
||||
import json
|
||||
import base64
|
||||
import secrets
|
||||
from typing import Tuple
|
||||
|
||||
from .password_provider_interface import PasswordProviderInterface
|
||||
|
||||
@@ -30,7 +29,7 @@ class PasswordProviderExample(PasswordProviderInterface):
|
||||
return url_safe_string
|
||||
|
||||
@classmethod
|
||||
def get_decryption_keys(cls) -> Tuple[str, dict[str, str] | None]:
|
||||
def get_decryption_keys(cls) -> tuple[str, dict[str, str] | None]:
|
||||
"""Placeholder function to get decryption keys. Implement your own logic here.
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"""Definition of PasswordProviderInterface."""
|
||||
|
||||
from typing import Tuple
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
@@ -18,7 +17,7 @@ class PasswordProviderInterface(ABC):
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def get_decryption_keys(cls) -> Tuple[str, dict[str, str] | None]:
|
||||
def get_decryption_keys(cls) -> tuple[str, dict[str, str] | None]:
|
||||
"""Get decryption keys for decryption.
|
||||
|
||||
Returns:
|
||||
|
||||
Reference in New Issue
Block a user