PKHN L` bloqly.py"""Bloqly API""" __version__ = '0.4' import hashlib import nacl.signing from nacl.encoding import Base64Encoder, Base16Encoder def sign_transaction(private_key, space, tag, nonce, timestamp, value, memo=''): signing_key = nacl.signing.SigningKey(private_key, encoder=Base64Encoder) data = \ space.encode('utf-8') + \ tag.encode('utf-8') + \ nonce.to_bytes(8, 'big', signed=False) + \ timestamp.to_bytes(8, 'big', signed=False) + \ memo.encode('utf-8') + \ value.encode('utf-8') m = hashlib.sha256() m.update(data) tx_hash = m.digest() signed_message = signing_key.sign(tx_hash, encoder=Base64Encoder) signature = signed_message.signature.decode('utf-8') verify_key = signing_key.verify_key public_key = Base64Encoder.encode(bytes(verify_key)) signed_transaction = { 'space': space, 'tag': tag, 'nonce': nonce, 'timestamp': timestamp, 'memo': memo, 'value': value, 'hash': Base16Encoder.encode(tx_hash).decode('utf-8'), 'signature': signature, 'public_key': public_key.decode('utf-8') } return signed_transaction def encode_transaction(signed_transaction): tx_json = str(signed_transaction).replace('\'', '"').encode('utf-8') tx_bytes = bytes(tx_json) encoded_transaction = Base64Encoder.encode(tx_bytes).decode('utf-8') return encoded_transaction PK*BN-;<<bloqly-0.4.dist-info/LICENSEThe MIT License (MIT) Copyright (c) 2019 Bloqly developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HMuSabloqly-0.4.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,szd&Y)r$[)T&UD"PK!Hx bloqly-0.4.dist-info/METADATA]n0нb~ PVZQ!T4)!3fAm)vEw4PŪC*YJFQ iJk)(U 9ϋr}cMNl9*i$ oQ.o6gK?PK!H6[bloqly-0.4.dist-info/RECORDun0лҺtT; Tʰ2@@{YaTE*~%WY n}ɑ"L[pL&;NSkR MtWw*ac*A;|>'ٖh߃fp⭾΂E!fusƖc/Jr* _6QsO݋ xuK`ס`k۵xRYh'e8sܻ!XĊ3Sg1s` PKHN L` bloqly.pyPK*BN-;<<bloqly-0.4.dist-info/LICENSEPK!HMuSaF bloqly-0.4.dist-info/WHEELPK!Hx  bloqly-0.4.dist-info/METADATAPK!H6[ bloqly-0.4.dist-info/RECORDPK]