force tor if not manually disabled

This commit is contained in:
callebtc
2022-11-03 14:28:50 +01:00
parent 14a175b982
commit 86aea47e90
6 changed files with 23 additions and 13 deletions

View File

@@ -106,7 +106,7 @@ cashu info
Returns: Returns:
```bash ```bash
Version: 0.5.0 Version: 0.5.1
Debug: False Debug: False
Cashu dir: /home/user/.cashu Cashu dir: /home/user/.cashu
Wallet: wallet Wallet: wallet

View File

@@ -53,4 +53,4 @@ LNBITS_ENDPOINT = env.str("LNBITS_ENDPOINT", default=None)
LNBITS_KEY = env.str("LNBITS_KEY", default=None) LNBITS_KEY = env.str("LNBITS_KEY", default=None)
MAX_ORDER = 64 MAX_ORDER = 64
VERSION = "0.5.0" VERSION = "0.5.1"

View File

@@ -73,10 +73,15 @@ def cli(ctx, host: str, walletname: str):
wallet = Wallet(ctx.obj["HOST"], os.path.join(CASHU_DIR, walletname)) wallet = Wallet(ctx.obj["HOST"], os.path.join(CASHU_DIR, walletname))
if TOR and not TorProxy().check_platform(): if TOR and not TorProxy().check_platform():
print( error_str = "Your settings say TOR=true but the built-in Tor bundle is not supported on your system. Please install Tor manually and set TOR=false and SOCKS_HOST=localhost and SOCKS_PORT=9050 in your Cashu config (recommended) or turn off Tor by setting TOR=false (not recommended). Cashu will not work until you edit your config file accordingly."
"WARNING: Your settings say TOR=true but the built-in Tor bundle is not supported on your system. Your IP will be visible to the mint! Please install Tor manually and set TOR=false and SOCKS_HOST=localhost and SOCKS_PORT=9050 in your Cashu config (recommended) or turn off Tor altogether by setting TOR=false (not recommended)." error_str += "\n\n"
) if ENV_FILE:
print("") error_str += f"Edit your Cashu config file here: {ENV_FILE}"
else:
error_str += (
f"Ceate a new Cashu config file here: {os.path.join(CASHU_DIR, '.env')}"
)
raise Exception(error_str)
ctx.obj["WALLET"] = wallet ctx.obj["WALLET"] = wallet
asyncio.run(init_wallet(wallet)) asyncio.run(init_wallet(wallet))

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "cashu" name = "cashu"
version = "0.5.0" version = "0.5.1"
description = "Ecash wallet and mint." description = "Ecash wallet and mint."
authors = ["calle <callebtc@protonmail.com>"] authors = ["calle <callebtc@protonmail.com>"]
license = "MIT" license = "MIT"

View File

@@ -13,7 +13,7 @@ entry_points = {"console_scripts": ["cashu = cashu.wallet.cli:cli"]}
setuptools.setup( setuptools.setup(
name="cashu", name="cashu",
version="0.5.0", version="0.5.1",
description="Ecash wallet and mint with Bitcoin Lightning support", description="Ecash wallet and mint with Bitcoin Lightning support",
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",

View File

@@ -42,14 +42,19 @@ def test_hash_to_curve_iteration():
def test_step1(): def test_step1():
"""""" """"""
B_, blinding_factor = step1_alice( B_, blinding_factor = step1_alice(
"test_message", blinding_factor=b"00000000000000000000000000000001" # 32 bytes "test_message",
blinding_factor=bytes.fromhex(
"0000000000000000000000000000000000000000000000000000000000000001"
), # 32 bytes
) )
assert ( assert (
B_.serialize().hex() B_.serialize().hex()
== "0243379106c73dfc635cd1422f406e83fbfa25be83bb3620aefc08f2b89d02d777" == "02a9acc1e48c25eeeb9289b5031cc57da9fe72f3fe2861d264bdc074209b107ba2"
)
assert blinding_factor.private_key == bytes.fromhex(
"0000000000000000000000000000000000000000000000000000000000000001"
) )
assert blinding_factor.private_key == b"00000000000000000000000000000001"
def test_step2(): def test_step2():
@@ -76,7 +81,7 @@ def test_step3():
# C = C_ - A.mult(r) # C = C_ - A.mult(r)
C_ = PublicKey( C_ = PublicKey(
bytes.fromhex( bytes.fromhex(
"02b15f14ae9259c101cdbc437e8877b1ca5d4af3a0c0684866b38d8c8d0b6f6374" "02a9acc1e48c25eeeb9289b5031cc57da9fe72f3fe2861d264bdc074209b107ba2"
), ),
raw=True, raw=True,
) )
@@ -97,5 +102,5 @@ def test_step3():
assert ( assert (
C.serialize().hex() C.serialize().hex()
== "03398f7153b381ce54d57962a5e03ce0a4f3b79755e882c972b788e8488e59b0c9" == "03c724d7e6a5443b39ac8acf11f40420adc4f99a02e7cc1b57703d9391f6d129cd"
) )