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-13 08:54:39 +01:00
parent 6bb5118a79
commit 7e2fc06f0d

View File

@ -18,15 +18,19 @@ class TheTelephone(Operator):
def send_and_receive(self,msg_d,**y):
self.log('send and receive got incoming msg:',msg_d)
# self.log('send and receive got incoming msg:',msg_d)
opp = Operator(pubkey=msg_d['to'])
self.log('got opp:',opp.pubkey.data == msg_d['to'], self.op.pubkey.data == msg_d['to'])
# assert that people can speak only with operator in their first enclosed message!
# if so, dropping the "to"
if msg_d['to'] != self.op.pubkey.data:
raise KomradeException('Komrades must communicate securely with Operator first.')
# opp = Operator(pubkey=msg_d['to'])
# self.log('got opp:',opp.pubkey.data == msg_d['to'], self.op.pubkey.data == msg_d['to'])
msg_b=msg_d["msg"]
msg_b64 = b64encode(msg_b)
msg_b64_str = msg_b64.decode()
self.log(f'''@Operator knows it's me, so I'll omit all metadata\nand send only the encrypted packcage:\n\n{msg_b64_str}''')
self.log(f'''@Operator knows it's me, so I'll omit all metadata\nand send only the encrypted package:\n\n{msg_b64_str}''')
# seal for transport
msg_b64_str_esc = msg_b64_str.replace('/','_')