diff --git a/komrade/cli/cli.py b/komrade/cli/cli.py index 1f538d9..3e2da42 100644 --- a/komrade/cli/cli.py +++ b/komrade/cli/cli.py @@ -289,10 +289,10 @@ class CLI(Logger): ) s0=str.center('[Encryption Process]',CLI_WIDTH) - s1=s0 + '\n\n' + self.print('Now that we have (2A), we can use it to encrypt the super-sensitive private key (2):',ret=True) - s2a = self.print(f"(2A) {make_key_discreet_str(passphrase)}",ret=True) - s2 = self.print(f"(2) {make_key_discreet(privkey.data_b64)}",ret=True) - s2b = self.print(f"(2B) {make_key_discreet(b64encode(privkey_encr))}",ret=True) + s1=s0 + '\n\n' + self.printt('Now that we have (2A), we can use it to encrypt the super-sensitive private key (2):',ret=True) + s2a = self.printt(f"(2A) {make_key_discreet_str(passphrase)}",ret=True) + s2 = self.printt(f"(2) {make_key_discreet(privkey.data_b64)}",ret=True) + s2b = self.printt(f"(2B) {make_key_discreet(b64encode(privkey_encr))}",ret=True) self.status( # screen 1 None,{f'{s1}'}, @@ -315,7 +315,7 @@ class CLI(Logger): ) - shdr=str.center('[Decryption Process]',CLI_WIDTH) + '\n\n' + self.print('Once we have (2B), we don\'t need (2A) or (2) anymore. We can regenerate them!',ret=True) + shdr=str.center('[Decryption Process]',CLI_WIDTH) + '\n\n' + self.printt('Once we have (2B), we don\'t need (2A) or (2) anymore. We can regenerate them!',ret=True) from getpass import getpass passhash = None @@ -324,7 +324,7 @@ class CLI(Logger): res = self.status( None,{shdr},False if passhash is None else True, - ("pass",self.print(f"Let's try. Re-type your password into @Hasher:",ret=True)+f" \n ",getpass) + ("pass",self.printt(f"Let's try. Re-type your password into @Hasher:",ret=True)+f" \n ",getpass) ) passhash = self.persona.crypt_keys.hash(res.get('vals').get('pass').encode()) diff --git a/komrade/cli/cli0.py b/komrade/cli/cli0.py index 17a424f..1148ee1 100644 --- a/komrade/cli/cli0.py +++ b/komrade/cli/cli0.py @@ -288,10 +288,10 @@ class CLI(Logger): ) s0=str.center('[Encryption Process]',CLI_WIDTH) - s1=s0 + '\n\n' + self.print('Now that we have (2A), we can use it to encrypt the super-sensitive private key (2):',ret=True) - s2a = self.print(f"(2A) {make_key_discreet_str(passphrase)}",ret=True) - s2 = self.print(f"(2) {make_key_discreet(privkey.data_b64)}",ret=True) - s2b = self.print(f"(2B) {make_key_discreet(b64encode(privkey_encr))}",ret=True) + s1=s0 + '\n\n' + self.printt('Now that we have (2A), we can use it to encrypt the super-sensitive private key (2):',ret=True) + s2a = self.printt(f"(2A) {make_key_discreet_str(passphrase)}",ret=True) + s2 = self.printt(f"(2) {make_key_discreet(privkey.data_b64)}",ret=True) + s2b = self.printt(f"(2B) {make_key_discreet(b64encode(privkey_encr))}",ret=True) self.status( # screen 1 None,{f'{s1}'}, @@ -314,7 +314,7 @@ class CLI(Logger): ) - shdr=str.center('[Decryption Process]',CLI_WIDTH) + '\n\n' + self.print('Once we have (2B), we don\'t need (2A) or (2) anymore. We can regenerate them!',ret=True) + shdr=str.center('[Decryption Process]',CLI_WIDTH) + '\n\n' + self.printt('Once we have (2B), we don\'t need (2A) or (2) anymore. We can regenerate them!',ret=True) from getpass import getpass passhash = None @@ -323,7 +323,7 @@ class CLI(Logger): res = self.status( None,{shdr},False if passhash is None else True, - ("pass",self.print(f"Let's try. Re-type your password into @Hasher:",ret=True)+f" \n ",getpass) + ("pass",self.printt(f"Let's try. Re-type your password into @Hasher:",ret=True)+f" \n ",getpass) ) passhash = self.persona.crypt_keys.hash(res.get('vals').get('pass').encode()) diff --git a/komrade/cli/cli_curses.py b/komrade/cli/cli_curses.py index fbe30da..08f0c54 100644 --- a/komrade/cli/cli_curses.py +++ b/komrade/cli/cli_curses.py @@ -354,10 +354,10 @@ class CLI(Logger): ) s0=str.center('[Encryption Process]',CLI_WIDTH) - s1=s0 + '\n\n' + self.print('Now that we have (2A), we can use it to encrypt the super-sensitive private key (2):',ret=True) - s2a = self.print(f"(2A) {make_key_discreet_str(passphrase)}",ret=True) - s2 = self.print(f"(2) {make_key_discreet(privkey.data_b64)}",ret=True) - s2b = self.print(f"(2B) {make_key_discreet(b64encode(privkey_encr))}",ret=True) + s1=s0 + '\n\n' + self.printt('Now that we have (2A), we can use it to encrypt the super-sensitive private key (2):',ret=True) + s2a = self.printt(f"(2A) {make_key_discreet_str(passphrase)}",ret=True) + s2 = self.printt(f"(2) {make_key_discreet(privkey.data_b64)}",ret=True) + s2b = self.printt(f"(2B) {make_key_discreet(b64encode(privkey_encr))}",ret=True) self.status( # screen 1 None,{f'{s1}'}, @@ -380,7 +380,7 @@ class CLI(Logger): ) - shdr=str.center('[Decryption Process]',CLI_WIDTH) + '\n\n' + self.print('Once we have (2B), we don\'t need (2A) or (2) anymore. We can regenerate them!',ret=True) + shdr=str.center('[Decryption Process]',CLI_WIDTH) + '\n\n' + self.printt('Once we have (2B), we don\'t need (2A) or (2) anymore. We can regenerate them!',ret=True) from getpass import getpass passhash = None @@ -389,7 +389,7 @@ class CLI(Logger): res = self.status( None,{shdr},False if passhash is None else True, - ("pass",self.print(f"Let's try. Re-type your password into @Hasher:",ret=True)+f" \n ",getpass) + ("pass",self.printt(f"Let's try. Re-type your password into @Hasher:",ret=True)+f" \n ",getpass) ) passhash = self.persona.crypt_keys.hash(res.get('vals').get('pass').encode()) diff --git a/komrade/utils.py b/komrade/utils.py index 407f273..0033ac3 100644 --- a/komrade/utils.py +++ b/komrade/utils.py @@ -75,7 +75,7 @@ class Logger(object): # except KeyboardInterrupt: # exit() - def print(*x,width=STATUS_LINE_WIDTH,end='\n',indent=1,ret=False,scan=False,**y): + def printt(*x,width=STATUS_LINE_WIDTH,end='\n',indent=1,ret=False,scan=False,**y): if not scan and not width: print(*x,end=end,**y) else: @@ -135,11 +135,11 @@ class Logger(object): elif type(para) is dict: print(dict_format(para,tab=tab)) elif pause: - self.print(para,flush=True,end=end if end else '\n',scan=scan,indent=indent) + self.printt(para,flush=True,end=end if end else '\n',scan=scan,indent=indent) paras+=[para] do_pause() else: - self.print(para,flush=True,end=end if end else '\n',scan=scan,indent=indent) + self.printt(para,flush=True,end=end if end else '\n',scan=scan,indent=indent) paras+=[para] return {'paras':paras, 'vals':res}