switch pubkeymanager and contactmanager over to niceware

This commit is contained in:
Kevin Froman 2019-09-29 23:40:23 -05:00
parent 991c79b350
commit 37db4b514e
2 changed files with 8 additions and 7 deletions

View file

@ -17,18 +17,20 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import os, json, onionrexceptions
import os, json
import unpaddedbase32
import niceware
import onionrexceptions
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 mnemonickeys.DELIMITER in publicKey:
publicKey = mnemonic.Mnemonic('english').to_entropy(publicKey.split(mnemonickeys.DELIMITER))
publicKey = mnemonickeys.get_base32(publicKey.split(mnemonickeys.DELIMITER))
publicKey = unpaddedbase32.b32encode(bytesconverter.str_to_bytes(publicKey))
except ValueError:
pass