diff --git a/onionr/communicator.py b/onionr/communicator.py index cd32d881..2e383fb2 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -69,40 +69,7 @@ class OnionrCommunicate: time.sleep(1) 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 diff --git a/onionr/onionr.py b/onionr/onionr.py index 9c12b1b7..c4d360af 100755 --- a/onionr/onionr.py +++ b/onionr/onionr.py @@ -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) diff --git a/onionr/onionrutils.py b/onionr/onionrutils.py index 14ca52f1..619e5927 100644 --- a/onionr/onionrutils.py +++ b/onionr/onionrutils.py @@ -208,3 +208,8 @@ class OnionrUtils: retVal = False return retVal + + def sendPM(self, peer, message): + '''Send an encrypted private message to a user''' + + return