From 14334e71972f5ccc3b83be973a7375a2973417c1 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Mon, 30 Sep 2019 00:13:43 -0500 Subject: [PATCH] fix mnemonic test and added make-release.sh --- make-release.sh | 12 ++++++++++++ onionr/vanityonionr/__init__.py | 7 ++----- tests/test_vanity.py | 8 ++++---- 3 files changed, 18 insertions(+), 9 deletions(-) create mode 100755 make-release.sh diff --git a/make-release.sh b/make-release.sh new file mode 100755 index 00000000..36b02700 --- /dev/null +++ b/make-release.sh @@ -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 diff --git a/onionr/vanityonionr/__init__.py b/onionr/vanityonionr/__init__.py index 2f9fd18f..c42b1654 100644 --- a/onionr/vanityonionr/__init__.py +++ b/onionr/vanityonionr/__init__.py @@ -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) - diff --git a/tests/test_vanity.py b/tests/test_vanity.py index 4f17449f..78585b19 100644 --- a/tests/test_vanity.py +++ b/tests/test_vanity.py @@ -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() \ No newline at end of file