Skip to content

Commit

Permalink
Merge branch 'newDesign' into public
Browse files Browse the repository at this point in the history
  • Loading branch information
bitlogik committed Aug 1, 2022
2 parents e75e809 + 76195c8 commit c5e4110
Show file tree
Hide file tree
Showing 94 changed files with 6,177 additions and 3,403 deletions.
34 changes: 8 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ The Local File device stores the wallet seed in a file on your disk, in your
user data directory. The encryption is done with your password. LocalFile stores
only the seed encrypted [with a random salt using libsodium XSalsa20/Poly1305](https://libsodium.gitbook.io/doc/secret-key_cryptography/secretbox#algorithm-details),
using an encryption key derived from the user chosen password using [Argon2id
(moderate
settings)](https://raw.githubusercontent.com/P-H-C/phc-winner-argon2/master/argon2-specs.pdf).
(moderate settings)](https://raw.githubusercontent.com/P-H-C/phc-winner-argon2/master/argon2-specs.pdf).
One can choose to use a default password. To do so, just leave blank the
password prompt input when asked the first time at device setting. Without a
personalized password, the security of the key is what your hard-drive computer
Expand All @@ -255,7 +254,7 @@ wallet.
The folder where the HDseed file is stored, sits in the user data directory.

- Windows :
C:\\Users\\\\AppData\\Local\\BitLogiK\\Uniblow\\keys\\
C:\\Users\\\<USER\>\\AppData\\Local\\BitLogiK\\Uniblow\\keys\\

- Linux :
\~/.local/share/Uniblow/keys/
Expand Down Expand Up @@ -321,6 +320,8 @@ If the card is locked, only half initialized, or in a fancy state, you can use
the [CryptnoxPro](https://github.com/Cryptnox-Software/cryptnoxpro) or the [Cryptnox iOS app](https://apps.apple.com/app/id1583011693). Because Uniblow
cannot perform advanced operations such as PIN unlock, nor card reset.

For quick demo, the default PIN is setup to "1234".

### OpenPGP device

Works with an OpenPGP v2/v3 device that accepts User Interaction confirmation
Expand Down Expand Up @@ -406,35 +407,16 @@ Development

### Run it from source

- For the GUI, [install wxPython 4](https://wxpython.org/pages/downloads/)
with your system binaries wheels.

- **Windows** : Install
[Python3](https://www.python.org/ftp/python/3.9.9/python-3.9.9-amd64.exe),
then run `pip3 install wxPython==4.1.1`

- **MacOS** : Read the [MacDev document](docs/MacDev.md) for more details.

- **Linux** : Read the [LinuxDev document](docs/LinuxDev.md) for more
details

- Install the uniblow package and its dependencies (or use venv)

- `python3 setup.py install --user`

- For ETH testnets, put your Infura key in ETHwallet. The binaries have an
Infura key embedded.
- **Windows** : Read the [WinDev document](docs/WinDev.md).

- Run with `python3 uniblow.py -v`
- **MacOS** : Read the [MacDev document](docs/MacDev.md).

The '-v' argument enables the debug logging output for more verbose terminal
output.
- **Linux** : Read the [LinuxDev document](docs/LinuxDev.md)

### Build binaries

There are specific instructions and scripts to build uniblow binaries for the
Windows, Debian and MacOS platforms in a dedicated [build
document](docs/Build.md).
Windows, Debian and MacOS platforms in a dedicated [build document](docs/Build.md).

License
-------
Expand Down
4 changes: 2 additions & 2 deletions cryptolib/HDwallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def bip39_is_checksum_valid(mnemonic):
if words_len not in [12, 15, 18, 21, 24]:
return False, True
entropy = i >> checksum_length
checksum = i % 2 ** checksum_length
checksum = i % 2**checksum_length
entb = entropy.to_bytes(entropy_length >> 3, "big")
hashed = int.from_bytes(sha2(entb), "big")
computed_checksum = hashed >> (256 - checksum_length)
Expand Down Expand Up @@ -177,7 +177,7 @@ def generate_mnemonic(nwords):

class BIP32node:

HARDENED_LIMIT = 2 ** 31
HARDENED_LIMIT = 2**31

def __init__(self, i, depth, pvkey, chaincode, curve, parent_fingerprint):
# self.vpub_bytes = bytes.fromhex("0488B21E") # testnet 0x043587CF
Expand Down
2 changes: 1 addition & 1 deletion cryptolib/coins/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def signature_form(tx, i, script, hashcode=SIGHASH_ALL):
elif hashcode == SIGHASH_SINGLE:
newtx["outs"] = newtx["outs"][: len(newtx["ins"])]
for out in newtx["outs"][: len(newtx["ins"]) - 1]:
out["value"] = 2 ** 64 - 1
out["value"] = 2**64 - 1
out["script"] = ""
elif hashcode == SIGHASH_ANYONECANPAY:
newtx["ins"] = [newtx["ins"][i]]
Expand Down
2 changes: 1 addition & 1 deletion devices/BaseDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def derive_key(self, path, key_type):

@abstractmethod
def get_public_key(self):
"""Provide the publie key in hex X962.
"""Provide the public key in hex X962.
Compressed format, can be provided uncompressed for EVM wallets.
For EdDSA provide the "raw" 32 bytes public key in hex.
"""
Expand Down
4 changes: 4 additions & 0 deletions devices/Cryptnox.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def __init__(self):
self.account = None
self.aindex = None

def disconnect(self):
if self.card is not None:
del self.card

def initialize_device(self, settings):
self.account = settings["account"]
self.aindex = settings["index"]
Expand Down
2 changes: 2 additions & 0 deletions devices/Ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def open_account(self):
"Install and open the Ethereum app in the Ledger."
)
raise Exception(f"Error {hex(exc.sw)} in Ledger.")
if len(eth_app_info) != 4:
raise Exception(f"Invalid response from the Ledger.")
eth_version = f"{eth_app_info[1]}.{eth_app_info[2]}.{eth_app_info[3]}"
logger.debug(f"Ledger ETH app version {eth_version}")
if int.from_bytes(eth_app_info[1:4], "big") < MINIMUM_APP_VERSION:
Expand Down
31 changes: 18 additions & 13 deletions devices/SeedWatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@
CURSOR_HAND,
BITMAP_TYPE_PNG,
TextDataObject,
Font,
FontInfo,
)
import gui.swgui
from gui.app import file_path
from gui.app import file_path, scaleSize
from cryptolib.HDwallet import (
HD_Wallet,
generate_mnemonic,
Expand Down Expand Up @@ -127,7 +129,7 @@ def __init__(self, parent):
Menu.__init__(self)
self.parent = parent

men1 = MenuItem(self, 1, "Copy Address")
men1 = MenuItem(self, 1, "Copy address")
self.Append(men1)
self.Bind(EVT_MENU, self.parent.copy_account, men1)

Expand All @@ -143,7 +145,9 @@ def __init__(self, parent):
class SeedWatcherFrame(gui.swgui.MainFrame):
def closesw(self, event):
event.Skip()
self.GetParent().Show()
gui_frm = self.GetParent()
gui_frm.swrun = False
gui_frm.Show()


class SeedWatcherPanel(gui.swgui.MainPanel):
Expand Down Expand Up @@ -172,8 +176,8 @@ def gen_new_mnemonic(self, event):
self.generate_mnemonic(selnw)

def initialize(self, cb_wallet):
self.GOOD_BMP = Bitmap(file_path("gui/good.bmp"))
self.BAD_BMP = Bitmap(file_path("gui/bad.bmp"))
self.GOOD_BMP = Bitmap(file_path("gui/images/good.png"))
self.BAD_BMP = Bitmap(file_path("gui/images/bad.png"))
self.m_choice_nwords.Set(WORDSLEN_LIST)
self.m_choice_nwords.SetSelection(0)
ctab = self.m_dataViewListCtrl1
Expand Down Expand Up @@ -348,7 +352,7 @@ def copy_account(self, event):
copied_modal = MessageDialog(
self,
f"Account address {addr}\nwas copied in the clipboard",
"Copied",
"Address copied",
STAY_ON_TOP | CENTER,
DefaultPosition,
)
Expand Down Expand Up @@ -392,9 +396,10 @@ def open_wallet(self, evt):

def start_seedwatcher(app, cb_wallet):
app.frame_sw = SeedWatcherFrame(app.gui_frame)
app.frame_sw.SetSize(scaleSize(app.frame_sw, (650, 700)))
app.gui_frame.swrun = True
app.frame_sw.SetIcons(IconBundle(file_path("gui/uniblow.ico")))
HAND_CURSOR = Cursor(CURSOR_HAND)
app.gui_panel.devices_choice.SetSelection(0)
app.gui_frame.Hide()
app.panel_sw = SeedWatcherPanel(app.frame_sw)
app.panel_sw.m_textCtrl_mnemo.SetFocus()
Expand All @@ -403,18 +408,18 @@ def start_seedwatcher(app, cb_wallet):
"Select asset line, then right click on it to open menu"
)

app.panel_sw.m_button_gen.SetBitmap(Bitmap(file_path("gui/GenSeed.png"), BITMAP_TYPE_PNG))
app.panel_sw.m_button_gen.SetBitmapPressed(
Bitmap(file_path("gui/GenSeeddn.png"), BITMAP_TYPE_PNG)
app.panel_sw.m_button_gen.SetBitmap(
Bitmap(file_path("gui/images/btns/GenSeed.png"), BITMAP_TYPE_PNG)
)
app.panel_sw.m_btnseek.SetBitmap(Bitmap(file_path("gui/SeekAssets.png"), BITMAP_TYPE_PNG))
app.panel_sw.m_btnseek.SetBitmapPressed(
Bitmap(file_path("gui/SeekAssetsdn.png"), BITMAP_TYPE_PNG)
app.panel_sw.m_btnseek.SetBitmap(
Bitmap(file_path("gui/images/btns/SeekAssets.png"), BITMAP_TYPE_PNG)
)

app.panel_sw.m_button_gen.SetCursor(HAND_CURSOR)
app.panel_sw.m_choice_nwords.SetCursor(HAND_CURSOR)
app.panel_sw.m_typechoice.SetCursor(HAND_CURSOR)
app.panel_sw.m_btnseek.SetCursor(HAND_CURSOR)
if sys.platform.startswith("darwin"):
app.panel_sw.m_textCtrl_mnemo.SetFont(Font(FontInfo(18)))
app.panel_sw.initialize(cb_wallet)
app.frame_sw.Show()
11 changes: 9 additions & 2 deletions devices/cryptnox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,14 @@ def select(self):

def send_apdu(self, APDU):
"""Send a full APDU command, APDU is a list of integers."""
logger.debug("--> sending : %i bytes data ", (len(APDU) - 5))
data_send = len(APDU) - 5
command = "0x" + hex(APDU[1])[2:].upper()
if data_send > 0:
if data_send >= 2 and APDU[4] != data_send:
data_send -= 2
logger.debug("--> sending %s with %i bytes data ", command, data_send)
else:
logger.debug("--> sending %s", command)
logger.debug(bytes(APDU).hex())
try:
data, sw1, sw2 = self.connection.transmit(APDU)
Expand Down Expand Up @@ -569,7 +576,7 @@ def get_xpub(self):
return xpubkey

def get_path(self, curvetype="K1", path=b""):
"""Read the cuuren tkey path."""
"""Read the current key path."""
curve_code = 0x00
if curvetype[-2:].upper() == "R1":
curve_code = 0x10
Expand Down
5 changes: 3 additions & 2 deletions devices/ledger/ledgerComm.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,12 @@ def exchange(self, apdu, timeout=20000):
raise LedgerException("Ledger was disconnected.")
logger.debug(" Sending => %s", apdu.hex())
response, sw1, sw2 = self.device.transmit(toBytes(apdu.hex()))
resp = bytearray(response)
sw = (sw1 << 8) | sw2
logger.debug(" Receiving <= %s%.2x", response.hex(), sw)
logger.debug(" Receiving <= %s%.2x", resp.hex(), sw)
if sw != 0x9000:
raise LedgerException("Invalid status %04x" % sw, sw)
return bytearray(response)
return resp

def close(self):
if self.opened:
Expand Down
2 changes: 1 addition & 1 deletion docs/Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This document provides specific instructions and scripts to build uniblow binari

## Windows 10

* Install [Python 3.9](https://www.python.org/ftp/python/3.9.9/python-3.9.9-amd64.exe)
* Install [Python 3.9](https://www.python.org/ftp/python/3.9.13/python-3.9.13-amd64.exe)

* Install Microsoft Visual C++ 14.x build tools. Required for bootloader installer and pysha3 library compilation.

Expand Down
10 changes: 9 additions & 1 deletion docs/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@

Uniblow versions history

## 2.0.0

* Full redesign of the GUI
* Allow offline mode, display address
* Add fiat prices
* Improve Ledger
* Fix issue preventing start in some Windows
* Eth testnets add Sepolia, remove Rinkeby and Ropsten
* Tezos testnets add Jakarta remove Hangzhou

## 1.6.5

Expand Down
16 changes: 12 additions & 4 deletions docs/MacDev.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ Windows, Debian and MacOS platforms in the [Build document](Build.md).

You MacOS system needs :

- [Python 3.9
pkg](https://www.python.org/ftp/python/3.9.9/python-3.9.9-macos11.pkg)
installed
- [Python 3.9 pkg](https://www.python.org/ftp/python/3.9.9/python-3.9.9-macos11.pkg) installed

- XCode and developer tools
- XCode and developer tools

#### Prepare system

Expand All @@ -30,37 +28,47 @@ cd /Applications/Python\ 3.9/
```

#### Get the uniblow source

```
git clone https://github.com/bitlogik/uniblow.git
cd uniblow
```

#### Create venv for uniblow

```
python3 -m venv unibenv
source unibenv/bin/activate
```

#### Install uniblow dependencies

```
python -m pip install pip==21.2.1
python -m pip install swig
python -m pip install wxPython==4.1.1
python -m pip install -e .
```

#### Run uniblow

```
python uniblow.py
```

The '-v' argument added enables the debug logging output for more verbose terminal
output.

#### Quit the venv

```
deactivate
```

#### Run uniblow next time

Within a terminal, in the uniblow directory

```
source unibenv/bin/activate
python uniblow.py
Expand Down
36 changes: 36 additions & 0 deletions docs/WinDev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Uniblow development on Windows

The following instructions commands are given to run uniblow **from the source** on the Windows system. This can also be used for development purpose.

When running from the source files, for ETH testnets, you can put your Infura key in
ETHwallet.

There are specific instructions and scripts to build uniblow binaries for the
Windows, Debian and MacOS platforms in the [Build document](Build.md).

In Windows, you can easily [run the binaries provided](https://uniblow.org/get). The following instructions here are only to run Uniblow from the Python source code, for development purpose.

### Install dependencies

- For the GUI, Install WxPython.

- Install [Python3.9](https://www.python.org/ftp/python/3.9.13/python-3.9.13-amd64.exe),

- Then run `python -m pip install wxPython==4.1.1`

- Download the Uniblow source code

with git : `git clone https://github.com/bitlogik/uniblow.git`

Zip without git : [Download here](https://github.com/bitlogik/uniblow/archive/refs/heads/master.zip)

### Install and run uniblow

- In the uniblow directory, install the uniblow package and its dependencies (or use venv)

- `python setup.py install --user`

- Run with `python uniblow.py -v`

The '-v' argument enables the debug logging output for more verbose terminal
output.
Binary file removed gui/GenSeed.png
Binary file not shown.
Binary file removed gui/GenSeeddn.png
Binary file not shown.
Binary file removed gui/SeekAssets.png
Binary file not shown.
Binary file removed gui/SeekAssetsdn.png
Binary file not shown.
Loading

0 comments on commit c5e4110

Please sign in to comment.