Skip to content

Commit

Permalink
Fix leading zero in private keys (#39)
Browse files Browse the repository at this point in the history
* Fix leading zero in private keys

* Fix build

* Bump version
  • Loading branch information
cyc60 authored Jul 20, 2023
1 parent 80895b1 commit a26ff71
Show file tree
Hide file tree
Showing 5 changed files with 759 additions and 720 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2022 StakeWise Labs
Copyright (C) 2023 StakeWise Labs
[email protected]


Expand Down
1 change: 1 addition & 0 deletions key-manager.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from PyInstaller.utils.hooks import collect_data_files
from sys import platform

datas = []
if platform == "linux" or platform == "linux2":
datas = [
('/usr/lib/x86_64-linux-gnu/libssl.so.3', '.'),
Expand Down
4 changes: 3 additions & 1 deletion key_manager/commands/sync_web3signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import yaml
from eth_utils import add_0x_prefix
from web3 import Web3
from web3.types import HexStr

from key_manager.contrib import is_lists_equal
from key_manager.database import Database, check_db_connection
Expand Down Expand Up @@ -53,7 +54,8 @@ def sync_web3signer(db_url: str, output_dir: str, decryption_key_env: str) -> No
for key_record in keys_records:
key = decryptor.decrypt(data=key_record.private_key, nonce=key_record.nonce)
key_hex = Web3.to_hex(int(key))
private_keys.append(add_0x_prefix(key_hex)) # pad missing leading zeros
key_hex = HexStr(key_hex[2:].zfill(64)) # pad missing leading zeros
private_keys.append(add_0x_prefix(key_hex))

if not exists(output_dir):
mkdir(output_dir)
Expand Down
Loading

0 comments on commit a26ff71

Please sign in to comment.