hive-nectar 0.0.6__py3-none-any.whl → 0.0.9__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.9.dist-info}/METADATA +5 -3
- hive_nectar-0.0.9.dist-info/RECORD +91 -0
- nectar/__init__.py +1 -0
- nectar/account.py +44 -48
- 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 +527 -181
- 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/nodelist.py +83 -7
- nectar/price.py +6 -13
- nectar/rc.py +1 -2
- nectar/steem.py +3 -4
- nectar/storage.py +3 -4
- nectar/transactionbuilder.py +12 -3
- nectar/version.py +1 -1
- nectar/vote.py +8 -9
- nectar/wallet.py +1 -1
- nectarapi/__init__.py +1 -0
- nectarapi/exceptions.py +20 -14
- nectarapi/version.py +1 -1
- nectarbase/__init__.py +1 -0
- 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 +1 -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/operations.py +2 -0
- nectargraphenebase/signedtransactions.py +10 -9
- nectargraphenebase/types.py +9 -19
- nectargraphenebase/unsignedtransactions.py +21 -28
- nectargraphenebase/version.py +1 -1
- nectarstorage/__init__.py +21 -1
- nectarstorage/masterpassword.py +2 -3
- nectarstorage/sqlite.py +1 -1
- hive_nectar-0.0.6.dist-info/RECORD +0 -92
- nectargraphenebase/py23.py +0 -38
- {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.9.dist-info}/WHEEL +0 -0
- {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.9.dist-info}/entry_points.txt +0 -0
- {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.9.dist-info}/licenses/LICENSE.txt +0 -0
nectargraphenebase/ecdsasig.py
CHANGED
|
@@ -8,7 +8,6 @@ from binascii import hexlify
|
|
|
8
8
|
import ecdsa
|
|
9
9
|
|
|
10
10
|
from .account import PrivateKey, PublicKey
|
|
11
|
-
from .py23 import bytes_types, py23_bytes
|
|
12
11
|
|
|
13
12
|
log = logging.getLogger(__name__)
|
|
14
13
|
|
|
@@ -22,7 +21,7 @@ if not SECP256K1_MODULE:
|
|
|
22
21
|
|
|
23
22
|
SECP256K1_MODULE = "secp256k1"
|
|
24
23
|
SECP256K1_AVAILABLE = True
|
|
25
|
-
except:
|
|
24
|
+
except Exception:
|
|
26
25
|
try:
|
|
27
26
|
import secp256k1
|
|
28
27
|
|
|
@@ -31,26 +30,22 @@ if not SECP256K1_MODULE:
|
|
|
31
30
|
except ImportError:
|
|
32
31
|
try:
|
|
33
32
|
import cryptography
|
|
34
|
-
|
|
35
|
-
SECP256K1_MODULE = "cryptography"
|
|
36
|
-
CRYPTOGRAPHY_AVAILABLE = True
|
|
37
33
|
except ImportError:
|
|
38
34
|
SECP256K1_MODULE = "ecdsa"
|
|
35
|
+
else:
|
|
36
|
+
SECP256K1_MODULE = "cryptography"
|
|
37
|
+
CRYPTOGRAPHY_AVAILABLE = True
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
CRYPTOGRAPHY_AVAILABLE = True
|
|
51
|
-
except ImportError:
|
|
52
|
-
CRYPTOGRAPHY_AVAILABLE = False
|
|
53
|
-
log.debug("Cryptography not available")
|
|
39
|
+
try:
|
|
40
|
+
from cryptography.hazmat.backends import default_backend
|
|
41
|
+
from cryptography.hazmat.primitives import hashes
|
|
42
|
+
from cryptography.hazmat.primitives.asymmetric import ec
|
|
43
|
+
from cryptography.hazmat.primitives.asymmetric.utils import (
|
|
44
|
+
decode_dss_signature,
|
|
45
|
+
encode_dss_signature,
|
|
46
|
+
)
|
|
47
|
+
except ImportError:
|
|
48
|
+
pass
|
|
54
49
|
|
|
55
50
|
log.debug("Using SECP256K1 module: %s" % SECP256K1_MODULE)
|
|
56
51
|
|
|
@@ -76,7 +71,7 @@ def compressedPubkey(pk):
|
|
|
76
71
|
x = p.x()
|
|
77
72
|
y = p.y()
|
|
78
73
|
x_str = ecdsa.util.number_to_string(x, order)
|
|
79
|
-
return
|
|
74
|
+
return bytes(chr(2 + (y & 1)), "ascii") + x_str
|
|
80
75
|
|
|
81
76
|
|
|
82
77
|
def recover_public_key(digest, signature, i, message=None):
|
|
@@ -103,20 +98,20 @@ def recover_public_key(digest, signature, i, message=None):
|
|
|
103
98
|
Q = ecdsa.numbertheory.inverse_mod(r, order) * (s * R + (-e % order) * G)
|
|
104
99
|
|
|
105
100
|
if SECP256K1_MODULE == "cryptography" and message is not None:
|
|
106
|
-
if not isinstance(message,
|
|
107
|
-
message =
|
|
101
|
+
if not isinstance(message, bytes):
|
|
102
|
+
message = bytes(message, "utf-8")
|
|
108
103
|
sigder = encode_dss_signature(r, s)
|
|
109
104
|
try:
|
|
110
105
|
Q_point = Q.to_affine()
|
|
111
106
|
public_key = ec.EllipticCurvePublicNumbers(
|
|
112
107
|
Q_point.x(), Q_point.y(), ec.SECP256K1()
|
|
113
108
|
).public_key(default_backend())
|
|
114
|
-
except:
|
|
109
|
+
except Exception:
|
|
115
110
|
try:
|
|
116
111
|
public_key = ec.EllipticCurvePublicNumbers(
|
|
117
112
|
Q._Point__x, Q._Point__y, ec.SECP256K1()
|
|
118
113
|
).public_key(default_backend())
|
|
119
|
-
except:
|
|
114
|
+
except Exception:
|
|
120
115
|
Q_point = Q.to_affine()
|
|
121
116
|
public_key = ec.EllipticCurvePublicNumbers(
|
|
122
117
|
int(Q_point.x()), int(Q_point.y()), ec.SECP256K1()
|
|
@@ -136,8 +131,8 @@ def recoverPubkeyParameter(message, digest, signature, pubkey):
|
|
|
136
131
|
"""Use to derive a number that allows to easily recover the
|
|
137
132
|
public key from the signature
|
|
138
133
|
"""
|
|
139
|
-
if not isinstance(message,
|
|
140
|
-
message =
|
|
134
|
+
if not isinstance(message, bytes):
|
|
135
|
+
message = bytes(message, "utf-8")
|
|
141
136
|
for i in range(0, 4):
|
|
142
137
|
if SECP256K1_MODULE == "secp256k1":
|
|
143
138
|
sig = pubkey.ecdsa_recoverable_deserialize(signature, i)
|
|
@@ -155,7 +150,7 @@ def recoverPubkeyParameter(message, digest, signature, pubkey):
|
|
|
155
150
|
p_comp = hexlify(compressedPubkey(p))
|
|
156
151
|
p_string = hexlify(p.to_string())
|
|
157
152
|
if isinstance(pubkey, PublicKey):
|
|
158
|
-
pubkey_string =
|
|
153
|
+
pubkey_string = bytes(repr(pubkey), "latin")
|
|
159
154
|
else: # pragma: no cover
|
|
160
155
|
pubkey_string = hexlify(pubkey.to_string())
|
|
161
156
|
if p_string == pubkey_string or p_comp == pubkey_string:
|
|
@@ -169,13 +164,13 @@ def sign_message(message, wif, hashfn=hashlib.sha256):
|
|
|
169
164
|
:param str wif: Private key in
|
|
170
165
|
"""
|
|
171
166
|
|
|
172
|
-
if not isinstance(message,
|
|
173
|
-
message =
|
|
167
|
+
if not isinstance(message, bytes):
|
|
168
|
+
message = bytes(message, "utf-8")
|
|
174
169
|
|
|
175
170
|
digest = hashfn(message).digest()
|
|
176
171
|
priv_key = PrivateKey(wif)
|
|
177
172
|
if SECP256K1_MODULE == "secp256k1":
|
|
178
|
-
p =
|
|
173
|
+
p = bytes(priv_key)
|
|
179
174
|
ndata = secp256k1.ffi.new("const int *ndata")
|
|
180
175
|
ndata[0] = 0
|
|
181
176
|
while True:
|
|
@@ -220,7 +215,7 @@ def sign_message(message, wif, hashfn=hashlib.sha256):
|
|
|
220
215
|
break
|
|
221
216
|
else: # pragma: no branch # pragma: no cover
|
|
222
217
|
cnt = 0
|
|
223
|
-
p =
|
|
218
|
+
p = bytes(priv_key)
|
|
224
219
|
sk = ecdsa.SigningKey.from_string(p, curve=ecdsa.SECP256k1)
|
|
225
220
|
while 1:
|
|
226
221
|
cnt += 1
|
|
@@ -270,13 +265,13 @@ def sign_message(message, wif, hashfn=hashlib.sha256):
|
|
|
270
265
|
|
|
271
266
|
|
|
272
267
|
def verify_message(message, signature, hashfn=hashlib.sha256, recover_parameter=None):
|
|
273
|
-
if not isinstance(message,
|
|
274
|
-
message =
|
|
275
|
-
if not isinstance(signature,
|
|
276
|
-
signature =
|
|
277
|
-
if not isinstance(message,
|
|
268
|
+
if not isinstance(message, bytes):
|
|
269
|
+
message = bytes(message, "utf-8")
|
|
270
|
+
if not isinstance(signature, bytes):
|
|
271
|
+
signature = bytes(signature, "utf-8")
|
|
272
|
+
if not isinstance(message, bytes):
|
|
278
273
|
raise AssertionError()
|
|
279
|
-
if not isinstance(signature,
|
|
274
|
+
if not isinstance(signature, bytes):
|
|
280
275
|
raise AssertionError()
|
|
281
276
|
digest = hashfn(message).digest()
|
|
282
277
|
sig = signature[1:]
|
nectargraphenebase/objects.py
CHANGED
|
@@ -4,13 +4,12 @@ import json
|
|
|
4
4
|
from nectargraphenebase.types import Id, JsonObj, Optional, String
|
|
5
5
|
|
|
6
6
|
from .operationids import operations
|
|
7
|
-
from .py23 import integer_types, py23_bytes, string_types
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class Operation(object):
|
|
11
10
|
def __init__(self, op):
|
|
12
11
|
if isinstance(op, list) and len(op) == 2:
|
|
13
|
-
if isinstance(op[0],
|
|
12
|
+
if isinstance(op[0], int):
|
|
14
13
|
self.opId = op[0]
|
|
15
14
|
name = self.getOperationNameForId(self.opId)
|
|
16
15
|
else:
|
|
@@ -61,7 +60,7 @@ class Operation(object):
|
|
|
61
60
|
return class_
|
|
62
61
|
|
|
63
62
|
def __bytes__(self):
|
|
64
|
-
return
|
|
63
|
+
return bytes(Id(self.opId)) + bytes(self.op)
|
|
65
64
|
|
|
66
65
|
def __str__(self):
|
|
67
66
|
return json.dumps([self.opId, self.op.toJson()])
|
|
@@ -83,13 +82,13 @@ class GrapheneObject(object):
|
|
|
83
82
|
|
|
84
83
|
def __bytes__(self):
|
|
85
84
|
if self.data is None:
|
|
86
|
-
return
|
|
85
|
+
return bytes()
|
|
87
86
|
b = b""
|
|
88
87
|
for name, value in list(self.data.items()):
|
|
89
|
-
if isinstance(value,
|
|
90
|
-
b +=
|
|
88
|
+
if isinstance(value, str):
|
|
89
|
+
b += bytes(value, "utf-8")
|
|
91
90
|
else:
|
|
92
|
-
b +=
|
|
91
|
+
b += bytes(value)
|
|
93
92
|
return b
|
|
94
93
|
|
|
95
94
|
def __json__(self):
|
nectargraphenebase/operations.py
CHANGED
|
@@ -6,8 +6,6 @@ from collections import OrderedDict
|
|
|
6
6
|
|
|
7
7
|
import ecdsa
|
|
8
8
|
|
|
9
|
-
from nectargraphenebase.py23 import py23_bytes
|
|
10
|
-
|
|
11
9
|
from .account import PublicKey
|
|
12
10
|
from .chains import known_chains
|
|
13
11
|
from .ecdsasig import sign_message, verify_message
|
|
@@ -48,9 +46,12 @@ class Signed_Transaction(GrapheneObject):
|
|
|
48
46
|
if "signatures" not in kwargs:
|
|
49
47
|
kwargs["signatures"] = Array([])
|
|
50
48
|
else:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
)
|
|
49
|
+
# Defensive: if a string, wrap in a list and log warning
|
|
50
|
+
sigs = kwargs["signatures"]
|
|
51
|
+
if isinstance(sigs, str):
|
|
52
|
+
log.warning("signatures was a string, converting to list to avoid type errors.")
|
|
53
|
+
sigs = [sigs]
|
|
54
|
+
kwargs["signatures"] = Array([Signature(unhexlify(a)) for a in sigs])
|
|
54
55
|
|
|
55
56
|
if "operations" in kwargs:
|
|
56
57
|
opklass = self.getOperationKlass()
|
|
@@ -83,7 +84,7 @@ class Signed_Transaction(GrapheneObject):
|
|
|
83
84
|
self.data.pop("signatures", None)
|
|
84
85
|
|
|
85
86
|
# Generage Hash of the seriliazed version
|
|
86
|
-
h = hashlib.sha256(
|
|
87
|
+
h = hashlib.sha256(bytes(self)).digest()
|
|
87
88
|
|
|
88
89
|
# recover signatures
|
|
89
90
|
self.data["signatures"] = sigs
|
|
@@ -133,7 +134,7 @@ class Signed_Transaction(GrapheneObject):
|
|
|
133
134
|
# Get message to sign
|
|
134
135
|
# bytes(self) will give the wire formated data according to
|
|
135
136
|
# GrapheneObject and the data given in __init__()
|
|
136
|
-
self.message = unhexlify(self.chainid) +
|
|
137
|
+
self.message = unhexlify(self.chainid) + bytes(self)
|
|
137
138
|
self.digest = hashlib.sha256(self.message).digest()
|
|
138
139
|
|
|
139
140
|
# restore signatures
|
|
@@ -150,13 +151,13 @@ class Signed_Transaction(GrapheneObject):
|
|
|
150
151
|
|
|
151
152
|
for signature in signatures:
|
|
152
153
|
if recover_parameter:
|
|
153
|
-
p = verify_message(self.message,
|
|
154
|
+
p = verify_message(self.message, bytes(signature))
|
|
154
155
|
else:
|
|
155
156
|
p = None
|
|
156
157
|
if p is None:
|
|
157
158
|
for i in range(4):
|
|
158
159
|
try:
|
|
159
|
-
p = verify_message(self.message,
|
|
160
|
+
p = verify_message(self.message, bytes(signature), recover_parameter=i)
|
|
160
161
|
phex = hexlify(p).decode("ascii")
|
|
161
162
|
pubKeysFound.append(phex)
|
|
162
163
|
except Exception:
|
nectargraphenebase/types.py
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
import json
|
|
3
3
|
import struct
|
|
4
|
-
import sys
|
|
5
4
|
import time
|
|
6
5
|
from binascii import hexlify, unhexlify
|
|
7
6
|
from calendar import timegm
|
|
8
7
|
from datetime import datetime
|
|
9
8
|
|
|
10
|
-
from .py23 import py23_bytes
|
|
11
|
-
|
|
12
9
|
timeformat = "%Y-%m-%dT%H:%M:%S%Z"
|
|
13
10
|
|
|
14
11
|
|
|
@@ -247,7 +244,7 @@ class Array(object):
|
|
|
247
244
|
|
|
248
245
|
def __bytes__(self):
|
|
249
246
|
"""Returns bytes representation."""
|
|
250
|
-
return
|
|
247
|
+
return bytes(self.length) + b"".join([bytes(a) for a in self.data])
|
|
251
248
|
|
|
252
249
|
def __str__(self):
|
|
253
250
|
"""Returns data as string."""
|
|
@@ -271,10 +268,8 @@ class PointInTime(object):
|
|
|
271
268
|
"""Returns bytes representation."""
|
|
272
269
|
if isinstance(self.data, datetime):
|
|
273
270
|
unixtime = timegm(self.data.timetuple())
|
|
274
|
-
elif sys.version > "3":
|
|
275
|
-
unixtime = timegm(time.strptime((self.data + "UTC"), timeformat))
|
|
276
271
|
else:
|
|
277
|
-
unixtime = timegm(time.strptime((self.data + "UTC"), timeformat
|
|
272
|
+
unixtime = timegm(time.strptime((self.data + "UTC"), timeformat))
|
|
278
273
|
if unixtime < 0:
|
|
279
274
|
return struct.pack("<i", unixtime)
|
|
280
275
|
return struct.pack("<I", unixtime)
|
|
@@ -331,22 +326,17 @@ class Optional(object):
|
|
|
331
326
|
def __bytes__(self):
|
|
332
327
|
"""Returns data as bytes."""
|
|
333
328
|
if not self.data:
|
|
334
|
-
return
|
|
329
|
+
return bytes(Bool(0))
|
|
335
330
|
else:
|
|
336
|
-
return (
|
|
337
|
-
py23_bytes(Bool(1)) + py23_bytes(self.data)
|
|
338
|
-
if py23_bytes(self.data)
|
|
339
|
-
else py23_bytes(Bool(0))
|
|
340
|
-
)
|
|
331
|
+
return bytes(Bool(1)) + bytes(self.data)
|
|
341
332
|
|
|
342
333
|
def __str__(self):
|
|
343
334
|
"""Returns data as string."""
|
|
344
335
|
return str(self.data)
|
|
345
336
|
|
|
346
337
|
def isempty(self):
|
|
347
|
-
if
|
|
348
|
-
|
|
349
|
-
return not bool(py23_bytes(self.data))
|
|
338
|
+
"""Returns True if data is empty, False otherwise."""
|
|
339
|
+
return not self.data
|
|
350
340
|
|
|
351
341
|
|
|
352
342
|
class Static_variant(object):
|
|
@@ -359,7 +349,7 @@ class Static_variant(object):
|
|
|
359
349
|
|
|
360
350
|
def __bytes__(self):
|
|
361
351
|
"""Returns bytes representation."""
|
|
362
|
-
return varint(self.type_id) +
|
|
352
|
+
return varint(self.type_id) + bytes(self.data)
|
|
363
353
|
|
|
364
354
|
def __str__(self):
|
|
365
355
|
"""Returns data as string."""
|
|
@@ -378,7 +368,7 @@ class Map(object):
|
|
|
378
368
|
b = b""
|
|
379
369
|
b += varint(len(self.data))
|
|
380
370
|
for e in self.data:
|
|
381
|
-
b +=
|
|
371
|
+
b += bytes(e[0]) + bytes(e[1])
|
|
382
372
|
return b
|
|
383
373
|
|
|
384
374
|
def __str__(self):
|
|
@@ -395,7 +385,7 @@ class Id(object):
|
|
|
395
385
|
|
|
396
386
|
def __bytes__(self):
|
|
397
387
|
"""Returns bytes representation."""
|
|
398
|
-
return
|
|
388
|
+
return bytes(self.data)
|
|
399
389
|
|
|
400
390
|
def __str__(self):
|
|
401
391
|
"""Returns data as string."""
|
|
@@ -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/__init__.py
CHANGED
|
@@ -15,7 +15,27 @@ from .base import (
|
|
|
15
15
|
)
|
|
16
16
|
from .sqlite import SQLiteCommon, SQLiteFile
|
|
17
17
|
|
|
18
|
-
__all__ = [
|
|
18
|
+
__all__ = [
|
|
19
|
+
# submodules
|
|
20
|
+
"interfaces",
|
|
21
|
+
"masterpassword",
|
|
22
|
+
"base",
|
|
23
|
+
"sqlite",
|
|
24
|
+
"ram",
|
|
25
|
+
# store classes re-exported for convenience
|
|
26
|
+
"InRamConfigurationStore",
|
|
27
|
+
"InRamEncryptedKeyStore",
|
|
28
|
+
"InRamEncryptedTokenStore",
|
|
29
|
+
"InRamPlainKeyStore",
|
|
30
|
+
"InRamPlainTokenStore",
|
|
31
|
+
"SqliteConfigurationStore",
|
|
32
|
+
"SqliteEncryptedKeyStore",
|
|
33
|
+
"SqliteEncryptedTokenStore",
|
|
34
|
+
"SqlitePlainKeyStore",
|
|
35
|
+
"SqlitePlainTokenStore",
|
|
36
|
+
"SQLiteCommon",
|
|
37
|
+
"SQLiteFile",
|
|
38
|
+
]
|
|
19
39
|
|
|
20
40
|
|
|
21
41
|
def get_default_config_store(*args, **kwargs):
|
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
|
nectarstorage/sqlite.py
CHANGED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
nectar/__init__.py,sha256=YH9ietjJFhFxTPwQ3K9iw8VJZ__CNK5QTQeGcw1iKzk,503
|
|
2
|
-
nectar/account.py,sha256=ZstMVwgllIKoOSnTmSpL3o2okrkL3-qqTwmwZyJQxyI,172273
|
|
3
|
-
nectar/amount.py,sha256=Zpk-BAoRt1QjwO32CIBmXpCBIhyU1qHm_skYPjfboXg,18235
|
|
4
|
-
nectar/asciichart.py,sha256=DwPyZAqne6o9L_PPRtlw6Xj0QdOZ-aId1lpOnmbyc6Q,8828
|
|
5
|
-
nectar/asset.py,sha256=spGsJmlVQeZ6-oYhcwmQKsI3gpGmrpCzimYO1Qv4MtA,2725
|
|
6
|
-
nectar/block.py,sha256=7nXVaYt8_tu9TJD6Zcr4Vo3owK8Rv8VKueWygawml3U,16064
|
|
7
|
-
nectar/blockchain.py,sha256=FflzDKS3ByWRnYiOOE94la6ZgJ0QHihnOpqD9qRi6_0,49159
|
|
8
|
-
nectar/blockchaininstance.py,sha256=mrHuhHsR7h-becNe_bE8WieFqMFyz49s-LecmC_k134,93119
|
|
9
|
-
nectar/blockchainobject.py,sha256=ZlWeOWGMoHyATgw20YfPV47OYlwuOpO75hmf0c9IC_4,7095
|
|
10
|
-
nectar/blurt.py,sha256=cZoUyAdr_HdUTm8K3N-PyaFYfpBL_WmomFWeWTHbeIA,23070
|
|
11
|
-
nectar/cli.py,sha256=jYi_EGZKeML7fvVX3g59uqWsUPL2e72NkxM4qFFrjLM,227475
|
|
12
|
-
nectar/comment.py,sha256=Hqj1TL9vKCWmDnBikVG8yCl7hgAwPBfqN_pkDsjtaxo,46791
|
|
13
|
-
nectar/community.py,sha256=XyxIfdpIWart70MM2ojlZTfbKcRYr6qxGcWtEQNHfuI,17990
|
|
14
|
-
nectar/constants.py,sha256=lrspBwCz9BE0YZY10DMS98oPwwxgmI0LzFdlQ7v53Ig,4974
|
|
15
|
-
nectar/conveyor.py,sha256=dpvaVLaR48Tn56fkCUl5MoDQDcR3eLcrIKYm6ctZkRM,11265
|
|
16
|
-
nectar/discussions.py,sha256=n-4GnYvnDc5AwFdUHSA9wTfdCmLWHb9h06U4vWq05q4,66439
|
|
17
|
-
nectar/exceptions.py,sha256=fTwnJo0VxKrCLV6okNSkInyQLHOj0uaoBD8syq1h9Fw,2639
|
|
18
|
-
nectar/hive.py,sha256=ota3Ttp_K2Eyy34UyWnAdYhI8eEX1uS-CvzalaFqSvc,22254
|
|
19
|
-
nectar/hivesigner.py,sha256=olHHuLtBrjN8PgXfGTeMNzshwi7WtzdcrLuyYLBeIhk,13998
|
|
20
|
-
nectar/imageuploader.py,sha256=kQd-IKrF9K4D5F-vnm8iRC3AuJa-fpozTpKUkKSr0ig,2722
|
|
21
|
-
nectar/instance.py,sha256=oUAycW1q5ynM3M4O9a0drgY7e8UBExTj69aMxrOjxwg,3905
|
|
22
|
-
nectar/market.py,sha256=mlKKsq6DQ4WCLaqNnuuwbJM4qUiejy5pGdXIPKK2Sug,41972
|
|
23
|
-
nectar/memo.py,sha256=lTIuPrX-kPynOa-9q6kJHRzb9BfJjSf0kdpipwEXnY8,17777
|
|
24
|
-
nectar/message.py,sha256=lVGaydsxh8oMTS90khho3DtqxhzgIrt4NmjxwyP0X3k,13019
|
|
25
|
-
nectar/nodelist.py,sha256=3OPrfVVaI6Wza-yuqDfryoCgCA4dDUL64x6wwYqPSFA,15219
|
|
26
|
-
nectar/price.py,sha256=WV1ix2cuWHPIFq4cFJZD37ud-9BDBpvlv4BznI_cGTI,21270
|
|
27
|
-
nectar/profile.py,sha256=t-pqC2DZxzvTV2XLU6iZWT1NdHuk77A_iiisbA0QIOM,1921
|
|
28
|
-
nectar/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
|
-
nectar/rc.py,sha256=BAc88X1mObL2FQSm4ABhBsRfWDBHkee0SCigZ6QlA2c,12825
|
|
30
|
-
nectar/snapshot.py,sha256=_5hsrmJDpPoWTYtQGZ2grMMuuGBInOGS0ip9gv5-RJo,31696
|
|
31
|
-
nectar/steem.py,sha256=JwfO-dp7HT3mVEZVunHNp87gFbdO8e1tcpXQs_MygJ8,23916
|
|
32
|
-
nectar/storage.py,sha256=yYsWc12fOUKEAkSn5wKGS-wSvsac3sMVn6uzLu_pn8c,1855
|
|
33
|
-
nectar/transactionbuilder.py,sha256=j5PD3Wm_w9gHnKJ1Ug3sxz3RWPclWt-MQIO5ox027X8,25443
|
|
34
|
-
nectar/utils.py,sha256=OGeLuO_nYDAvcX-onrm4xjn1L0binq8Glelgg6RdlSo,18882
|
|
35
|
-
nectar/version.py,sha256=x7maU-a8H7SAAs06_OW-iZAEZ1HvGWVdSaQbjWOSVBQ,76
|
|
36
|
-
nectar/vote.py,sha256=sO_ukJMEcUO_WI-D2EwbAiiRLApRQ1fyiwyX7YSAiOk,20222
|
|
37
|
-
nectar/wallet.py,sha256=pgbiLJbwXKMiR7EOtuVFee6s3nAdpILHVQ5iPNy7zhs,16222
|
|
38
|
-
nectar/witness.py,sha256=88XYjhTRNhyu9hfIG0sm3Pg1hC9eooo3HhW5EhcaYps,23600
|
|
39
|
-
nectarapi/__init__.py,sha256=c0J2Z-lHOvkSch9bZS3LVQZjKku2XxnYMZToq7OAkfI,157
|
|
40
|
-
nectarapi/exceptions.py,sha256=FnS4-ywWDxEAtV65Hd-4XxAV7j1wRgtQRLIvIGxA0Xs,1824
|
|
41
|
-
nectarapi/graphenerpc.py,sha256=7woRA4CmuwqYrJU9E4LV3UdxaANHzIrKuWZPaxTcJnw,22642
|
|
42
|
-
nectarapi/node.py,sha256=mjK-fMFJ2icDaOUBoiUuDU-beo3aQK0HGwt0l0pC0YQ,5456
|
|
43
|
-
nectarapi/noderpc.py,sha256=FxJz1KbjU6FbNdyp7ovOSZ8TbmD_xqQclKjeBP42Jls,10093
|
|
44
|
-
nectarapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
|
-
nectarapi/rpcutils.py,sha256=0nKCrEeNHFSEU3AjaOGNh-2pjc8qw4mRA9lCrBkP1FQ,2910
|
|
46
|
-
nectarapi/version.py,sha256=x7maU-a8H7SAAs06_OW-iZAEZ1HvGWVdSaQbjWOSVBQ,76
|
|
47
|
-
nectarbase/__init__.py,sha256=U18vyJDvtsto3gHN9Fp3DHlcPd954sG06duHc72pNjs,234
|
|
48
|
-
nectarbase/ledgertransactions.py,sha256=97WXhNhcjNDf_XjXDD08lBMzYmvHC63oZMLRQqVNvWY,2545
|
|
49
|
-
nectarbase/memo.py,sha256=_-y9bxGr1DyEaD2-twVJ5Y-1ttFD-VJLyVAYzlT2ijw,7570
|
|
50
|
-
nectarbase/objects.py,sha256=ukBsUft2actWwlka2prwZkZtTKwLL0HgJfQtAvZfLIs,14894
|
|
51
|
-
nectarbase/objecttypes.py,sha256=zrKBFwoUJXvWDSn8RugWioKqf7TS7dY0EEXVAZv_-K0,690
|
|
52
|
-
nectarbase/operationids.py,sha256=wpKltPFlInpueyvLl3XCI2fjP9ziIs4MStoIj2mbPfQ,3645
|
|
53
|
-
nectarbase/operations.py,sha256=K-ypT0KMcRPjcoOuYyUhpRaRUv5FtAhfdc7kSqbFyCs,47628
|
|
54
|
-
nectarbase/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
|
-
nectarbase/signedtransactions.py,sha256=r-MRnEQDnx6U6XFPcM3hPXiDZvU6sQVx4Vv_0nZF7fs,1792
|
|
56
|
-
nectarbase/transactions.py,sha256=D7TK4Pkxr1N7p0Yh2bxvdXpOuEYpLl2tWK84Pj_93c0,319
|
|
57
|
-
nectarbase/version.py,sha256=x7maU-a8H7SAAs06_OW-iZAEZ1HvGWVdSaQbjWOSVBQ,76
|
|
58
|
-
nectargrapheneapi/__init__.py,sha256=_Gxdt_qaQQwwYABHEFBuf4tMh93ItIa3HPBH9nk1PTw,151
|
|
59
|
-
nectargrapheneapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
60
|
-
nectargraphenebase/__init__.py,sha256=PzB_0qiWfqJku5vKQs0CpkVeipPmZ33Fpc1px4VCV-Q,570
|
|
61
|
-
nectargraphenebase/account.py,sha256=pi3TFr6_CwGajdwDuAqlRGElmLhjBXlxC7mMOpc0vUU,29789
|
|
62
|
-
nectargraphenebase/aes.py,sha256=BywHJR8F7n2IBXhBmXqyc61DlVXcJ_QIE9qkubFdX2M,1578
|
|
63
|
-
nectargraphenebase/base58.py,sha256=NHvj7O6E94nX4BVK78u9IxAR8-QMIsasj6fj6yidm9Q,5552
|
|
64
|
-
nectargraphenebase/bip32.py,sha256=o2PZ37R1fZAg4YHPzvmCjp9qHNcC9Zkju_C1NRNUNbM,16274
|
|
65
|
-
nectargraphenebase/bip38.py,sha256=qSgH2_Y6kdcXLNI67qMmkjikI6aT4YET4R--GHT170Q,4530
|
|
66
|
-
nectargraphenebase/chains.py,sha256=JhaqY8qZaK-6OYf72RLVNxJtrc6yZtYxJm8p9U-i338,6185
|
|
67
|
-
nectargraphenebase/dictionary.py,sha256=Fooynl3XWE9ALy31jsVNb9CEHZh5N8TeJUAZJvqslnY,360748
|
|
68
|
-
nectargraphenebase/ecdsasig.py,sha256=BIaKNg4-_9ijo3xjbLfEmN0amIIVaK_yG5haUUevcEQ,12425
|
|
69
|
-
nectargraphenebase/objects.py,sha256=tYBvmAf7VU-06uDccRpFAQORGuOEtQd_jOqS3muK7zo,3998
|
|
70
|
-
nectargraphenebase/objecttypes.py,sha256=8YkRyxtd1hNZ06XvyHBRA5PatVeTd8XCFQmW_2p8MGk,160
|
|
71
|
-
nectargraphenebase/operationids.py,sha256=TLXB8FovmDwC39PNAR8OaW-NWyo1gFH0zE4ibShcMiI,65
|
|
72
|
-
nectargraphenebase/operations.py,sha256=fPTQ98sUtQRClAakBKPCGZjG0iIAAJqM5Y72Ip_HWWI,653
|
|
73
|
-
nectargraphenebase/prefix.py,sha256=tpX2_uz5lPveUoGbmXC4zsrG-5QsaVbIGIFPWJvYRbg,280
|
|
74
|
-
nectargraphenebase/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
75
|
-
nectargraphenebase/py23.py,sha256=aI1MAQ74DngxkjdpRlWEspmB1HNTQcpj3uHKo0b7rsM,784
|
|
76
|
-
nectargraphenebase/signedtransactions.py,sha256=y5tq9ijO_EXUpn77cHgqx55RcsY0Jr-lwj_r_0w7OHI,6947
|
|
77
|
-
nectargraphenebase/types.py,sha256=OZGVxgOoNPLiElNyDluUpmXNyREGzCEekZwq5uwPfGE,9771
|
|
78
|
-
nectargraphenebase/unsignedtransactions.py,sha256=HwhbWkWS1mYCJWKMsUI18PogEmZ5sVTWLPwolvM6ZR0,9522
|
|
79
|
-
nectargraphenebase/version.py,sha256=x7maU-a8H7SAAs06_OW-iZAEZ1HvGWVdSaQbjWOSVBQ,76
|
|
80
|
-
nectarstorage/__init__.py,sha256=AQXmR8clT9bO9SnIM8QEr5S8ZOpbKuG_BnBsDmGvec0,1347
|
|
81
|
-
nectarstorage/base.py,sha256=h7Oca1_RaJw39P1I_xXRKup016pS8zCLOs3e4IHKKdE,9734
|
|
82
|
-
nectarstorage/exceptions.py,sha256=0erk_d0Ejia9td_Ke7XFBl17H1BxbM42gFpkej8EbV0,421
|
|
83
|
-
nectarstorage/interfaces.py,sha256=WK2YR2mKUk1Qts50ZYLd407gECywA02A8iWr_p0KfCw,6786
|
|
84
|
-
nectarstorage/masterpassword.py,sha256=nyG90LeHeqEjXVbRT36gAWGe-MxyKGCfQ8SqvytK1no,8696
|
|
85
|
-
nectarstorage/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
86
|
-
nectarstorage/ram.py,sha256=Cy6JbMrlgcEG673_KqfyaofhAdJR-luRKTedj3qTZEE,1034
|
|
87
|
-
nectarstorage/sqlite.py,sha256=fkkDgi1lPv7lRo5wEAe4BzSVd2kDBGss3vCDYeNzDCs,10625
|
|
88
|
-
hive_nectar-0.0.6.dist-info/METADATA,sha256=pTDha7Q-J-O4yAJMXFs2FRPZnq8yH6xvMfGgZFfRI8w,6062
|
|
89
|
-
hive_nectar-0.0.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
90
|
-
hive_nectar-0.0.6.dist-info/entry_points.txt,sha256=DbqiJb5fFpQvGZ0ojvc2w3dXZitTg6FPz09CobKq4m8,47
|
|
91
|
-
hive_nectar-0.0.6.dist-info/licenses/LICENSE.txt,sha256=WjJRNR4r7FuLEO2BTBLGa05T7bBecGGgH47NgKsSY0E,1158
|
|
92
|
-
hive_nectar-0.0.6.dist-info/RECORD,,
|