2
0
mirror of https://github.com/ComradCollective/Comrad synced 2024-11-11 13:10:45 +00:00
This commit is contained in:
quadrismegistus 2020-09-13 19:55:14 +01:00
parent 7a07babe4c
commit 822f080811
2 changed files with 22 additions and 8 deletions

View File

@ -12,25 +12,39 @@ class Komrade(Caller):
self.cli = CLI(name=name, komrade=self) self.cli = CLI(name=name, komrade=self)
self.boot(create=False) self.boot(create=False)
def boot(self,create=False): def boot(self,create=False,ping=False):
# Do I already have my keys? # Do I already have my keys?
# yes? -- login # yes? -- login
keys = self.keychain() keys = self.keychain()
if keys.get('pubkey') and keys.get('privkey'): if keys.get('pubkey') and keys.get('privkey'):
self.log('booted!') self.log('already booted! @'+self.name)
return True return True
# If not, forge them -- only once! if self.exists_locally_as_account():
if not have_keys and create: self.log(f'this account (@{self.name}) can be logged into')
self.get_new_keys() return self.login()
elif self.exists_locally_as_contact():
self.log(f'this account (@{self.name}) is a contact')
return #pass #???
elif ping and self.exists_on_server():
self.log(f'this account exists on server. introduce?')
return
elif create:
self.log('account is free: register?')
return self.register()
def exists_locally_as_contact(self): def exists_locally_as_contact(self):
return self.pubkey and not self.privkey return self.pubkey and not self.privkey
def exists_locally_as_Komrade(self): def exists_locally_as_account(self):
return self.pubkey and self.privkey return self.pubkey and self.privkey_encr
def exists_on_server(self): def exists_on_server(self):
answer = self.phone.ring_ring({ answer = self.phone.ring_ring({

View File

@ -74,7 +74,7 @@ class Logger(object):
# try: # try:
if pause: do_pause() if pause: do_pause()
if pause: clear_screen() if clear: clear_screen()
# except KeyboardInterrupt: # except KeyboardInterrupt:
# exit() # exit()