2
0
mirror of https://github.com/ComradCollective/Comrad synced 2024-11-03 23:15:33 +00:00
This commit is contained in:
quadrismegistus 2020-09-12 20:00:33 +01:00
parent 84a5dd3300
commit e1d38700df
2 changed files with 10 additions and 17 deletions

View File

@ -104,10 +104,10 @@ class Operator(Keymaker):
# def compose_reply(self,msg,another):
def seal_msg(self,msg_d):
msg_b = pickle.dumps(msg_d)
self.log('Message has being sealed in a final binary package:',b64encode(msg_b))
return msg_b
# def seal_msg(self,msg_d):
# msg_b = pickle.dumps(msg_d)
# self.log('Message has being sealed in a final binary package:',b64encode(msg_b))
# return msg_b
def unseal_msg(self,msg_b_encr,from_whom=None,to_whom=None):
# default to assumption that I am the recipient
@ -218,7 +218,7 @@ class Operator(Keymaker):
msg,
to_whom
)
self.log(f'Here is the message I will now encrypt and to send to {to_whom}:\n {msg_obj}')
self.log(f'Here is the message I will now encrypt and to send to {to_whom}:\n\n {dict_format(msg_obj.msg,tab = 2)}')
# encrypting
msg_obj.encrypt()

View File

@ -20,21 +20,14 @@ class TheTelephone(Operator):
# return self.telephone_keychain.get('pubkey')
def send_and_receive(self,msg_d,**y):
# seal for transport
msg_b_sealed = self.seal_msg(msg_d)
# prepare for transmission across net
msg_b64 = b64encode(msg_b_sealed)
msg_b=msg_d["msg"]
msg_b64 = b64encode(msg_b)
msg_b64_str = msg_b64.decode()
self.log(f'But because I am @Telephone, and @Operator communicates only with me directly,\n I will omit all metadata and send only the encrypted packcage:\n\n{msg_b64_str}')
# seal for transport
msg_b64_str_esc = msg_b64_str.replace('/','_')
# self.log('msg_b64_str_esc',type(msg_b64_str_esc),msg_b64_str_esc)
self.status(f'''
Hello, Operator?
Please send this message along, would you: {msg_b64_str}
''')
# dial the operator
URL = OPERATOR_API_URL + msg_b64_str_esc + '/'
self.log("DIALING THE OPERATOR:",URL)