logfunc(f'Using the iron-clad Elliptic curve algorithm, I have cut for you a private and public asymmetric key pair:\n\n(1) {pubkey}\n\n(2) {privkey}{ART_KEY_PAIR}',clear=True,pause=True)
### PUBLIC KEY
qr_str=self.qr_str(pubkey.data_b64)
logfunc('(1) You may store your public key both on your device hardware, as well as share it with anyone you wish.\n\nIt will even be stored as a QR code on your device:\n{qr_str}',pause=True)
log('You must also register it with Komrade @Operator on the remote server. Shall Komrade @Telephone send it over?',pause=True,clear=False)#),dict_format(data,tab=2),pause=True)
logfunc(f'''Using a salted SHA-256 hashing algorithm, I have replaced your password with a disguised or hashed version of itself:\n\n{make_key_discreet_str(passhash)}''',pause=True,clear=True)
logfunc(f'''Let's beef up your password by running it through a SHA-256 hashing algorithm:\n\n{make_key_discreet_str(passhash)}''',pause=True,clear=False)
logfunc(f"Your asymmetric private key will be stored only on your device hardware, and only as it was encrypted by your password-generated key:\n\n[Encrypted Private Key]\n({make_key_discreet_str(privkey_encr_obj.data_b64)})",pause=True,clear=True)
logfunc(f"With that password we then encrypt your asymmetric private key:\n\n[Encrypted Private Key]\n({make_key_discreet_str(privkey_encr_obj.data_b64)})",pause=True,clear=False)
logfunc('Only this encrypted version is stored.',pause=True,clear=True)
self._keychain['pubkey']=pubkey
self._keychain['privkey_encr']=privkey_encr_obj
self._keychain['privkey']=privkey
# self._keychain['privkey_decr']=privkey_decr
# we should be able to reassemble privkey now?
# self.log('this is my keychain now:')
#assert 'privkey' in self.keychain()
self.log('My keychain now looks like:',dict_format(self.keychain()))
# 6) Save for now on client -- will delete if fails on server
# storing myself in memory phonebook
# PHONEBOOK[name]=self
## 7) Save data to server
data={
'name':name,
'pubkey':pubkey.data,
}
logfunc('You may store your public key both on your device hardware, as well as share it with anyone you wish.\n\nYou must also register it with Komrade @Operator on the remote server. Shall Komrade @Telephone send it over?',pause=True,clear=False)#),dict_format(data,tab=2),pause=True)
ok_to_send=input(f'Komrade @{name}: [Y/n]')
ifok_to_send.strip().lower()=='n':
logfunc('Cancelling registration.')
return
# ring operator
# call from phone since I don't have pubkey on record on Op yet