nothing-unencr
quadrismegistus 4 years ago
parent e1af2f46ea
commit beea2eeb05

@ -40,7 +40,8 @@ class Caller(Operator):
# ring 3: decrypt and send back
resp_msg_encr_caller2caller = self.unpackage_msg_from(
resp_msg_encr_caller2caller_caller2phone
resp_msg_encr_caller2caller_caller2phone,
to_whom
)
self.log('resp_msg_encr_caller2caller',resp_msg_encr_caller2caller)

@ -126,7 +126,11 @@ class Operator(Keymaker):
def unpackage_msg_from(self,msg_encr_b,another):
return self.decrypt_from_send(msg_encr_b,another)
return self.decrypt_from_send(
msg_encr_b,
from_pubkey=another.pubkey,
to_privkey=self.privkey
)
# def ring(self,with_msg,to_whom=None,by_way_of=None):

@ -10,6 +10,17 @@ from flask_classful import FlaskView
class TheSwitchboard(FlaskView, Logger):
default_methods = ['GET']
excluded_methods = ['phone','op','send']
@property
def op(self):
from komrade.backend.the_operator import TheOperator
if type(self)==TheOperator: return self
if hasattr(self,'_op'): return self._op
global OPERATOR,OPERATOR_KEYCHAIN
if OPERATOR: return OPERATOR
self._op=OPERATOR=TheOperator()
return OPERATOR
def get(self,msg):
self.log('Incoming call!:',msg)
@ -19,7 +30,7 @@ class TheSwitchboard(FlaskView, Logger):
# unenescape
msg = msg.replace('_','/')
str_msg_from_op = self.op.route(msg)
str_msg_from_op = msg.replace('_','/')
# str_msg_from_op = msg.replace('_','/')
self.log('Switchboard got msg back from Operator:',str_msg_from_op)
return str_msg_from_op

@ -34,8 +34,9 @@ class TheTelephone(Operator):
def send_and_receive(self,msg):
msg_b64_str = b64encode(msg).decode()
self.log('msg_b64_str',type(msg_b64_str),msg_b64_str)
URL = OPERATOR_API_URL + msg_b64_str + '/'
msg_b64_str_esc = msg_b64_str.replace('/','_')
self.log('msg_b64_str_esc',type(msg_b64_str_esc),msg_b64_str_esc)
URL = OPERATOR_API_URL + msg_b64_str_esc + '/'
self.log("DIALING THE OPERATOR:",URL)
ringring=komrade_request(URL)
if ringring.status_code==200:

Loading…
Cancel
Save