work on peer private messages (& crypto)
This commit is contained in:
parent
4948712904
commit
a0dc95c291
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -208,3 +208,8 @@ class OnionrUtils:
|
||||
retVal = False
|
||||
|
||||
return retVal
|
||||
|
||||
def sendPM(self, peer, message):
|
||||
'''Send an encrypted private message to a user'''
|
||||
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user