From a31a0fd264a07e8dab04ddee1f9910307041664a Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sat, 3 Nov 2018 00:06:04 -0500 Subject: [PATCH] removed pubkey pow and bug fixes --- onionr/onionr.py | 3 --- onionr/onionrcrypto.py | 23 +------------------ .../static-data/default-plugins/pms/main.py | 2 +- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/onionr/onionr.py b/onionr/onionr.py index 24880258..97781f0c 100755 --- a/onionr/onionr.py +++ b/onionr/onionr.py @@ -683,13 +683,10 @@ class Onionr: # define stats messages here totalBlocks = len(Block.getBlocks()) signedBlocks = len(Block.getBlocks(signed = True)) - powToken = self.onionrCore._crypto.pubKeyPowToken messages = { # info about local client 'Onionr Daemon Status' : ((logger.colors.fg.green + 'Online') if self.onionrUtils.isCommunicatorRunning(timeout = 9) else logger.colors.fg.red + 'Offline'), 'Public Key' : self.onionrCore._crypto.pubKey, - 'POW Token' : powToken, - 'Combined' : self.onionrCore._crypto.pubKey + '-' + powToken, 'Human readable public key' : self.onionrCore._utils.getHumanReadableID(), 'Node Address' : self.get_hostname(), diff --git a/onionr/onionrcrypto.py b/onionr/onionrcrypto.py index 8bc5c847..045bf053 100644 --- a/onionr/onionrcrypto.py +++ b/onionr/onionrcrypto.py @@ -31,15 +31,11 @@ class OnionrCrypto: config.reload() self._core = coreInstance self._keyFile = self._core.dataDir + 'keys.txt' - self.keyPowFile = self._core.dataDir + 'keyPow.txt' self.pubKey = None self.privKey = None self.secrets = secrets - - self.pubKeyPowToken = None - #self.pubKeyPowHash = None - + self.HASH_ID_ROUNDS = 2000 # Load our own pub/priv Ed25519 keys, gen & save them if they don't exist @@ -48,29 +44,12 @@ class OnionrCrypto: keys = keys.read().split(',') self.pubKey = keys[0] self.privKey = keys[1] - try: - with open(self.keyPowFile, 'r') as powFile: - data = powFile.read() - self.pubKeyPowToken = data - except (FileNotFoundError, IndexError): - pass else: keys = self.generatePubKey() self.pubKey = keys[0] self.privKey = keys[1] with open(self._keyFile, 'w') as keyfile: keyfile.write(self.pubKey + ',' + self.privKey) - with open(self.keyPowFile, 'w') as keyPowFile: - proof = onionrproofs.DataPOW(self.pubKey) - logger.info('Doing necessary work to insert our public key') - while True: - time.sleep(0.2) - powToken = proof.getResult() - if powToken != False: - break - keyPowFile.write(base64.b64encode(powToken[1]).decode()) - self.pubKeyPowToken = powToken[1] - self.pubKeyPowHash = powToken[0] return def edVerify(self, data, key, sig, encodedData=True): diff --git a/onionr/static-data/default-plugins/pms/main.py b/onionr/static-data/default-plugins/pms/main.py index b6d29545..ea2ff988 100644 --- a/onionr/static-data/default-plugins/pms/main.py +++ b/onionr/static-data/default-plugins/pms/main.py @@ -131,7 +131,7 @@ class OnionrMail: else: cancel = '' readBlock.verifySig() - print('Message recieved from %s' % (readBlock.signer,)) + print('Message recieved from %s' % (self.myCore._utils.bytesToStr(readBlock.signer,))) print('Valid signature:', readBlock.validSig) if not readBlock.validSig: logger.warn('This message has an INVALID signature. ANYONE could have sent this message.')