do not show traceback when adding existing determiistic key

master
Kevin Froman 2019-06-26 14:54:13 -05:00
parent 7f4605998c
commit 94ba3e29d1
1 changed files with 8 additions and 4 deletions

View File

@ -20,7 +20,7 @@
import sys, getpass import sys, getpass
import logger, onionrexceptions import logger, onionrexceptions
from onionrutils import stringvalidators from onionrutils import stringvalidators, bytesconverter
from onionrusers import onionrusers, contactmanager from onionrusers import onionrusers, contactmanager
import unpaddedbase32 import unpaddedbase32
def add_ID(o_inst): def add_ID(o_inst):
@ -45,9 +45,13 @@ def add_ID(o_inst):
else: else:
logger.error('Passwords do not match.', terminal=True) logger.error('Passwords do not match.', terminal=True)
sys.exit(1) sys.exit(1)
try:
o_inst.onionrCore._crypto.keyManager.addKey(pubKey=newID, o_inst.onionrCore._crypto.keyManager.addKey(pubKey=newID,
privKey=privKey) privKey=privKey)
logger.info('Added ID: %s' % (o_inst.onionrUtils.bytesToStr(newID),), terminal=True) except ValueError:
logger.error('That ID is already available, you can change to it with the change-id command.', terminal=True)
return
logger.info('Added ID: %s' % (bytesconverter.bytes_to_str(newID),), terminal=True)
def change_ID(o_inst): def change_ID(o_inst):
try: try: