hippius 0.2.32__tar.gz → 0.2.34__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hippius-0.2.32 → hippius-0.2.34}/PKG-INFO +1 -1
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/__init__.py +1 -1
- hippius-0.2.34/hippius_sdk/cli_assets.py +13 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/cli_handlers.py +16 -31
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/client.py +6 -2
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/db/setup_database.sh +4 -3
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/ipfs.py +3 -1
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/substrate.py +11 -0
- {hippius-0.2.32 → hippius-0.2.34}/pyproject.toml +1 -1
- hippius-0.2.32/hippius_sdk/cli_assets.py +0 -10
- {hippius-0.2.32 → hippius-0.2.34}/README.md +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/cli.py +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/cli_parser.py +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/cli_rich.py +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/config.py +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/db/README.md +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/db/env.db.template +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/db/migrations/20241201000001_create_key_storage_tables.sql +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/db/migrations/20241202000001_switch_to_subaccount_encryption.sql +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/db_utils.py +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/errors.py +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/ipfs_core.py +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/key_storage.py +0 -0
- {hippius-0.2.32 → hippius-0.2.34}/hippius_sdk/utils.py +0 -0
@@ -26,7 +26,7 @@ from hippius_sdk.config import (
|
|
26
26
|
from hippius_sdk.ipfs import IPFSClient, S3PublishResult, S3DownloadResult
|
27
27
|
from hippius_sdk.utils import format_cid, format_size, hex_to_ipfs_cid
|
28
28
|
|
29
|
-
__version__ = "0.2.
|
29
|
+
__version__ = "0.2.34"
|
30
30
|
__all__ = [
|
31
31
|
"HippiusClient",
|
32
32
|
"IPFSClient",
|
@@ -0,0 +1,13 @@
|
|
1
|
+
HERO_TITLE = """
|
2
|
+
▄ █ ▄█ █ ▄▄ █ ▄▄ ▄█ ▄ ▄▄▄▄▄
|
3
|
+
█ █ ██ █ █ █ █ ██ █ █ ▀▄
|
4
|
+
██▀▀█ ██ █▀▀▀ █▀▀▀ ██ █ █ ▄ ▀▀▀▀▄
|
5
|
+
█ █ ▐█ █ █ ▐█ █ █ ▀▄▄▄▄▀
|
6
|
+
█ ▐ █ █ ▐ █▄ ▄█
|
7
|
+
▀ ▀ ▀ ▀▀▀
|
8
|
+
"""
|
9
|
+
LOGIN_ASSET = """
|
10
|
+
┬ ┬┬┌─┐┌─┐┬┬ ┬┌─┐
|
11
|
+
├─┤│├─┘├─┘││ │└─┐
|
12
|
+
┴ ┴┴┴ ┴ ┴└─┘└─┘
|
13
|
+
"""
|
@@ -129,6 +129,9 @@ def create_client(args: Any) -> HippiusClient:
|
|
129
129
|
hasattr(args, "no_publish") and args.no_publish
|
130
130
|
):
|
131
131
|
needs_password = True
|
132
|
+
# Special case for pin - only needs password if we're publishing
|
133
|
+
elif command == "pin" and not (hasattr(args, "no_publish") and args.no_publish):
|
134
|
+
needs_password = True
|
132
135
|
|
133
136
|
# If this command doesn't need password access, set to empty string to skip prompting
|
134
137
|
if not needs_password:
|
@@ -1253,35 +1256,17 @@ async def handle_erasure_code(
|
|
1253
1256
|
)
|
1254
1257
|
return 1
|
1255
1258
|
|
1256
|
-
#
|
1257
|
-
if
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
warning("Wallet password will be required for publishing to blockchain")
|
1268
|
-
password = getpass.getpass(
|
1269
|
-
"Enter password to decrypt seed phrase: \n\n"
|
1270
|
-
)
|
1271
|
-
|
1272
|
-
# Store the password in client for later use
|
1273
|
-
client.substrate_client._seed_phrase_password = password
|
1274
|
-
|
1275
|
-
# Pre-authenticate to ensure the password is correct
|
1276
|
-
try:
|
1277
|
-
seed_phrase = decrypt_seed_phrase(password, account_name)
|
1278
|
-
if not seed_phrase:
|
1279
|
-
error("Failed to decrypt seed phrase. Incorrect password?")
|
1280
|
-
return 1
|
1281
|
-
client.substrate_client._seed_phrase = seed_phrase
|
1282
|
-
except Exception as e:
|
1283
|
-
error(f"Error decrypting seed phrase: {e}")
|
1284
|
-
return 1
|
1259
|
+
# If publishing is enabled, ensure we have a valid substrate client by accessing it
|
1260
|
+
# This will trigger password prompts if needed right at the beginning
|
1261
|
+
if publish and hasattr(client, "substrate_client") and client.substrate_client:
|
1262
|
+
try:
|
1263
|
+
# Force keypair initialization - this will prompt for password if needed
|
1264
|
+
_ = client.substrate_client._ensure_keypair()
|
1265
|
+
except Exception as e:
|
1266
|
+
warning(f"Failed to initialize blockchain client: {str(e)}")
|
1267
|
+
warning(
|
1268
|
+
"Will continue with erasure coding but blockchain publishing may fail"
|
1269
|
+
)
|
1285
1270
|
|
1286
1271
|
# Get file size
|
1287
1272
|
file_size = os.path.getsize(file_path)
|
@@ -2933,9 +2918,9 @@ def handle_account_login() -> int:
|
|
2933
2918
|
"""Handle the account login command - prompts for account details and creates an account"""
|
2934
2919
|
try:
|
2935
2920
|
# Display the login banner
|
2936
|
-
from hippius_sdk.cli_assets import
|
2921
|
+
from hippius_sdk.cli_assets import HERO_TITLE
|
2937
2922
|
|
2938
|
-
console.print(
|
2923
|
+
console.print(HERO_TITLE, style="bold cyan")
|
2939
2924
|
console.print(
|
2940
2925
|
"\n[bold blue]Welcome to Hippius![/bold blue] Let's set up your account.\n"
|
2941
2926
|
)
|
@@ -463,6 +463,7 @@ class HippiusClient:
|
|
463
463
|
cid: str,
|
464
464
|
cancel_from_blockchain: bool = True,
|
465
465
|
seed_phrase: Optional[str] = None,
|
466
|
+
unpin: bool = True,
|
466
467
|
) -> Dict[str, Any]:
|
467
468
|
"""
|
468
469
|
Delete a file from IPFS and optionally cancel its storage on the blockchain.
|
@@ -471,7 +472,7 @@ class HippiusClient:
|
|
471
472
|
cid: Content Identifier (CID) of the file to delete
|
472
473
|
cancel_from_blockchain: Whether to also cancel the storage request from the blockchain
|
473
474
|
seed_phrase: Optional seed phrase to use for blockchain interactions (uses config if None)
|
474
|
-
|
475
|
+
unpin: whether to unpin or not.
|
475
476
|
Returns:
|
476
477
|
Dict containing the result of the operation
|
477
478
|
|
@@ -479,7 +480,10 @@ class HippiusClient:
|
|
479
480
|
RuntimeError: If deletion fails completely
|
480
481
|
"""
|
481
482
|
return await self.ipfs_client.delete_file(
|
482
|
-
cid,
|
483
|
+
cid,
|
484
|
+
cancel_from_blockchain,
|
485
|
+
seed_phrase=seed_phrase,
|
486
|
+
unpin=unpin,
|
483
487
|
)
|
484
488
|
|
485
489
|
async def delete_ec_file(
|
@@ -39,6 +39,7 @@ echo " SSL Mode: $DB_SSLMODE"
|
|
39
39
|
|
40
40
|
# Construct DATABASE_URL for dbmate
|
41
41
|
export DATABASE_URL="postgresql://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME?sslmode=$DB_SSLMODE"
|
42
|
+
echo $DATABASE_URL
|
42
43
|
|
43
44
|
# Create database if it doesn't exist
|
44
45
|
echo "📝 Creating database $DB_NAME..."
|
@@ -48,8 +49,8 @@ PGPASSWORD=$DB_PASSWORD createdb -h $DB_HOST -p $DB_PORT -U $DB_USER $DB_NAME 2>
|
|
48
49
|
echo "🚀 Running database migrations..."
|
49
50
|
if command -v dbmate &> /dev/null; then
|
50
51
|
# Use explicit --migrations-dir flag to override any config
|
51
|
-
echo "📁 Using migrations from: $(pwd)/
|
52
|
-
dbmate --migrations-dir="
|
52
|
+
echo "📁 Using migrations from: $(pwd)/hippius_sdk/db/migrations"
|
53
|
+
dbmate --migrations-dir="hippius_sdk/db/migrations" up
|
53
54
|
echo "✅ Database migrations completed successfully!"
|
54
55
|
else
|
55
56
|
echo "❌ dbmate not found. Please install it first:"
|
@@ -80,7 +81,7 @@ echo "🎉 Setup complete! Key storage is ready to use."
|
|
80
81
|
echo ""
|
81
82
|
echo "📋 What was set up:"
|
82
83
|
echo " - Database: hippius_keys"
|
83
|
-
echo " - Tables:
|
84
|
+
echo " - Tables: encryption_keys"
|
84
85
|
echo " - SDK config: key_storage enabled"
|
85
86
|
echo ""
|
86
87
|
echo "🧪 Test with: python test_key_storage.py"
|
@@ -1759,7 +1759,9 @@ class IPFSClient:
|
|
1759
1759
|
print(
|
1760
1760
|
f"Note: IPFS server reported content may already be unpinned: {cid}"
|
1761
1761
|
)
|
1762
|
-
result["unpin_result"] = {
|
1762
|
+
result["unpin_result"] = {
|
1763
|
+
"Pins": [cid]
|
1764
|
+
} # Simulate successful unpin
|
1763
1765
|
result["success"] = True
|
1764
1766
|
else:
|
1765
1767
|
print(
|
@@ -165,6 +165,17 @@ class SubstrateClient:
|
|
165
165
|
)
|
166
166
|
return False
|
167
167
|
|
168
|
+
# Check if we have a pre-stored seed phrase first
|
169
|
+
if self._seed_phrase:
|
170
|
+
try:
|
171
|
+
self._keypair = Keypair.create_from_mnemonic(self._seed_phrase)
|
172
|
+
self._account_address = self._keypair.ss58_address
|
173
|
+
self._read_only = False
|
174
|
+
return True
|
175
|
+
except Exception as e:
|
176
|
+
print(f"Warning: Could not create keypair from stored seed phrase: {e}")
|
177
|
+
# Fall through to try config
|
178
|
+
|
168
179
|
# Otherwise, try to get the seed phrase from config
|
169
180
|
config_seed = get_seed_phrase(self._seed_phrase_password, self._account_name)
|
170
181
|
if config_seed:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|