diff --git a/komrade/backend/keymaker.py b/komrade/backend/keymaker.py index 7a02ee1..a25c497 100644 --- a/komrade/backend/keymaker.py +++ b/komrade/backend/keymaker.py @@ -212,7 +212,7 @@ class Keymaker(Logger): # gen encrypted keys! keychain = self.gen_encr_keys(keychain,keys_to_gen,passphrase=passphrase) self.log('keychain 2 =',keychain) - + # save keys! # get URI id to save under (except for pubkeys, accessible by name) uri_id,keys_saved,keychain = self.save_keychain(name,keychain,keys_to_save) @@ -220,6 +220,11 @@ class Keymaker(Logger): self.log('keys_saved =',keys_saved) self.log('keychain =',keychain) + # save pubkey as QR + if not 'pubkey' in keys_saved: + self.log('did not save pubkey in crypt, storing as QR...') + self.save_uri_as_qrcode(name=name, uri_id=uri_id, odir=PATH_QRCODES) + # return keys! keys_returned = self.return_keychain(keychain,keys_to_return) return {'uri_id':uri_id,'_keychain':keys_returned} @@ -263,7 +268,9 @@ class Keymaker(Logger): if not '_' in keyname and keyname!='pubkey': raise KomradeException('there is no private property in a socialist network! all keys must be split between komrades') if keyname in keychain: - self.crypt_keys.set(uri_id,keychain[keyname],prefix=f'/{keyname}/') + # uri = uri_id + uri = uri_id if name!='pubkey' else name + self.crypt_keys.set(uri,keychain[keyname],prefix=f'/{keyname}/') keys_saved_d[keyname] = keychain[keyname] return (uri_id,keys_saved_d,keychain) diff --git a/komrade/backend/operators.py b/komrade/backend/operators.py index 9103238..13d08af 100644 --- a/komrade/backend/operators.py +++ b/komrade/backend/operators.py @@ -413,9 +413,9 @@ class Operator(Keymaker): def create_phonelines(): ## CREATE OPERATOR op = Operator(name=OPERATOR_NAME) - op_keys_to_keep_on_client = ['pubkey'] # kept on app + op_keys_to_keep_on_client = ['pubkey'] # kept on app, stored under name op_keys_to_keep_on_3rdparty = ['privkey_decr'] # kept on .onion site - op_keys_to_keep_on_server = ['pubkey', + op_keys_to_keep_on_server = ['pubkey', # stored under name 'privkey_encr', 'adminkey_encr', 'adminkey_decr_encr', @@ -441,10 +441,10 @@ def create_phonelines(): ) # store URIs - op.save_uri_as_qrcode(odir=PATH_OPERATOR_WEB_CONTACTS_DIR) + # op.save_uri_as_qrcode(odir=PATH_OPERATOR_WEB_CONTACTS_DIR) # op.save_uri_as_qrcode() - phone.save_uri_as_qrcode(odir=PATH_OPERATOR_WEB_CONTACTS_DIR) + # phone.save_uri_as_qrcode(odir=PATH_OPERATOR_WEB_CONTACTS_DIR) # phone.save_uri_as_qrcode() ## store remote keys @@ -493,27 +493,27 @@ def connect_phonelines(): print('\n\n\n\nCONNECTING PHONELINES!\n\n\n\n') # save QR - import shutil - qrfn_op = os.path.join(PATH_QRCODES,OPERATOR_NAME+'.png') - qrfn_ph = os.path.join(PATH_QRCODES,TELEPHONE_NAME+'.png') - if not os.path.exists(qrfn_op): - r1 = komrade_request(PATH_OPERATOR_WEB_CONTACT_OP_URL) - if r1.status_code==200: - with open(qrfn_op,'wb') as of: - print('hello') - # shutil.copyfileobj(r1.raw, of) - of.write(r1.content) - print('>> saved:',qrfn_op) - - # stop - if not os.path.exists(qrfn_ph): - r2 = komrade_request(PATH_OPERATOR_WEB_CONTACT_PH_URL) - if r2.status_code==200: - with open(qrfn_ph,'wb') as of: - print('hello') - # shutil.copyfileobj(r2.raw, of) - of.write(r2.content) - print('>> saved:',qrfn_ph) + # import shutil + # qrfn_op = os.path.join(PATH_QRCODES,OPERATOR_NAME+'.png') + # qrfn_ph = os.path.join(PATH_QRCODES,TELEPHONE_NAME+'.png') + # if not os.path.exists(qrfn_op): + # r1 = komrade_request(PATH_OPERATOR_WEB_CONTACT_OP_URL) + # if r1.status_code==200: + # with open(qrfn_op,'wb') as of: + # print('hello') + # # shutil.copyfileobj(r1.raw, of) + # of.write(r1.content) + # print('>> saved:',qrfn_op) + + # # stop + # if not os.path.exists(qrfn_ph): + # r2 = komrade_request(PATH_OPERATOR_WEB_CONTACT_PH_URL) + # if r2.status_code==200: + # with open(qrfn_ph,'wb') as of: + # print('hello') + # # shutil.copyfileobj(r2.raw, of) + # of.write(r2.content) + # print('>> saved:',qrfn_ph) # import from komrade.backend.mazes import tor_request diff --git a/komrade/constants.py b/komrade/constants.py index 40727fd..2b3276b 100644 --- a/komrade/constants.py +++ b/komrade/constants.py @@ -60,11 +60,14 @@ OPERATOR_INTERCEPT_MESSAGE = "If you'd like to make a call, please hang up and t # defaults oriented to Callers -# KEYMAKER_DEFAULT_KEYS_TO_SAVE = ['pubkey_encr'] -KEYMAKER_DEFAULT_KEYS_TO_SAVE = ['pubkey'] -# KEYMAKER_DEFAULT_KEYS_TO_RETURN = ['privkey_encr', -KEYMAKER_DEFAULT_KEYS_TO_RETURN = ['privkey_encr', # pubkey returnd as QR +# kept on server +KEYMAKER_DEFAULT_KEYS_TO_SAVE_ON_SERVER = ['pubkey'] # stored under QR URI + +# kept on client +KEYMAKER_DEFAULT_KEYS_TO_SAVE_ON_CLIENT = [ + #'pubkey' # as QR + 'privkey_encr', 'adminkey_encr', 'privkey_decr_encr', 'privkey_decr_decr',