fix mnemonic test and added make-release.sh

This commit is contained in:
Kevin Froman 2019-09-30 00:13:43 -05:00
parent 37db4b514e
commit 14334e7197
3 changed files with 18 additions and 9 deletions

12
make-release.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/bash
rm -rf dist
mkdir dist
mkdir dist/onionr/
cp -t dist/onionr/ -r docs static-data install onionr onionr.sh start-daemon.sh setprofile.sh
cp *.md dist/onionr/
PIP_USER=false
export PIP_USER
pip3 install --require-hashes -r requirements.txt --target=dist/onionr/onionr/
pip3 install --require-hashes -r requirements-notifications.txt --target=dist/onionr/onionr/
cd dist
tar -czvf onionr.tar.gz onionr

View File

@ -32,7 +32,6 @@ import threading
wordlist = niceware.WORD_LIST
def find_vanity_mnemonic(start_words: str, queue):
key_pair = [b"", b""]
vanity_key = ""
check = 0
@ -40,7 +39,7 @@ def find_vanity_mnemonic(start_words: str, queue):
key = nacl.signing.SigningKey.generate()
key_pair[1] = key.encode(nacl.encoding.RawEncoder)
key_pair[0] = key.verify_key.encode(encoder=nacl.encoding.RawEncoder)
vanity_key = niceware.bytes_to_passphrasec(key_pair[0])
vanity_key = '-'.join(niceware.bytes_to_passphrase(key_pair[0]))
check += 1
else:
queue.put(key_pair)
@ -75,7 +74,6 @@ def handler(start_words: str):
time.sleep(1)
return obj.result
def find_multiprocess(start_words: str):
start_words = start_words.strip()
start_words = re.sub(' +', ' ', start_words)
@ -86,6 +84,5 @@ def find_multiprocess(start_words: str):
if word == validword:
break
else:
raise ValueError('%s not in english bip39 wordlist' % (word,))
raise ValueError('%s not in wordlist' % (word,))
return handler(start_words)

View File

@ -4,15 +4,15 @@ sys.path.append("onionr/")
import unittest
import vanityonionr
import mnemonic
m = mnemonic.Mnemonic("english")
wordlist = m.wordlist
import niceware
wordlist = niceware.WORD_LIST
class TestBasic(unittest.TestCase):
def test_basic(self):
pair = vanityonionr.find_multiprocess("onion")
b = m.to_mnemonic(pair[0])
b = niceware.bytes_to_passphrase(pair[0])
self.assertIn("onion", b)
unittest.main()