hive-nectar 0.0.6__py3-none-any.whl → 0.0.7__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.
Potentially problematic release.
This version of hive-nectar might be problematic. Click here for more details.
- {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/METADATA +5 -3
- {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/RECORD +46 -47
- nectar/account.py +43 -47
- nectar/amount.py +6 -11
- nectar/block.py +8 -9
- nectar/blockchain.py +4 -5
- nectar/blockchaininstance.py +4 -4
- nectar/blockchainobject.py +5 -6
- nectar/blurt.py +3 -4
- nectar/cli.py +14 -14
- nectar/comment.py +10 -11
- nectar/community.py +4 -5
- nectar/conveyor.py +3 -4
- nectar/exceptions.py +30 -24
- nectar/hive.py +3 -4
- nectar/hivesigner.py +2 -2
- nectar/imageuploader.py +2 -3
- nectar/price.py +6 -13
- nectar/rc.py +1 -2
- nectar/steem.py +3 -4
- nectar/transactionbuilder.py +12 -3
- nectar/version.py +1 -1
- nectar/vote.py +8 -9
- nectar/wallet.py +1 -1
- nectarapi/exceptions.py +20 -14
- nectarapi/version.py +1 -1
- nectarbase/ledgertransactions.py +2 -3
- nectarbase/memo.py +9 -10
- nectarbase/objects.py +4 -5
- nectarbase/operations.py +3 -7
- nectarbase/version.py +1 -1
- nectargraphenebase/__init__.py +0 -1
- nectargraphenebase/account.py +16 -37
- nectargraphenebase/base58.py +5 -8
- nectargraphenebase/bip32.py +5 -11
- nectargraphenebase/bip38.py +6 -7
- nectargraphenebase/ecdsasig.py +32 -37
- nectargraphenebase/objects.py +6 -7
- nectargraphenebase/signedtransactions.py +10 -9
- nectargraphenebase/types.py +9 -19
- nectargraphenebase/unsignedtransactions.py +21 -28
- nectargraphenebase/version.py +1 -1
- nectarstorage/masterpassword.py +2 -3
- nectargraphenebase/py23.py +0 -38
- {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/WHEEL +0 -0
- {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/entry_points.txt +0 -0
- {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -8,12 +8,9 @@ from collections import OrderedDict
|
|
|
8
8
|
import ecdsa
|
|
9
9
|
from asn1crypto.core import OctetString
|
|
10
10
|
|
|
11
|
-
from nectargraphenebase.py23 import py23_bytes
|
|
12
|
-
|
|
13
11
|
from .bip32 import parse_path
|
|
14
12
|
from .chains import known_chains
|
|
15
13
|
from .objects import Operation, isArgsThisClass
|
|
16
|
-
from .py23 import py23_chr, string_types
|
|
17
14
|
from .types import (
|
|
18
15
|
Array,
|
|
19
16
|
JsonObj,
|
|
@@ -46,22 +43,22 @@ class GrapheneObjectASN1(object):
|
|
|
46
43
|
|
|
47
44
|
def __bytes__(self):
|
|
48
45
|
if self.data is None:
|
|
49
|
-
return
|
|
46
|
+
return bytes()
|
|
50
47
|
b = b""
|
|
51
48
|
output = b""
|
|
52
49
|
for name, value in list(self.data.items()):
|
|
53
50
|
if name == "operations":
|
|
54
51
|
for operation in value:
|
|
55
|
-
if isinstance(value,
|
|
56
|
-
b =
|
|
52
|
+
if isinstance(value, str):
|
|
53
|
+
b = bytes(operation, "utf-8")
|
|
57
54
|
else:
|
|
58
|
-
b =
|
|
55
|
+
b = bytes(operation)
|
|
59
56
|
output += OctetString(b).dump()
|
|
60
57
|
elif name != "signatures":
|
|
61
|
-
if isinstance(value,
|
|
62
|
-
b =
|
|
58
|
+
if isinstance(value, str):
|
|
59
|
+
b = bytes(value, "utf-8")
|
|
63
60
|
else:
|
|
64
|
-
b =
|
|
61
|
+
b = bytes(value)
|
|
65
62
|
output += OctetString(b).dump()
|
|
66
63
|
return output
|
|
67
64
|
|
|
@@ -123,7 +120,7 @@ class Unsigned_Transaction(GrapheneObjectASN1):
|
|
|
123
120
|
operations_count = len(kwargs["operations"])
|
|
124
121
|
# opklass = self.getOperationKlass()
|
|
125
122
|
# if all([not isinstance(a, opklass) for a in kwargs["operations"]]):
|
|
126
|
-
# kwargs['operations'] = Array([opklass(a,
|
|
123
|
+
# kwargs['operations'] = Array([opklass(a, ) for a in kwargs["operations"]])
|
|
127
124
|
# else:
|
|
128
125
|
# kwargs['operations'] = (kwargs["operations"])
|
|
129
126
|
|
|
@@ -150,7 +147,7 @@ class Unsigned_Transaction(GrapheneObjectASN1):
|
|
|
150
147
|
self.data.pop("signatures", None)
|
|
151
148
|
|
|
152
149
|
# Generage Hash of the seriliazed version
|
|
153
|
-
h = hashlib.sha256(
|
|
150
|
+
h = hashlib.sha256(bytes(self)).digest()
|
|
154
151
|
|
|
155
152
|
# recover signatures
|
|
156
153
|
self.data["signatures"] = sigs
|
|
@@ -204,16 +201,16 @@ class Unsigned_Transaction(GrapheneObjectASN1):
|
|
|
204
201
|
for name, value in list(self.data.items()):
|
|
205
202
|
if name == "operations":
|
|
206
203
|
for operation in value:
|
|
207
|
-
if isinstance(value,
|
|
208
|
-
b =
|
|
204
|
+
if isinstance(value, str):
|
|
205
|
+
b = bytes(operation, "utf-8")
|
|
209
206
|
else:
|
|
210
|
-
b =
|
|
207
|
+
b = bytes(operation)
|
|
211
208
|
self.message += OctetString(b).dump()
|
|
212
209
|
elif name != "signatures":
|
|
213
|
-
if isinstance(value,
|
|
214
|
-
b =
|
|
210
|
+
if isinstance(value, str):
|
|
211
|
+
b = bytes(value, "utf-8")
|
|
215
212
|
else:
|
|
216
|
-
b =
|
|
213
|
+
b = bytes(value)
|
|
217
214
|
self.message += OctetString(b).dump()
|
|
218
215
|
|
|
219
216
|
self.digest = hashlib.sha256(self.message).digest()
|
|
@@ -251,16 +248,12 @@ class Unsigned_Transaction(GrapheneObjectASN1):
|
|
|
251
248
|
if first:
|
|
252
249
|
total_size = int(len(path)) + 1 + len(chunk)
|
|
253
250
|
apdu = (
|
|
254
|
-
unhexlify("d4040000")
|
|
255
|
-
+ py23_chr(total_size)
|
|
256
|
-
+ py23_chr(path_size)
|
|
257
|
-
+ path
|
|
258
|
-
+ chunk
|
|
251
|
+
unhexlify("d4040000") + bytes([total_size]) + bytes([path_size]) + path + chunk
|
|
259
252
|
)
|
|
260
253
|
first = False
|
|
261
254
|
else:
|
|
262
255
|
total_size = len(chunk)
|
|
263
|
-
apdu = unhexlify("d4048000") +
|
|
256
|
+
apdu = unhexlify("d4048000") + bytes([total_size]) + chunk
|
|
264
257
|
result.append(apdu)
|
|
265
258
|
offset += len(chunk)
|
|
266
259
|
return result
|
|
@@ -270,14 +263,14 @@ class Unsigned_Transaction(GrapheneObjectASN1):
|
|
|
270
263
|
if not request_screen_approval:
|
|
271
264
|
return (
|
|
272
265
|
unhexlify("d4020001")
|
|
273
|
-
+
|
|
274
|
-
+
|
|
266
|
+
+ bytes([int(len(path)) + 1])
|
|
267
|
+
+ bytes([int(len(path) / 4)])
|
|
275
268
|
+ path
|
|
276
269
|
)
|
|
277
270
|
else:
|
|
278
271
|
return (
|
|
279
272
|
unhexlify("d4020101")
|
|
280
|
-
+
|
|
281
|
-
+
|
|
273
|
+
+ bytes([int(len(path)) + 1])
|
|
274
|
+
+ bytes([int(len(path) / 4)])
|
|
282
275
|
+ path
|
|
283
276
|
)
|
nectargraphenebase/version.py
CHANGED
nectarstorage/masterpassword.py
CHANGED
|
@@ -8,7 +8,6 @@ from binascii import hexlify
|
|
|
8
8
|
|
|
9
9
|
from nectargraphenebase import bip38
|
|
10
10
|
from nectargraphenebase.aes import AESCipher
|
|
11
|
-
from nectargraphenebase.py23 import py23_bytes
|
|
12
11
|
|
|
13
12
|
from .exceptions import WalletLocked, WrongMasterPasswordException
|
|
14
13
|
|
|
@@ -192,7 +191,7 @@ class MasterPassword(object):
|
|
|
192
191
|
|
|
193
192
|
def deriveChecksum(self, s):
|
|
194
193
|
"""Derive the checksum"""
|
|
195
|
-
checksum = hashlib.sha256(
|
|
194
|
+
checksum = hashlib.sha256(bytes(s, "ascii")).hexdigest()
|
|
196
195
|
return checksum[:4]
|
|
197
196
|
|
|
198
197
|
def encrypt_text(self, txt):
|
|
@@ -216,7 +215,7 @@ class MasterPassword(object):
|
|
|
216
215
|
checksum, encrypted_text = enctxt.split("$")
|
|
217
216
|
try:
|
|
218
217
|
decrypted_text = aes.decrypt(encrypted_text)
|
|
219
|
-
except:
|
|
218
|
+
except Exception:
|
|
220
219
|
raise WrongMasterPasswordException
|
|
221
220
|
if checksum != self.deriveChecksum(decrypted_text):
|
|
222
221
|
raise WrongMasterPasswordException
|
nectargraphenebase/py23.py
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
import sys
|
|
3
|
-
|
|
4
|
-
PY2 = sys.version_info[0] == 2
|
|
5
|
-
PY3 = sys.version_info[0] == 3
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if PY3:
|
|
9
|
-
bytes_types = (bytes,)
|
|
10
|
-
string_types = (str,)
|
|
11
|
-
integer_types = (int,)
|
|
12
|
-
text_type = str
|
|
13
|
-
binary_type = bytes
|
|
14
|
-
else:
|
|
15
|
-
bytes_types = (bytes,)
|
|
16
|
-
string_types = (basestring,) # noqa: F821
|
|
17
|
-
integer_types = (int, long) # noqa: F821
|
|
18
|
-
text_type = unicode # noqa: F821
|
|
19
|
-
binary_type = str
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def py23_bytes(item=None, encoding=None):
|
|
23
|
-
if item is None:
|
|
24
|
-
return b""
|
|
25
|
-
if hasattr(item, "__bytes__"):
|
|
26
|
-
return item.__bytes__()
|
|
27
|
-
else:
|
|
28
|
-
if encoding:
|
|
29
|
-
return bytes(item, encoding)
|
|
30
|
-
else:
|
|
31
|
-
return bytes(item)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def py23_chr(item):
|
|
35
|
-
if PY2:
|
|
36
|
-
return chr(item)
|
|
37
|
-
else:
|
|
38
|
-
return bytes([item])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|