dominusnode-camel 1.2.0__tar.gz → 1.2.1__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.

Potentially problematic release.


This version of dominusnode-camel might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dominusnode-camel
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: Dominus Node rotating proxy tools for CAMEL-AI agents
5
5
  License: MIT
6
6
  Requires-Python: >=3.10
@@ -41,6 +41,7 @@ Requires: httpx (``pip install httpx``), camel-ai (``pip install camel-ai``)
41
41
 
42
42
  from __future__ import annotations
43
43
 
44
+ import hashlib
44
45
  import ipaddress
45
46
  import json
46
47
  import math
@@ -380,6 +381,46 @@ def _sanitize_error(message: str) -> str:
380
381
  return _CREDENTIAL_RE.sub("***", message)
381
382
 
382
383
 
384
+ def _count_leading_zero_bits(data: bytes) -> int:
385
+ """Count leading zero bits in a byte array."""
386
+ count = 0
387
+ for byte in data:
388
+ if byte == 0:
389
+ count += 8
390
+ else:
391
+ mask = 0x80
392
+ while mask and not (byte & mask):
393
+ count += 1
394
+ mask >>= 1
395
+ break
396
+ return count
397
+
398
+
399
+ def _solve_pow(base_url: str) -> Optional[dict]:
400
+ """Solve a Proof-of-Work challenge for CAPTCHA-free registration."""
401
+ try:
402
+ pow_url = f"{base_url.rstrip('/')}/api/auth/pow/challenge"
403
+ with httpx.Client(timeout=30.0, follow_redirects=False) as client:
404
+ resp = client.post(pow_url, headers={"Content-Type": "application/json"})
405
+ if resp.status_code >= 400:
406
+ return None
407
+ challenge = resp.json()
408
+ prefix = challenge.get("prefix", "")
409
+ difficulty = challenge.get("difficulty", 20)
410
+ challenge_id = challenge.get("challengeId", "")
411
+ if not prefix or not challenge_id:
412
+ return None
413
+ nonce = 0
414
+ while nonce < 100_000_000:
415
+ h = hashlib.sha256((prefix + str(nonce)).encode()).digest()
416
+ if _count_leading_zero_bits(h) >= difficulty:
417
+ return {"challengeId": challenge_id, "nonce": str(nonce)}
418
+ nonce += 1
419
+ return None
420
+ except Exception:
421
+ return None
422
+
423
+
383
424
  # ---------------------------------------------------------------------------
384
425
  # Prototype pollution prevention
385
426
  # ---------------------------------------------------------------------------
@@ -1826,11 +1867,17 @@ class DominusNodeToolkit:
1826
1867
  return {"error": err}
1827
1868
 
1828
1869
  try:
1870
+ body: dict = {"email": email, "password": password}
1871
+ pow_result = _solve_pow(self.base_url)
1872
+ if pow_result:
1873
+ body["pow"] = pow_result
1829
1874
  result = self._unauthenticated_request(
1830
1875
  "POST",
1831
1876
  "/api/auth/register",
1832
- {"email": email, "password": password},
1877
+ body,
1833
1878
  )
1879
+ if pow_result and isinstance(result, dict):
1880
+ result["_pow_verified"] = True
1834
1881
  return result
1835
1882
  except Exception as e:
1836
1883
  return {"error": _sanitize_error(str(e))}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dominusnode-camel
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: Dominus Node rotating proxy tools for CAMEL-AI agents
5
5
  License: MIT
6
6
  Requires-Python: >=3.10
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dominusnode-camel"
7
- version = "1.2.0"
7
+ version = "1.2.1"
8
8
  description = "Dominus Node rotating proxy tools for CAMEL-AI agents"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}