Skip to content

Commit 100e8ad

Browse files
authored
are-keys-equal (#26)
1 parent 59629ba commit 100e8ad

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lighter/signer_client.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def __init__(
198198

199199
def validate_api_private_keys(self, initial_private_key: str, private_keys: Dict[int, str]):
200200
if len(private_keys) == self.end_api_key_index - self.api_key_index + 1:
201-
if private_keys[self.api_key_index] != initial_private_key:
201+
if not self.are_keys_equal(private_keys[self.api_key_index], initial_private_key):
202202
raise ValidationError("inconsistent private keys")
203203
return # this is all we need to check in this case
204204
if len(private_keys) != self.end_api_key_index - self.api_key_index:
@@ -733,3 +733,12 @@ async def send_tx(self, tx_type: StrictInt, tx_info: str) -> RespSendTx:
733733

734734
async def close(self):
735735
await self.api_client.close()
736+
737+
@staticmethod
738+
def are_keys_equal(key1, key2) -> bool:
739+
start_index1, start_index2 = 0, 0
740+
if key1.startswith("0x"):
741+
start_index1 = 2
742+
if key2.startswith("0x"):
743+
start_index2 = 2
744+
return key1[start_index1:] == key2[start_index2:]

0 commit comments

Comments
 (0)