added vanity address support
parent
866f0ce501
commit
382627426b
|
@ -21,6 +21,7 @@ from onionrutils import bytesconverter
|
|||
from onionrcrypto import generate
|
||||
import os
|
||||
import filepaths
|
||||
|
||||
class KeyManager:
|
||||
def __init__(self):
|
||||
self.keyFile = filepaths.keys_file
|
||||
|
@ -72,6 +73,6 @@ class KeyManager:
|
|||
with open(self.keyFile, "r") as keyFile:
|
||||
keyData = keyFile.read()
|
||||
for pair in keyData.split('\n'):
|
||||
if pubKey in pair:
|
||||
if pubKey in pair or pubKey.replace('=', '') in pair:
|
||||
privKey = pair.split(',')[1]
|
||||
return privKey
|
|
@ -76,7 +76,8 @@ def change_ID():
|
|||
logger.warn('Specify pubkey to use', terminal=True)
|
||||
else:
|
||||
if stringvalidators.validate_pub_key(key):
|
||||
if key in key_manager.getPubkeyList():
|
||||
key_list = key_manager.getPubkeyList()
|
||||
if key in key_list or key.replace('=', '') in key_list:
|
||||
config.set('general.public_key', key)
|
||||
config.save()
|
||||
logger.info('Set active key to: %s' % (key,), terminal=True)
|
||||
|
|
|
@ -3,8 +3,8 @@ from .. import getourkeypair
|
|||
import unpaddedbase32
|
||||
from onionrutils import bytesconverter, stringvalidators
|
||||
pair = getourkeypair.get_keypair()
|
||||
our_pub_key = pair[0]
|
||||
our_priv_key = pair[1]
|
||||
our_pub_key = unpaddedbase32.repad(pair[0].encode())
|
||||
our_priv_key = unpaddedbase32.repad(pair[1].encode())
|
||||
|
||||
def pub_key_encrypt(data, pubkey, encodedData=False):
|
||||
'''Encrypt to a public key (Curve25519, taken from base32 Ed25519 pubkey)'''
|
||||
|
|
Loading…
Reference in New Issue