added get data function, work on submitting/recieving data

This commit is contained in:
Kevin Froman 2018-01-21 03:12:41 -06:00
parent b62f799b02
commit 5af2b99135
3 changed files with 12 additions and 2 deletions

View file

@ -31,8 +31,8 @@ class Core:
self.peerDB = 'data/peers.db'
self.ownPGPID = ''
self.blockDB = 'data/blocks.db'
self.blockDataLocation = 'data/blocks/'
#self.daemonQueue() # Call to create the DB if it doesn't exist
return
def generateMainPGP(self, myID):
@ -118,6 +118,13 @@ class Core:
conn.commit()
conn.close()
def getData(self,hash):
'''simply return the data associated to a hash'''
dataFile = open(self.blockDataLocation + hash + '.dat')
data = dataFile.read()
dataFile.close()
return data
def dataDirEncrypt(self, password):
'''
Encrypt the data directory on Onionr shutdown