mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 14:14:22 +01:00
More clean up
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import json
|
||||
from flask import Flask, request, Response, abort, jsonify
|
||||
|
||||
from pisa import HOST, PORT, logging, bitcoin_cli
|
||||
from pisa.watcher import Watcher
|
||||
from pisa.inspector import Inspector
|
||||
from pisa.appointment import Appointment
|
||||
|
||||
from pisa import HOST, PORT, logging, bitcoin_cli
|
||||
|
||||
# ToDo: #5-add-async-to-api
|
||||
app = Flask(__name__)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from pisa.rpc_errors import *
|
||||
from pisa import logging, bitcoin_cli
|
||||
from pisa.utils.auth_proxy import JSONRPCException
|
||||
from pisa.errors import UNKNOWN_JSON_RPC_EXCEPTION
|
||||
from pisa import logging, bitcoin_cli
|
||||
from pisa.rpc_errors import *
|
||||
|
||||
|
||||
class Carrier:
|
||||
|
||||
@@ -2,12 +2,14 @@ from hashlib import sha256
|
||||
from binascii import unhexlify, hexlify
|
||||
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
||||
|
||||
from pisa import logging
|
||||
|
||||
|
||||
class EncryptedBlob:
|
||||
def __init__(self, data):
|
||||
self.data = data
|
||||
|
||||
def decrypt(self, key, debug, logging):
|
||||
def decrypt(self, key):
|
||||
# master_key = H(tx_id | tx_id)
|
||||
master_key = sha256(key + key).digest()
|
||||
|
||||
@@ -15,12 +17,11 @@ class EncryptedBlob:
|
||||
sk = master_key[:16]
|
||||
nonce = master_key[16:]
|
||||
|
||||
if debug:
|
||||
logging.info("[Watcher] creating new blob")
|
||||
logging.info("[Watcher] master key: {}".format(hexlify(master_key).decode()))
|
||||
logging.info("[Watcher] sk: {}".format(hexlify(sk).decode()))
|
||||
logging.info("[Watcher] nonce: {}".format(hexlify(nonce).decode()))
|
||||
logging.info("[Watcher] encrypted_blob: {}".format(self.data))
|
||||
logging.info("[Watcher] creating new blob")
|
||||
logging.info("[Watcher] master key: {}".format(hexlify(master_key).decode()))
|
||||
logging.info("[Watcher] sk: {}".format(hexlify(sk).decode()))
|
||||
logging.info("[Watcher] nonce: {}".format(hexlify(nonce).decode()))
|
||||
logging.info("[Watcher] encrypted_blob: {}".format(self.data))
|
||||
|
||||
# Decrypt
|
||||
aesgcm = AESGCM(sk)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import zmq
|
||||
import binascii
|
||||
|
||||
from pisa import logging
|
||||
from pisa.conf import FEED_PROTOCOL, FEED_ADDR, FEED_PORT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user