From 18348679bdb197c513736db96ae72332a2d56e89 Mon Sep 17 00:00:00 2001 From: quadrismegistus Date: Wed, 9 Sep 2020 15:47:26 +0100 Subject: [PATCH] updates --- komrade/backend/callers.py | 77 --------------------------------- komrade/backend/the_operator.py | 7 ++- 2 files changed, 5 insertions(+), 79 deletions(-) diff --git a/komrade/backend/callers.py b/komrade/backend/callers.py index 9f6a5d9..b76354a 100644 --- a/komrade/backend/callers.py +++ b/komrade/backend/callers.py @@ -17,80 +17,3 @@ class Caller(Operator): to_whom=self.op, get_resp_from=self.phone.ring_ring ) - - - # def ring_ring(self,msg): - # if not to_phone: to_phone=self.phone - # return super().ring_ring(msg,to_phone) - - # # message should be encrypted caller2caller (by Person.ring) - # msg_encr_caller2caller = with_msg - - # # Caller can only encrypt for Operator (end phone) - # if not to_phone: to_phone=self.op - # to_whom = to_phone - - # # ring 1: encrypt caller2phone - # msg_encr_caller2caller_caller2phone = self.package_msg_to( - # msg_encr_caller2caller, - # to_whom - # ) - # self.log('msg_encr_caller2caller_caller2phone',msg_encr_caller2caller_caller2phone) - - - # # ring 2: dial and get response - # resp_msg_encr_caller2caller_caller2phone = self.phone.ring_ring( - # msg_encr_caller2caller_caller2phone - # ) - # self.log('resp_msg_encr_caller2caller_caller2phone',resp_msg_encr_caller2caller_caller2phone) - - - # # ring 3: decrypt and send back - # resp_msg_encr_caller2caller = self.unpackage_msg_from( - # resp_msg_encr_caller2caller_caller2phone - # ) - # self.log('resp_msg_encr_caller2caller',resp_msg_encr_caller2caller) - - # return resp_msg_encr_caller2caller - - - # def get_new_keys(self, name = None, passphrase = DEBUG_DEFAULT_PASSPHRASE, is_group=None): - # # get needed metadata - # if not name: name=self.name - # if name is None: - # name = input('\nWhat is the name for this account? ') - # if passphrase is None: - # passphrase = getpass.getpass('\nEnter a memborable password: ') - # # if is_group is None: - # # is_group = input('\nIs this a group account? [y/N]').strip().lower() == 'y' - - # # form request - # msg_to_op = { - # '_please':'forge_new_keys', - # 'name':name, - # 'passphrase':hashish(passphrase.encode()) - # } - - # phone_res = self.phone.ring(msg_to_op) - - # # URI id - # uri_id = phone_res.get('uri_id') - # returned_keys = phone_res.get('_keychain') - # self.log('got URI from Op:',uri_id) - # self.log('got returnd keys from Op:',returned_keys) - - # stop - - # # better have the right keys - # assert set(KEYMAKER_DEFAULT_KEYS_TO_SAVE_ON_CLIENT) == set(returned_keys.keys()) - - # # now save these keys! - # saved_keys = self.save_keychain(name,returned_keys,uri_id=uri_id) - # self.log('saved keys!',saved_keys) - - # # better have the right keys - # # assert set(KEYMAKER_DEFAULT_KEYS_TO_SAVE) == set(saved_keys.keys()) - - # # success! - # self.log('yay!!!!') - # return saved_keys diff --git a/komrade/backend/the_operator.py b/komrade/backend/the_operator.py index 5030253..648b43a 100644 --- a/komrade/backend/the_operator.py +++ b/komrade/backend/the_operator.py @@ -61,8 +61,11 @@ class TheOperator(Operator): # decode data_b64 = data_b64_str.encode() data = b64decode(data_b64) - msg_d = msg_encr_caller2caller_caller2phone_phone2phone = data - self.log('msg_encr_caller2caller_caller2phone_phone2phone incoming',msg_encr_caller2caller_caller2phone_phone2phone) + + # unseal + msg_obj = self.unseal_msg(data) + self.got(f'Operator understood message: {msg_obj}') + stop # make top-level message object, addressed to me the operator from komrade.backend.messages import Message