hippius 0.2.31__tar.gz → 0.2.33__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.31 → hippius-0.2.33}/PKG-INFO +1 -1
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/__init__.py +1 -1
- hippius-0.2.33/hippius_sdk/cli_assets.py +13 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/cli_handlers.py +7 -2
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/client.py +6 -2
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/db/setup_database.sh +4 -3
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/ipfs.py +45 -31
- {hippius-0.2.31 → hippius-0.2.33}/pyproject.toml +1 -1
- hippius-0.2.31/hippius_sdk/cli_assets.py +0 -10
- {hippius-0.2.31 → hippius-0.2.33}/README.md +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/cli.py +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/cli_parser.py +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/cli_rich.py +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/config.py +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/db/README.md +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/db/env.db.template +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/db/migrations/20241201000001_create_key_storage_tables.sql +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/db/migrations/20241202000001_switch_to_subaccount_encryption.sql +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/db_utils.py +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/errors.py +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/ipfs_core.py +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/key_storage.py +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/hippius_sdk/substrate.py +0 -0
- {hippius-0.2.31 → hippius-0.2.33}/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.33"
|
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,11 @@ 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 (
|
134
|
+
hasattr(args, "no_publish") and args.no_publish
|
135
|
+
):
|
136
|
+
needs_password = True
|
132
137
|
|
133
138
|
# If this command doesn't need password access, set to empty string to skip prompting
|
134
139
|
if not needs_password:
|
@@ -2933,9 +2938,9 @@ def handle_account_login() -> int:
|
|
2933
2938
|
"""Handle the account login command - prompts for account details and creates an account"""
|
2934
2939
|
try:
|
2935
2940
|
# Display the login banner
|
2936
|
-
from hippius_sdk.cli_assets import
|
2941
|
+
from hippius_sdk.cli_assets import HERO_TITLE
|
2937
2942
|
|
2938
|
-
console.print(
|
2943
|
+
console.print(HERO_TITLE, style="bold cyan")
|
2939
2944
|
console.print(
|
2940
2945
|
"\n[bold blue]Welcome to Hippius![/bold blue] Let's set up your account.\n"
|
2941
2946
|
)
|
@@ -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"
|
@@ -1648,6 +1648,7 @@ class IPFSClient:
|
|
1648
1648
|
self,
|
1649
1649
|
cid: str,
|
1650
1650
|
cancel_from_blockchain: bool = True,
|
1651
|
+
unpin: bool = True,
|
1651
1652
|
seed_phrase: Optional[str] = None,
|
1652
1653
|
) -> Dict[str, Any]:
|
1653
1654
|
"""
|
@@ -1657,6 +1658,7 @@ class IPFSClient:
|
|
1657
1658
|
Args:
|
1658
1659
|
cid: Content Identifier (CID) of the file/directory to delete
|
1659
1660
|
cancel_from_blockchain: Whether to also cancel the storage request from the blockchain
|
1661
|
+
unpin: Whether to unpin the file from IPFS (default: True)
|
1660
1662
|
seed_phrase: Optional seed phrase to use for blockchain interactions (uses config if None)
|
1661
1663
|
|
1662
1664
|
Returns:
|
@@ -1709,21 +1711,26 @@ class IPFSClient:
|
|
1709
1711
|
):
|
1710
1712
|
# Recursive delete, but don't cancel from blockchain (we'll do that for parent)
|
1711
1713
|
await self.delete_file(
|
1712
|
-
link_hash, cancel_from_blockchain=False
|
1714
|
+
link_hash, cancel_from_blockchain=False, unpin=unpin
|
1713
1715
|
)
|
1714
1716
|
else:
|
1715
1717
|
# Regular file unpin
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1718
|
+
if unpin:
|
1719
|
+
try:
|
1720
|
+
await self.client.unpin(link_hash)
|
1721
|
+
print(
|
1722
|
+
f"Unpinned file: {link_name} (CID: {link_hash})"
|
1723
|
+
)
|
1724
|
+
except Exception as unpin_error:
|
1725
|
+
# Just note the error but don't let it stop the whole process
|
1726
|
+
# This is common with IPFS servers that may return 500 errors for
|
1727
|
+
# unpinning content that was never explicitly pinned
|
1728
|
+
print(
|
1729
|
+
f"Note: Could not unpin {link_name}: {str(unpin_error).split('For more information')[0]}"
|
1730
|
+
)
|
1731
|
+
else:
|
1725
1732
|
print(
|
1726
|
-
f"
|
1733
|
+
f"Skipped unpinning file: {link_name} (CID: {link_hash})"
|
1727
1734
|
)
|
1728
1735
|
except Exception as e:
|
1729
1736
|
print(
|
@@ -1737,27 +1744,34 @@ class IPFSClient:
|
|
1737
1744
|
# Continue with regular file unpin
|
1738
1745
|
|
1739
1746
|
# Now unpin the main file/directory
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
print("Successfully unpinned from IPFS")
|
1746
|
-
except Exception as e:
|
1747
|
-
# Handle 500 errors from IPFS server gracefully - they often occur
|
1748
|
-
# when the content wasn't explicitly pinned or was already unpinned
|
1749
|
-
error_str = str(e)
|
1750
|
-
if "500 Internal Server Error" in error_str:
|
1751
|
-
print(
|
1752
|
-
f"Note: IPFS server reported content may already be unpinned: {cid}"
|
1753
|
-
)
|
1754
|
-
result["unpin_result"] = {"Pins": [cid]} # Simulate successful unpin
|
1747
|
+
if unpin:
|
1748
|
+
try:
|
1749
|
+
print(f"Unpinning from IPFS: {cid}")
|
1750
|
+
unpin_result = await self.client.unpin(cid)
|
1751
|
+
result["unpin_result"] = unpin_result
|
1755
1752
|
result["success"] = True
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1753
|
+
print("Successfully unpinned from IPFS")
|
1754
|
+
except Exception as e:
|
1755
|
+
# Handle 500 errors from IPFS server gracefully - they often occur
|
1756
|
+
# when the content wasn't explicitly pinned or was already unpinned
|
1757
|
+
error_str = str(e)
|
1758
|
+
if "500 Internal Server Error" in error_str:
|
1759
|
+
print(
|
1760
|
+
f"Note: IPFS server reported content may already be unpinned: {cid}"
|
1761
|
+
)
|
1762
|
+
result["unpin_result"] = {
|
1763
|
+
"Pins": [cid]
|
1764
|
+
} # Simulate successful unpin
|
1765
|
+
result["success"] = True
|
1766
|
+
else:
|
1767
|
+
print(
|
1768
|
+
f"Warning: Failed to unpin from IPFS: {error_str.split('For more information')[0]}"
|
1769
|
+
)
|
1770
|
+
result["success"] = False
|
1771
|
+
else:
|
1772
|
+
print(f"Skipped unpinning from IPFS: {cid}")
|
1773
|
+
result["unpin_result"] = {"skipped": True}
|
1774
|
+
result["success"] = True
|
1761
1775
|
|
1762
1776
|
# Then, if requested, cancel from blockchain
|
1763
1777
|
if cancel_from_blockchain:
|
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
|
File without changes
|