safeheron-api-sdk-python 1.1.4__tar.gz → 1.1.6__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.
- {safeheron_api_sdk_python-1.1.4/safeheron_api_sdk_python.egg-info → safeheron_api_sdk_python-1.1.6}/PKG-INFO +1 -1
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/README.md +7 -7
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python/api/account_api.py +1 -1
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python/client.py +1 -1
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python/cosigner/co_signer_converter.py +33 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6/safeheron_api_sdk_python.egg-info}/PKG-INFO +1 -1
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/setup.py +1 -1
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/LICENSE +0 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/README.rst +0 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python/api/coin_api.py +0 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python/api/mpc_sign_api.py +0 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python/api/transaction_api.py +0 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python/api/web3_api.py +0 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python/tools.py +0 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python/webhook/webhook_converter.py +0 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python.egg-info/SOURCES.txt +0 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python.egg-info/dependency_links.txt +0 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python.egg-info/requires.txt +0 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python.egg-info/top_level.txt +0 -0
- {safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/setup.cfg +0 -0
|
@@ -27,7 +27,7 @@ from safeheron_api_sdk_python.api.account_api import *
|
|
|
27
27
|
'privateKeyPemFile': './my_private.pem',
|
|
28
28
|
'safeheronPublicKey': 'MIICIjANBgkqhkiG9w0***********+zSdC+8eBdZyI7nMdPIj6xOhUCAwEAAQ==',
|
|
29
29
|
'baseUrl': 'https://api.safeheron.vip',
|
|
30
|
-
'RequestTimeout':
|
|
30
|
+
'RequestTimeout': 20000
|
|
31
31
|
}
|
|
32
32
|
```
|
|
33
33
|
* Call `create_account` api with `config`
|
|
@@ -56,8 +56,8 @@ from safeheron_api_sdk_python.api.account_api import *
|
|
|
56
56
|
safeheronPublicKey: MIICI****QuTOTECAwEAAQ==
|
|
57
57
|
# Safeheron API url
|
|
58
58
|
baseUrl: https://api.safeheron.vip
|
|
59
|
-
# RequestTimeout (Millisecond), Default:
|
|
60
|
-
requestTimeout:
|
|
59
|
+
# RequestTimeout (Millisecond), Default: 20000
|
|
60
|
+
requestTimeout: 20000
|
|
61
61
|
```
|
|
62
62
|
* Copy config to `config.yaml` file.
|
|
63
63
|
```bash
|
|
@@ -81,8 +81,8 @@ from safeheron_api_sdk_python.api.account_api import *
|
|
|
81
81
|
safeheronPublicKey: MIICI****QuTOTECAwEAAQ==
|
|
82
82
|
# Safeheron API url
|
|
83
83
|
baseUrl: https://api.safeheron.vip
|
|
84
|
-
# RequestTimeout (Millisecond), Default:
|
|
85
|
-
requestTimeout:
|
|
84
|
+
# RequestTimeout (Millisecond), Default: 20000
|
|
85
|
+
requestTimeout: 20000
|
|
86
86
|
# Wallet Account key
|
|
87
87
|
accountKey: account****5ecad40
|
|
88
88
|
# To address
|
|
@@ -111,8 +111,8 @@ from safeheron_api_sdk_python.api.account_api import *
|
|
|
111
111
|
safeheronPublicKey: MIICI****QuTOTECAwEAAQ==
|
|
112
112
|
# Safeheron API url
|
|
113
113
|
baseUrl: https://api.safeheron.vip
|
|
114
|
-
# RequestTimeout (Millisecond), Default:
|
|
115
|
-
requestTimeout:
|
|
114
|
+
# RequestTimeout (Millisecond), Default: 20000
|
|
115
|
+
requestTimeout: 20000
|
|
116
116
|
# Wallet Account key
|
|
117
117
|
accountKey: account****5ecad40
|
|
118
118
|
# Goerli testnet token address in wallet account
|
{safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python/client.py
RENAMED
|
@@ -10,7 +10,7 @@ class Client:
|
|
|
10
10
|
if config.get('requestTimeout'):
|
|
11
11
|
self.requestTimeout = config['requestTimeout'] / 1000
|
|
12
12
|
else:
|
|
13
|
-
self.requestTimeout =
|
|
13
|
+
self.requestTimeout = 20
|
|
14
14
|
if config.get('privateKey'):
|
|
15
15
|
self.use_private_key = PEM_PRIVATE_HEAD + config['privateKey'] + PEM_PRIVATE_END
|
|
16
16
|
if config.get('privateKeyPemFile'):
|
|
@@ -69,6 +69,7 @@ class CoSignerConverter:
|
|
|
69
69
|
|
|
70
70
|
return json.loads(r.decode())
|
|
71
71
|
|
|
72
|
+
# It has been Deprecated,Please use convertCoSignerResponseWithNewCryptoType
|
|
72
73
|
def response_converter(self, co_signer_response: CoSignerResponse):
|
|
73
74
|
platform_rsa_pk = get_rsa_key(PEM_PUBLIC_HEAD + self.api_pub_key + PEM_PUBLIC_END)
|
|
74
75
|
api_user_rsa_sk = get_rsa_key(PEM_PRIVATE_HEAD + self.biz_privKey + PEM_PRIVATE_END)
|
|
@@ -99,3 +100,35 @@ class CoSignerConverter:
|
|
|
99
100
|
ret['sig'] = rsa_sign(api_user_rsa_sk, need_sign_message)
|
|
100
101
|
|
|
101
102
|
return ret
|
|
103
|
+
|
|
104
|
+
def response_converter_with_new_crypto_type(self, co_signer_response: CoSignerResponse):
|
|
105
|
+
platform_rsa_pk = get_rsa_key(PEM_PUBLIC_HEAD + self.api_pub_key + PEM_PUBLIC_END)
|
|
106
|
+
api_user_rsa_sk = get_rsa_key(PEM_PRIVATE_HEAD + self.biz_privKey + PEM_PRIVATE_END)
|
|
107
|
+
|
|
108
|
+
ret = dict()
|
|
109
|
+
|
|
110
|
+
# prepare aes key and iv
|
|
111
|
+
aes_key = get_random_bytes(32)
|
|
112
|
+
aes_iv = get_random_bytes(16)
|
|
113
|
+
response_data = json.dumps(co_signer_response.__dict__).replace('\'', '\"').replace('\n', '').encode('utf-8')
|
|
114
|
+
|
|
115
|
+
# 1 rsa encrypt aes key + iv
|
|
116
|
+
aes_data = aes_key + aes_iv
|
|
117
|
+
ret['key'] = rsa_oaep_encrypt(platform_rsa_pk, aes_data)
|
|
118
|
+
|
|
119
|
+
# 2 aes encrypt request data
|
|
120
|
+
if response_data is not None:
|
|
121
|
+
aes_encrypted_bytes = aes_gcm_encrypt(aes_key, aes_iv, response_data)
|
|
122
|
+
ret['bizContent'] = b64encode(aes_encrypted_bytes).decode()
|
|
123
|
+
|
|
124
|
+
# 3 set timestamp
|
|
125
|
+
ret['timestamp'] = str(int(time.time() * 1000))
|
|
126
|
+
ret['code'] = str('200')
|
|
127
|
+
ret['message'] = str('SUCCESS')
|
|
128
|
+
|
|
129
|
+
# 4 sign request
|
|
130
|
+
need_sign_message = sort_request(ret)
|
|
131
|
+
ret['sig'] = rsa_sign(api_user_rsa_sk, need_sign_message)
|
|
132
|
+
ret['rsaType'] = ECB_OAEP_TYPE
|
|
133
|
+
ret['aesType'] = GCM_TYPE
|
|
134
|
+
return ret
|
|
@@ -3,7 +3,7 @@ from setuptools import find_packages
|
|
|
3
3
|
with open("README.rst", "r") as f:
|
|
4
4
|
long_description = f.read()
|
|
5
5
|
setup(name='safeheron_api_sdk_python',
|
|
6
|
-
version='1.1.
|
|
6
|
+
version='1.1.6',
|
|
7
7
|
description='Python for Safeheron API',
|
|
8
8
|
long_description=long_description,
|
|
9
9
|
author='safeheron',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{safeheron_api_sdk_python-1.1.4 → safeheron_api_sdk_python-1.1.6}/safeheron_api_sdk_python/tools.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|