hyper-sdk 0.1.1__tar.gz → 0.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyper_sdk
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Hyper Solutions Python SDK
5
5
  Project-URL: homepage, https://github.com/Hyper-Solutions/hyper-sdk-py
6
6
  Classifier: Intended Audience :: Developers
@@ -34,6 +34,22 @@ class SecCptChallenge:
34
34
 
35
35
  return SecCptChallenge(duration, challenge_path, challenge_data)
36
36
 
37
+ @staticmethod
38
+ def parse_from_json(json_payload: str) -> 'SecCptChallenge':
39
+ api_response = json.loads(json_payload)
40
+
41
+ challenge_data = SecCptChallengeData(
42
+ api_response.get('token', ''),
43
+ api_response.get('timestamp', 0),
44
+ api_response.get('nonce', ''),
45
+ api_response.get('difficulty', 0)
46
+ )
47
+
48
+ duration = api_response.get('chlg_duration', 0)
49
+ challenge_path = api_response.get('branding_url_content', '')
50
+
51
+ return SecCptChallenge(duration, challenge_path, challenge_data)
52
+
37
53
  @staticmethod
38
54
  def _parse_challenge_data(src: str) -> SecCptChallengeData:
39
55
  challenge_match = sec_challenge_expr.search(src)
@@ -109,4 +125,4 @@ class SecCptChallenge:
109
125
  break
110
126
  continue
111
127
 
112
- return answers
128
+ return answers
@@ -106,7 +106,7 @@ class Session:
106
106
  def generate_signature(self) -> str:
107
107
  claims = {
108
108
  "key": self.api_key,
109
- "exp": datetime.now(timezone.utc) + timedelta(seconds=15)
109
+ "exp": datetime.now(timezone.utc) + timedelta(seconds=60)
110
110
  }
111
111
  token = jwt.encode(claims, self.jwt_key, algorithm='HS256')
112
112
  return token.decode('utf-8')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyper_sdk
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Hyper Solutions Python SDK
5
5
  Project-URL: homepage, https://github.com/Hyper-Solutions/hyper-sdk-py
6
6
  Classifier: Intended Audience :: Developers
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hyper_sdk"
7
- version = "0.1.1"
7
+ version = "0.1.2"
8
8
  description = "Hyper Solutions Python SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.6"
File without changes
File without changes
File without changes