hippius 0.2.32__py3-none-any.whl → 0.2.34__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hippius
3
- Version: 0.2.32
3
+ Version: 0.2.34
4
4
  Summary: Python SDK and CLI for Hippius blockchain storage
5
5
  Home-page: https://github.com/thenervelab/hippius-sdk
6
6
  Author: Dubs
@@ -1,24 +1,24 @@
1
- hippius_sdk/__init__.py,sha256=8FFxrpAn61D-ViCK1aikqZ6-5TLbGt1T4kTHygQ1nfA,1474
1
+ hippius_sdk/__init__.py,sha256=c0zwjDuA4dbZ70JwwoWMYg4aS0pIRDlpXvAKhFoBbjc,1474
2
2
  hippius_sdk/cli.py,sha256=aqKOYSBSWt7UhcpFt7wf9yIPJ3bznpsJ6ehOnuZ4usI,18235
3
- hippius_sdk/cli_assets.py,sha256=V3MX63QTiex6mCp0VDXQJ7cagm5v1s4xtsu8c1O4G_k,371
4
- hippius_sdk/cli_handlers.py,sha256=TQNE9os87gRzRKLEO-SIwhFnBtEFMiaSESv-Bu7omfo,128909
3
+ hippius_sdk/cli_assets.py,sha256=rjH3Z5A1CQr2d5CIAAAb0WMCjoZZlMWcdo0f93KqluE,635
4
+ hippius_sdk/cli_handlers.py,sha256=1AwUhYtrQXXoIz6VYAGjcnM3l84FwKYdB46Up1DC4D4,128250
5
5
  hippius_sdk/cli_parser.py,sha256=z7UvgWvvy04ey-R56qZiCqYc_9RaNq1rVDkQyXoK3JU,21100
6
6
  hippius_sdk/cli_rich.py,sha256=_jTBYMdHi2--fIVwoeNi-EtkdOb6Zy_O2TUiGvU3O7s,7324
7
- hippius_sdk/client.py,sha256=4Y2OdoXay2tBOsZVvXyxXccDkmtQ3R8YTUtlAMZBKfU,22545
7
+ hippius_sdk/client.py,sha256=JIoKwq3YskuJO4YoRU8hJxVrCnk-t2oP6VDjEwZLIco,22666
8
8
  hippius_sdk/config.py,sha256=Hf_aUYzG9ylzqauA_ABUSSB5mBTYbp-VtB36VQt2XDw,21981
9
9
  hippius_sdk/db/README.md,sha256=okDeI1qgkaZqXSlJ8L0xIE4UpuxO-qEGPIbXUvSHQjU,2030
10
10
  hippius_sdk/db/env.db.template,sha256=_6hEC3IvkzCDOAzG1_yJUKRUfCTMciNaJUicZpMCat4,217
11
11
  hippius_sdk/db/migrations/20241201000001_create_key_storage_tables.sql,sha256=mi4-6OofgsmJq3PTG4ew8VNucoeb7iejyqd-bado7Mc,1613
12
12
  hippius_sdk/db/migrations/20241202000001_switch_to_subaccount_encryption.sql,sha256=jBBeo2UYlEQIsyyQRPf0YsAykWpGfafN2E6dlDwAA_E,1399
13
- hippius_sdk/db/setup_database.sh,sha256=bDeIiTnMuX0AYCdefAfEI1CyXho6A6kLzufsDZFSXpE,3118
13
+ hippius_sdk/db/setup_database.sh,sha256=STp03qxkp2RmIVr6YZIcvQQm-_LLUOb6Jobh-52HWmg,3115
14
14
  hippius_sdk/db_utils.py,sha256=-x0rbN0as7Tn3PJPZBYCgreZe52FLH40ppA1TLxsg90,1851
15
15
  hippius_sdk/errors.py,sha256=LScJJmawVAx7aRzqqQguYSkf9iazSjEQEBNlD_GXZ6Y,1589
16
- hippius_sdk/ipfs.py,sha256=1kjWAMeGMAn8vpIrrpjAxTHvnCwruhFtWjQ18iGXSU8,95383
16
+ hippius_sdk/ipfs.py,sha256=22xHOrOer2KHvSMepaUNRMYAK04L-AKyv8sEPSAYg7g,95429
17
17
  hippius_sdk/ipfs_core.py,sha256=eOOgLoyP9mvwndnCjldnTc7z94ImYCXY3nm7JU3e_Mo,12676
18
18
  hippius_sdk/key_storage.py,sha256=SXFd6aGQw9MDLGX2vSBuAY7rdX-k5EvFm63z7_n-8yQ,8148
19
- hippius_sdk/substrate.py,sha256=MFQcJARFw-Ej1WDSPGF8ryejXLmda5DdqcwPYS-KI10,49668
19
+ hippius_sdk/substrate.py,sha256=4a7UIE4UqGcDW7luKTBgSDqfb2OIZusB39G1UiRs_YU,50158
20
20
  hippius_sdk/utils.py,sha256=rJ611yvwKSyiBpYU3w-SuyQxoghMGU-ePuslrPv5H5g,7388
21
- hippius-0.2.32.dist-info/METADATA,sha256=8nDrlRkci7_eTNeKFQKsn2VDsQVSuAnT6esx9NVYyg8,30088
22
- hippius-0.2.32.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
23
- hippius-0.2.32.dist-info/entry_points.txt,sha256=bFAZjW3vndretf9-8s587jA2ebMVI7puhn_lVs8jPc8,149
24
- hippius-0.2.32.dist-info/RECORD,,
21
+ hippius-0.2.34.dist-info/METADATA,sha256=O2TPie_-lOL8W2K1p4VrULmZCi9DSviFQSa8f7dSEGk,30088
22
+ hippius-0.2.34.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
23
+ hippius-0.2.34.dist-info/entry_points.txt,sha256=bFAZjW3vndretf9-8s587jA2ebMVI7puhn_lVs8jPc8,149
24
+ hippius-0.2.34.dist-info/RECORD,,
hippius_sdk/__init__.py CHANGED
@@ -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.32"
29
+ __version__ = "0.2.34"
30
30
  __all__ = [
31
31
  "HippiusClient",
32
32
  "IPFSClient",
hippius_sdk/cli_assets.py CHANGED
@@ -1,7 +1,10 @@
1
1
  HERO_TITLE = """
2
- ┬┬┌─┐┌─┐┬┬ ┬┌─┐
3
- ├─┤│├─┘├─┘││ │└─┐
4
- ┴┴┴ ┴└─┘└─┘
2
+ ▄ █ ▄█ █ ▄▄ █ ▄▄ ▄█ ▄ ▄▄▄▄▄
3
+ █ █ ██ █ █ █ █ ██ █ █ ▀▄
4
+ ██▀▀█ ██ █▀▀▀ █▀▀▀ ██ █ █ ▄ ▀▀▀▀▄
5
+ █ █ ▐█ █ █ ▐█ █ █ ▀▄▄▄▄▀
6
+ █ ▐ █ █ ▐ █▄ ▄█
7
+ ▀ ▀ ▀ ▀▀▀
5
8
  """
6
9
  LOGIN_ASSET = """
7
10
  ┬ ┬┬┌─┐┌─┐┬┬ ┬┌─┐
@@ -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
- # Request password early if we're going to publish to the blockchain
1257
- if publish and client.substrate_client._seed_phrase is None:
1258
- # First check if we have an encrypted seed phrase that will require a password
1259
- config = load_config()
1260
- account_name = client.substrate_client._account_name or get_active_account()
1261
-
1262
- if account_name and account_name in config["substrate"].get("accounts", {}):
1263
- account_data = config["substrate"]["accounts"][account_name]
1264
- is_encoded = account_data.get("seed_phrase_encoded", False)
1265
-
1266
- if is_encoded:
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 LOGIN_ASSET
2921
+ from hippius_sdk.cli_assets import HERO_TITLE
2937
2922
 
2938
- console.print(LOGIN_ASSET, style="bold cyan")
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
  )
hippius_sdk/client.py CHANGED
@@ -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, cancel_from_blockchain, seed_phrase=seed_phrase
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)/hippius_s3/sql/sdk_migrations"
52
- dbmate --migrations-dir="hippius_s3/sql/sdk_migrations" up
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: seed_phrases, encryption_keys"
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"
hippius_sdk/ipfs.py CHANGED
@@ -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"] = {"Pins": [cid]} # Simulate successful unpin
1762
+ result["unpin_result"] = {
1763
+ "Pins": [cid]
1764
+ } # Simulate successful unpin
1763
1765
  result["success"] = True
1764
1766
  else:
1765
1767
  print(
hippius_sdk/substrate.py CHANGED
@@ -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: