work on peer private messages (& crypto)

master
Kevin Froman 2018-02-08 03:14:32 -06:00
parent 4948712904
commit a0dc95c291
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
3 changed files with 19 additions and 34 deletions

View File

@ -70,39 +70,6 @@ class OnionrCommunicate:
return
def getRemotePeerKey(self, peerID):
'''
This function contacts a peer and gets their main PGP key.
This is safe because Tor or I2P is used, but it does not ensure that the person is who they say they are
'''
url = 'http://' + peerID + '/public/?action=getPGP'
r = requests.get(url, headers=headers)
response = r.text
return response
def shareHMAC(self, peerID, key):
'''
This function shares an HMAC key to a peer
'''
return
def getPeerProof(self, peerID):
'''
This function gets the current peer proof requirement
'''
return
def sendPeerProof(self, peerID, data):
'''
This function sends the proof result to a peer previously fetched with getPeerProof
'''
return
def lookupBlocks(self):
'''
Lookup blocks and merge new ones

View File

@ -128,6 +128,7 @@ class Onionr:
'addmessage': self.addMessage,
'add-msg': self.addMessage,
'add-message': self.addMessage,
'pm': self.sendEncrypt,
'gui': self.openGUI,
'addpeer': self.addPeer,
'add-peer': self.addPeer
@ -150,6 +151,18 @@ class Onionr:
logger.info('Onionr ' + ONIONR_VERSION + ' (' + platform.machine() + ') : API v' + API_VERSION)
logger.info('Running on ' + platform.platform() + ' ' + platform.release())
def sendEncrypt(self):
'''Create a private message and send it'''
while True:
peer = logger.readline('Peer to send to: ')
if self.onionrUtils.validateID(peer):
break
else:
logger.error('Invalid peer ID')
message = logger.readline("Enter a message: ")
logger.info("Sending message to " + peer)
def openGUI(self):
gui.OnionrGUI(self.onionrCore)

View File

@ -208,3 +208,8 @@ class OnionrUtils:
retVal = False
return retVal
def sendPM(self, peer, message):
'''Send an encrypted private message to a user'''
return