hippius 0.2.21__py3-none-any.whl → 0.2.22__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.21
3
+ Version: 0.2.22
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,10 +1,10 @@
1
- hippius_sdk/__init__.py,sha256=GR_6lzziCmPq3cvSasIrT3n2Px3l6Jv1OXAEXDZ0fX0,1474
1
+ hippius_sdk/__init__.py,sha256=iVksJT4wiSP49OCa5MhECb_uiiL4zUJg6vGkdhd83J8,1474
2
2
  hippius_sdk/cli.py,sha256=aqKOYSBSWt7UhcpFt7wf9yIPJ3bznpsJ6ehOnuZ4usI,18235
3
3
  hippius_sdk/cli_assets.py,sha256=V3MX63QTiex6mCp0VDXQJ7cagm5v1s4xtsu8c1O4G_k,371
4
4
  hippius_sdk/cli_handlers.py,sha256=TQNE9os87gRzRKLEO-SIwhFnBtEFMiaSESv-Bu7omfo,128909
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=ktlv-s7H53h4zWcdz1EYf6fAqioohcFAxhRDKtljlEg,22252
7
+ hippius_sdk/client.py,sha256=Hj87gu5kapNM0V0-EgwJBsuA63HTsVHFGr2VnmwFH6I,22298
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
@@ -12,12 +12,12 @@ hippius_sdk/db/migrations/20241201000001_create_key_storage_tables.sql,sha256=mi
12
12
  hippius_sdk/db/setup_database.sh,sha256=bDeIiTnMuX0AYCdefAfEI1CyXho6A6kLzufsDZFSXpE,3118
13
13
  hippius_sdk/db_utils.py,sha256=-x0rbN0as7Tn3PJPZBYCgreZe52FLH40ppA1TLxsg90,1851
14
14
  hippius_sdk/errors.py,sha256=LScJJmawVAx7aRzqqQguYSkf9iazSjEQEBNlD_GXZ6Y,1589
15
- hippius_sdk/ipfs.py,sha256=QjqBYnhqzAiST3CNCCLxwPxEMGaV2iLwk_IBTp740wg,93188
15
+ hippius_sdk/ipfs.py,sha256=0ev7uRubsVDkr0003NVk4b9PnKAFSWVl4U9Yubs8kYk,93900
16
16
  hippius_sdk/ipfs_core.py,sha256=eOOgLoyP9mvwndnCjldnTc7z94ImYCXY3nm7JU3e_Mo,12676
17
17
  hippius_sdk/key_storage.py,sha256=oxfRRQXu8XVncUjhKJJ8rsc81JAkaj9MqZEwQa96idc,9474
18
- hippius_sdk/substrate.py,sha256=AqfQNl5Qv_s6roOESSdwleX0-VGyu5sh3m5-dYZp5ek,49079
18
+ hippius_sdk/substrate.py,sha256=-lIavQkfE6Kw2KzllH9IMgNkzl2d6vEmU3RmwKNJQvc,48093
19
19
  hippius_sdk/utils.py,sha256=rJ611yvwKSyiBpYU3w-SuyQxoghMGU-ePuslrPv5H5g,7388
20
- hippius-0.2.21.dist-info/METADATA,sha256=iBEURRYrrokbmCufUVrac5PlnWErQ72on4cycxevlqU,30088
21
- hippius-0.2.21.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
22
- hippius-0.2.21.dist-info/entry_points.txt,sha256=bFAZjW3vndretf9-8s587jA2ebMVI7puhn_lVs8jPc8,149
23
- hippius-0.2.21.dist-info/RECORD,,
20
+ hippius-0.2.22.dist-info/METADATA,sha256=bBkLq84px0hNLf4JXZKi1tGC1YrfN8dU_ZPzmDdHTUk,30088
21
+ hippius-0.2.22.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
22
+ hippius-0.2.22.dist-info/entry_points.txt,sha256=bFAZjW3vndretf9-8s587jA2ebMVI7puhn_lVs8jPc8,149
23
+ hippius-0.2.22.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.21"
29
+ __version__ = "0.2.22"
30
30
  __all__ = [
31
31
  "HippiusClient",
32
32
  "IPFSClient",
hippius_sdk/client.py CHANGED
@@ -517,7 +517,7 @@ class HippiusClient:
517
517
  encrypt: bool,
518
518
  seed_phrase: str,
519
519
  store_node: str = "http://localhost:5001",
520
- pin_node: str = "https://store.hippius.network"
520
+ pin_node: str = "https://store.hippius.network",
521
521
  ) -> S3PublishResult:
522
522
  """
523
523
  Publish a file to IPFS and the Hippius marketplace in one operation.
@@ -542,7 +542,9 @@ class HippiusClient:
542
542
  FileNotFoundError: If the file doesn't exist
543
543
  ValueError: If encryption is requested but not available
544
544
  """
545
- return await self.ipfs_client.s3_publish(file_path, encrypt, seed_phrase, store_node, pin_node)
545
+ return await self.ipfs_client.s3_publish(
546
+ file_path, encrypt, seed_phrase, store_node, pin_node
547
+ )
546
548
 
547
549
  async def s3_download(
548
550
  self,
@@ -550,7 +552,7 @@ class HippiusClient:
550
552
  output_path: str,
551
553
  seed_phrase: str,
552
554
  auto_decrypt: bool = True,
553
- download_node: str = "http://localhost:5001"
555
+ download_node: str = "http://localhost:5001",
554
556
  ) -> S3DownloadResult:
555
557
  """
556
558
  Download a file from IPFS with automatic decryption.
@@ -577,4 +579,6 @@ class HippiusClient:
577
579
  FileNotFoundError: If the output directory doesn't exist
578
580
  ValueError: If decryption fails
579
581
  """
580
- return await self.ipfs_client.s3_download(cid, output_path, seed_phrase, auto_decrypt, download_node)
582
+ return await self.ipfs_client.s3_download(
583
+ cid, output_path, seed_phrase, auto_decrypt, download_node
584
+ )
hippius_sdk/ipfs.py CHANGED
@@ -1932,7 +1932,7 @@ class IPFSClient:
1932
1932
  encrypt: bool,
1933
1933
  seed_phrase: str,
1934
1934
  store_node: str = "http://localhost:5001",
1935
- pin_node: str = "https://store.hippius.network"
1935
+ pin_node: str = "https://store.hippius.network",
1936
1936
  ) -> S3PublishResult:
1937
1937
  """
1938
1938
  Publish a file to IPFS and the Hippius marketplace in one operation.
@@ -2043,7 +2043,9 @@ class IPFSClient:
2043
2043
  cid = result["Hash"]
2044
2044
  logger.info(f"File uploaded to store node {store_node} with CID: {cid}")
2045
2045
  except Exception as e:
2046
- raise HippiusIPFSError(f"Failed to upload file to store node {store_node}: {str(e)}")
2046
+ raise HippiusIPFSError(
2047
+ f"Failed to upload file to store node {store_node}: {str(e)}"
2048
+ )
2047
2049
 
2048
2050
  # Step 2: Pin to pin_node (remote) for persistence and backup
2049
2051
  try:
@@ -2051,7 +2053,9 @@ class IPFSClient:
2051
2053
  await pin_client.pin(cid)
2052
2054
  logger.info(f"File pinned to backup node {pin_node}")
2053
2055
  except Exception as e:
2054
- raise HippiusIPFSError(f"Failed to pin file to store node {store_node}: {str(e)}")
2056
+ raise HippiusIPFSError(
2057
+ f"Failed to pin file to store node {store_node}: {str(e)}"
2058
+ )
2055
2059
 
2056
2060
  # Publish to substrate marketplace
2057
2061
  try:
@@ -2106,7 +2110,7 @@ class IPFSClient:
2106
2110
  output_path: str,
2107
2111
  seed_phrase: str,
2108
2112
  auto_decrypt: bool = True,
2109
- download_node: str = "http://localhost:5001"
2113
+ download_node: str = "http://localhost:5001",
2110
2114
  ) -> S3DownloadResult:
2111
2115
  """
2112
2116
  Download a file from IPFS with automatic decryption.
@@ -2153,7 +2157,9 @@ class IPFSClient:
2153
2157
  logger.info(f"File downloaded from {download_node} with CID: {cid}")
2154
2158
 
2155
2159
  except Exception as e:
2156
- raise HippiusIPFSError(f"Failed to download file from {download_node}: {str(e)}")
2160
+ raise HippiusIPFSError(
2161
+ f"Failed to download file from {download_node}: {str(e)}"
2162
+ )
2157
2163
 
2158
2164
  # Get file info after download
2159
2165
  size_bytes = os.path.getsize(output_path)
@@ -2184,8 +2190,12 @@ class IPFSClient:
2184
2190
  f"File may not exist on download node {download_node}. "
2185
2191
  f"Download URL: {download_url}"
2186
2192
  )
2187
- elif len(file_data) < 40: # PyNaCl encrypted data is at least 40 bytes (24-byte nonce + 16-byte auth tag + data)
2188
- logger.info(f"File too small to be encrypted ({len(file_data)} bytes), treating as plaintext")
2193
+ elif (
2194
+ len(file_data) < 40
2195
+ ): # PyNaCl encrypted data is at least 40 bytes (24-byte nonce + 16-byte auth tag + data)
2196
+ logger.info(
2197
+ f"File too small to be encrypted ({len(file_data)} bytes), treating as plaintext"
2198
+ )
2189
2199
  decrypted = False
2190
2200
  encryption_key_used = None
2191
2201
  else:
@@ -2199,7 +2209,9 @@ class IPFSClient:
2199
2209
  existing_key_b64 = await get_key_for_seed(seed_phrase)
2200
2210
 
2201
2211
  if existing_key_b64:
2202
- logger.debug("Found encryption key for seed phrase, attempting decryption")
2212
+ logger.debug(
2213
+ "Found encryption key for seed phrase, attempting decryption"
2214
+ )
2203
2215
  decryption_attempted = True
2204
2216
  encryption_key_used = existing_key_b64
2205
2217
 
@@ -2207,7 +2219,9 @@ class IPFSClient:
2207
2219
  try:
2208
2220
  import nacl.secret
2209
2221
 
2210
- encryption_key_bytes = base64.b64decode(existing_key_b64)
2222
+ encryption_key_bytes = base64.b64decode(
2223
+ existing_key_b64
2224
+ )
2211
2225
  box = nacl.secret.SecretBox(encryption_key_bytes)
2212
2226
  decrypted_data = box.decrypt(file_data)
2213
2227
 
@@ -2217,11 +2231,17 @@ class IPFSClient:
2217
2231
 
2218
2232
  decryption_successful = True
2219
2233
  decrypted = True
2220
- size_bytes = len(decrypted_data) # Update size to decrypted size
2221
- logger.info("Successfully decrypted file using stored key")
2234
+ size_bytes = len(
2235
+ decrypted_data
2236
+ ) # Update size to decrypted size
2237
+ logger.info(
2238
+ "Successfully decrypted file using stored key"
2239
+ )
2222
2240
 
2223
2241
  except Exception as decrypt_error:
2224
- logger.debug(f"Decryption failed with stored key: {decrypt_error}")
2242
+ logger.debug(
2243
+ f"Decryption failed with stored key: {decrypt_error}"
2244
+ )
2225
2245
  # Continue to try fallback decryption
2226
2246
  else:
2227
2247
  logger.debug("No encryption key found for seed phrase")
@@ -2243,7 +2263,9 @@ class IPFSClient:
2243
2263
 
2244
2264
  decryption_successful = True
2245
2265
  decrypted = True
2246
- size_bytes = len(decrypted_data) # Update size to decrypted size
2266
+ size_bytes = len(
2267
+ decrypted_data
2268
+ ) # Update size to decrypted size
2247
2269
 
2248
2270
  # Store the encryption key for the result
2249
2271
  encryption_key_used = (
@@ -2251,14 +2273,20 @@ class IPFSClient:
2251
2273
  if self.encryption_key
2252
2274
  else None
2253
2275
  )
2254
- logger.info("Successfully decrypted file using client encryption key")
2276
+ logger.info(
2277
+ "Successfully decrypted file using client encryption key"
2278
+ )
2255
2279
 
2256
2280
  except Exception as decrypt_error:
2257
- logger.debug(f"Decryption failed with client key: {decrypt_error}")
2281
+ logger.debug(
2282
+ f"Decryption failed with client key: {decrypt_error}"
2283
+ )
2258
2284
 
2259
2285
  # Log final decryption status
2260
2286
  if decryption_attempted and not decryption_successful:
2261
- logger.info("File may not be encrypted or decryption keys don't match")
2287
+ logger.info(
2288
+ "File may not be encrypted or decryption keys don't match"
2289
+ )
2262
2290
  elif not decryption_attempted:
2263
2291
  logger.debug("No decryption attempted - no keys available")
2264
2292
 
hippius_sdk/substrate.py CHANGED
@@ -1223,29 +1223,6 @@ class SubstrateClient:
1223
1223
  Returns:
1224
1224
  str: Transaction hash or status message
1225
1225
  """
1226
- # First check if this CID exists in the user's storage requests
1227
- try:
1228
- cid_exists = await self.check_storage_request_exists(cid)
1229
- if not cid_exists:
1230
- raise HippiusAlreadyDeletedError(
1231
- f"CID {cid} is not found in storage requests - may already be deleted"
1232
- )
1233
- except Exception as e:
1234
- if not isinstance(e, HippiusAlreadyDeletedError):
1235
- # If there was an error checking, but not our custom exception, wrap it
1236
- raise HippiusSubstrateConnectionError(
1237
- f"Error checking if CID exists: {str(e)}"
1238
- )
1239
- else:
1240
- # Re-raise our custom exception
1241
- raise
1242
-
1243
- # Continue with cancellation if it exists
1244
- if not self._ensure_keypair(seed_phrase):
1245
- raise HippiusSubstrateAuthError(
1246
- "Valid seed phrase must be provided or available in config"
1247
- )
1248
-
1249
1226
  # Initialize Substrate connection with seed phrase if needed
1250
1227
  if not self._substrate:
1251
1228
  self.connect(seed_phrase)