hippius 0.2.33__tar.gz → 0.2.35__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.
Files changed (23) hide show
  1. {hippius-0.2.33 → hippius-0.2.35}/PKG-INFO +1 -1
  2. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/__init__.py +1 -1
  3. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/cli_handlers.py +13 -33
  4. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/substrate.py +11 -0
  5. {hippius-0.2.33 → hippius-0.2.35}/pyproject.toml +1 -1
  6. {hippius-0.2.33 → hippius-0.2.35}/README.md +0 -0
  7. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/cli.py +0 -0
  8. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/cli_assets.py +0 -0
  9. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/cli_parser.py +0 -0
  10. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/cli_rich.py +0 -0
  11. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/client.py +0 -0
  12. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/config.py +0 -0
  13. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/db/README.md +0 -0
  14. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/db/env.db.template +0 -0
  15. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/db/migrations/20241201000001_create_key_storage_tables.sql +0 -0
  16. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/db/migrations/20241202000001_switch_to_subaccount_encryption.sql +0 -0
  17. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/db/setup_database.sh +0 -0
  18. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/db_utils.py +0 -0
  19. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/errors.py +0 -0
  20. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/ipfs.py +0 -0
  21. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/ipfs_core.py +0 -0
  22. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/key_storage.py +0 -0
  23. {hippius-0.2.33 → hippius-0.2.35}/hippius_sdk/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hippius
3
- Version: 0.2.33
3
+ Version: 0.2.35
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
@@ -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.33"
29
+ __version__ = "0.2.35"
30
30
  __all__ = [
31
31
  "HippiusClient",
32
32
  "IPFSClient",
@@ -130,9 +130,7 @@ def create_client(args: Any) -> HippiusClient:
130
130
  ):
131
131
  needs_password = True
132
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
- ):
133
+ elif command == "pin" and not (hasattr(args, "no_publish") and args.no_publish):
136
134
  needs_password = True
137
135
 
138
136
  # If this command doesn't need password access, set to empty string to skip prompting
@@ -1258,35 +1256,17 @@ async def handle_erasure_code(
1258
1256
  )
1259
1257
  return 1
1260
1258
 
1261
- # Request password early if we're going to publish to the blockchain
1262
- if publish and client.substrate_client._seed_phrase is None:
1263
- # First check if we have an encrypted seed phrase that will require a password
1264
- config = load_config()
1265
- account_name = client.substrate_client._account_name or get_active_account()
1266
-
1267
- if account_name and account_name in config["substrate"].get("accounts", {}):
1268
- account_data = config["substrate"]["accounts"][account_name]
1269
- is_encoded = account_data.get("seed_phrase_encoded", False)
1270
-
1271
- if is_encoded:
1272
- warning("Wallet password will be required for publishing to blockchain")
1273
- password = getpass.getpass(
1274
- "Enter password to decrypt seed phrase: \n\n"
1275
- )
1276
-
1277
- # Store the password in client for later use
1278
- client.substrate_client._seed_phrase_password = password
1279
-
1280
- # Pre-authenticate to ensure the password is correct
1281
- try:
1282
- seed_phrase = decrypt_seed_phrase(password, account_name)
1283
- if not seed_phrase:
1284
- error("Failed to decrypt seed phrase. Incorrect password?")
1285
- return 1
1286
- client.substrate_client._seed_phrase = seed_phrase
1287
- except Exception as e:
1288
- error(f"Error decrypting seed phrase: {e}")
1289
- 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
+ )
1290
1270
 
1291
1271
  # Get file size
1292
1272
  file_size = os.path.getsize(file_path)
@@ -2126,7 +2106,7 @@ def handle_seed_phrase_set(
2126
2106
  return 1
2127
2107
 
2128
2108
  # Set the seed phrase
2129
- set_seed_phrase(seed_phrase, password, account_name)
2109
+ set_seed_phrase(seed_phrase, encode, password, account_name)
2130
2110
 
2131
2111
  # Gather information for the success panel
2132
2112
  status_info = []
@@ -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:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "hippius"
3
- version = "0.2.33"
3
+ version = "0.2.35"
4
4
  description = "Python SDK and CLI for Hippius blockchain storage"
5
5
  authors = ["Dubs <dubs@dubs.rs>"]
6
6
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes