keys-on-cli
quadrismegistus 4 years ago
parent 588716eaf6
commit 5d31a769d7

@ -118,7 +118,7 @@ cv = {cv}
if success:
cvb64=b64encode(cv).decode()
qrstr=self.qr_str(cvb64)
res['status'] = f'''{OPERATOR_INTRO}I have successfully registered Komrade {name}.
self.status(f'''{OPERATOR_INTRO}I have successfully registered Komrade {name}.
If you're interested, here's what I did. I stored the public key you gave me, {cvb64}, under the name of "{name}". However, I never save that name directly, but record it only in a disguised, "hashed" form: {ck}. I scrambled "{name}" by running it through a 1-way hashing function, which will always yield the same result: provided you know which function I'm using, and what the secret "salt" is that I add to all the input, a string of text which I keep protected and encrypted on my local hard drive.
@ -128,7 +128,7 @@ cv = {cv}
By default, if anyone asks me what your public key is, I won't tell them--though I won't be able to avoid hinting that a user exists under this name should someone try to register under that name and I deny them). Instead, if the person who requested your public key insists, I will send you a message (encrypted end-to-end so only you can read it) that the user who met someone would like to introduce themselves to you; I will then send you their name and public key. It's now your move: up to you whether to save them back your public key.
If you'd like to change this default behavior, e.g. by instead allowing anyone to request your public key, except for those whom you explcitly block, I have also created a super secret administrative record for you to change various settings on your account. This is protected by a separate encryption key which I have generated for you; and this key which is itself encrypted with the password you entered earlier. Don't worry: I never saw that password you typed, since it was given to me already hashed and disguised (as something {len(passphrase)} characters long, ending in "{passphrase[:10]}"). Without that hashed passphrase, no one will be able to unlock the administration key; and without the administration key, they won't be able to find the hashed record I stored your user settings under, since I also salted that hash with your own hashed passphrase. Even if someone found the record I stored them under, they wouldn't be able to decrypt the existing settings; and if they can't do that, I won't let them overwrite the record.'''
If you'd like to change this default behavior, e.g. by instead allowing anyone to request your public key, except for those whom you explcitly block, I have also created a super secret administrative record for you to change various settings on your account. This is protected by a separate encryption key which I have generated for you; and this key which is itself encrypted with the password you entered earlier. Don't worry: I never saw that password you typed, since it was given to me already hashed and disguised (as something {len(passphrase)} characters long, ending in "{passphrase[:10]}"). Without that hashed passphrase, no one will be able to unlock the administration key; and without the administration key, they won't be able to find the hashed record I stored your user settings under, since I also salted that hash with your own hashed passphrase. Even if someone found the record I stored them under, they wouldn't be able to decrypt the existing settings; and if they can't do that, I won't let them overwrite the record.''')
else:
res['status']= f'''
{OPERATOR_INTRO}I'm sorry, but I can't register the name of {name}.

@ -28,7 +28,7 @@ def clear_screen():
import os
os.system('cls' if os.name == 'nt' else 'clear')
def pause():
def do_pause():
input('')
@ -48,7 +48,7 @@ def dict_format(d, tab=0):
import inspect
from komrade.constants import PAUSE_LOGGER
class Logger(object):
def log(self,*x,do_pause=PAUSE_LOGGER,do_clear=PAUSE_LOGGER):
def log(self,*x,pause=PAUSE_LOGGER,clear=PAUSE_LOGGER):
curframe = inspect.currentframe()
calframe = inspect.getouterframes(curframe, 2)
mytype = type(self).__name__
@ -56,11 +56,15 @@ class Logger(object):
log(f'\n[{mytype}.{caller}()]',*x)
try:
if do_pause: pause()
if do_pause: clear_screen()
if pause: do_pause()
if pause: clear_screen()
except KeyboardInterrupt:
exit()
def status(self,status_msg):
for para in status_msg.split('\n\n'):
self.log(para)
import binascii,base64
def isBase64(sb):
try:

Loading…
Cancel
Save