work on site finder and fixed friend adding

This commit is contained in:
Kevin Froman 2019-09-29 15:39:03 -05:00
parent 0067bd36b5
commit b077f72e5f
7 changed files with 49 additions and 13 deletions

View file

@ -22,13 +22,13 @@ import unpaddedbase32
from onionrusers import onionrusers
from onionrutils import bytesconverter, epoch
from utils import identifyhome
from onionrutils import mnemonickeys
import mnemonic
class ContactManager(onionrusers.OnionrUser):
def __init__(self, publicKey, saveUser=False, recordExpireSeconds=5):
try:
if " " in publicKey:
publicKey = mnemonic.Mnemonic('english').to_entropy(publicKey)
if mnemonickeys.DELIMITER in publicKey:
publicKey = mnemonic.Mnemonic('english').to_entropy(publicKey.split(mnemonickeys.DELIMITER))
publicKey = unpaddedbase32.b32encode(bytesconverter.str_to_bytes(publicKey))
except ValueError:
pass

View file

@ -67,7 +67,7 @@ class OnionrUser:
if saveUser:
try:
keydb.addkeys.add_peer(publicKey)
except AssertionError:
except (AssertionError, ValueError) as e:
pass
self.trust = keydb.userinfo.get_user_info(self.publicKey, 'trust')