removed pubkey pow and bug fixes
This commit is contained in:
parent
f270d3c522
commit
a31a0fd264
@ -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(),
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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.')
|
||||
|
Loading…
Reference in New Issue
Block a user