1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

chore(python): remove Lisk

This commit is contained in:
matejcik 2021-08-18 12:08:46 +02:00 committed by matejcik
parent becf5dcc53
commit ee068b01ea
6 changed files with 1 additions and 460 deletions

View File

@ -0,0 +1 @@
Removed support for Lisk

View File

@ -49,7 +49,6 @@ on one page here.
firmware Firmware commands. firmware Firmware commands.
get-features Retrieve device features and settings. get-features Retrieve device features and settings.
get-session Get a session ID for subsequent commands. get-session Get a session ID for subsequent commands.
lisk Lisk commands.
list List connected Trezor devices. list List connected Trezor devices.
monero Monero commands. monero Monero commands.
nem NEM commands. nem NEM commands.
@ -298,29 +297,6 @@ Firmware commands.
update Upload new firmware to device. update Upload new firmware to device.
verify Verify the integrity of the firmware data stored in a file. verify Verify the integrity of the firmware data stored in a file.
Lisk commands.
~~~~~~~~~~~~~~
.. code::
trezorctl lisk --help
.. code::
Usage: trezorctl lisk [OPTIONS] COMMAND [ARGS]...
Lisk commands.
Options:
--help Show this message and exit.
Commands:
get-address Get Lisk address for specified path.
get-public-key Get Lisk public key for specified path.
sign-message Sign message with Lisk address.
sign-tx Sign Lisk transaction.
verify-message Verify message signed with Lisk address.
Monero commands. Monero commands.
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~

View File

@ -1,94 +0,0 @@
# This file is part of the Trezor project.
#
# Copyright (C) 2012-2019 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
import json
import click
from .. import lisk, tools
from . import with_client
PATH_HELP = "BIP-32 path, e.g. m/44'/134'/0'/0'"
@click.group(name="lisk")
def cli():
"""Lisk commands."""
@cli.command()
@click.option("-n", "--address", required=True, help=PATH_HELP)
@click.option("-d", "--show-display", is_flag=True)
@with_client
def get_address(client, address, show_display):
"""Get Lisk address for specified path."""
address_n = tools.parse_path(address)
return lisk.get_address(client, address_n, show_display)
@cli.command()
@click.option("-n", "--address", required=True, help=PATH_HELP)
@click.option("-d", "--show-display", is_flag=True)
@with_client
def get_public_key(client, address, show_display):
"""Get Lisk public key for specified path."""
address_n = tools.parse_path(address)
res = lisk.get_public_key(client, address_n, show_display)
output = {"public_key": res.public_key.hex()}
return output
@cli.command()
@click.argument("file", type=click.File("r"))
@click.option("-n", "--address", required=True, help=PATH_HELP)
@click.option("-f", "--file", "_ignore", is_flag=True, hidden=True, expose_value=False)
@with_client
def sign_tx(client, address, file):
"""Sign Lisk transaction."""
address_n = tools.parse_path(address)
transaction = lisk.sign_tx(client, address_n, json.load(file))
payload = {"signature": transaction.signature.hex()}
return payload
@cli.command()
@click.option("-n", "--address", required=True, help=PATH_HELP)
@click.argument("message")
@with_client
def sign_message(client, address, message):
"""Sign message with Lisk address."""
address_n = tools.parse_path(address)
res = lisk.sign_message(client, address_n, message)
output = {
"message": message,
"public_key": res.public_key.hex(),
"signature": res.signature.hex(),
}
return output
@cli.command()
@click.argument("pubkey")
@click.argument("signature")
@click.argument("message")
@with_client
def verify_message(client, pubkey, signature, message):
"""Verify message signed with Lisk address."""
signature = bytes.fromhex(signature)
pubkey = bytes.fromhex(pubkey)
return lisk.verify_message(client, pubkey, signature, message)

View File

@ -40,7 +40,6 @@ from . import (
ethereum, ethereum,
fido, fido,
firmware, firmware,
lisk,
monero, monero,
nem, nem,
ripple, ripple,
@ -70,7 +69,6 @@ COMMAND_ALIASES = {
"bnb": binance.cli, "bnb": binance.cli,
"eth": ethereum.cli, "eth": ethereum.cli,
"ada": cardano.cli, "ada": cardano.cli,
"lsk": lisk.cli,
"xmr": monero.cli, "xmr": monero.cli,
"xrp": ripple.cli, "xrp": ripple.cli,
"xlm": stellar.cli, "xlm": stellar.cli,
@ -333,7 +331,6 @@ cli.add_command(device.cli)
cli.add_command(eos.cli) cli.add_command(eos.cli)
cli.add_command(ethereum.cli) cli.add_command(ethereum.cli)
cli.add_command(fido.cli) cli.add_command(fido.cli)
cli.add_command(lisk.cli)
cli.add_command(monero.cli) cli.add_command(monero.cli)
cli.add_command(nem.cli) cli.add_command(nem.cli)
cli.add_command(ripple.cli) cli.add_command(ripple.cli)

View File

@ -1,60 +0,0 @@
# This file is part of the Trezor project.
#
# Copyright (C) 2012-2019 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
from . import exceptions, messages
from .protobuf import dict_to_proto
from .tools import dict_from_camelcase, expect, normalize_nfc
@expect(messages.LiskAddress, field="address")
def get_address(client, n, show_display=False):
return client.call(messages.LiskGetAddress(address_n=n, show_display=show_display))
@expect(messages.LiskPublicKey)
def get_public_key(client, n, show_display=False):
return client.call(
messages.LiskGetPublicKey(address_n=n, show_display=show_display)
)
@expect(messages.LiskMessageSignature)
def sign_message(client, n, message):
message = normalize_nfc(message)
return client.call(messages.LiskSignMessage(address_n=n, message=message))
def verify_message(client, pubkey, signature, message):
message = normalize_nfc(message)
try:
resp = client.call(
messages.LiskVerifyMessage(
signature=signature, public_key=pubkey, message=message
)
)
except exceptions.TrezorFailure:
return False
return isinstance(resp, messages.Success)
RENAMES = {"lifetime": "life_time", "keysgroup": "keys_group"}
@expect(messages.LiskSignedTx)
def sign_tx(client, n, transaction):
transaction = dict_from_camelcase(transaction, renames=RENAMES)
msg = dict_to_proto(messages.LiskTransactionCommon, transaction)
return client.call(messages.LiskSignTx(address_n=n, transaction=msg))

View File

@ -129,15 +129,6 @@ class MessageType(IntEnum):
NEMSignedTx = 70 NEMSignedTx = 70
NEMDecryptMessage = 75 NEMDecryptMessage = 75
NEMDecryptedMessage = 76 NEMDecryptedMessage = 76
LiskGetAddress = 114
LiskAddress = 115
LiskSignTx = 116
LiskSignedTx = 117
LiskSignMessage = 118
LiskMessageSignature = 119
LiskVerifyMessage = 120
LiskGetPublicKey = 121
LiskPublicKey = 122
TezosGetAddress = 150 TezosGetAddress = 150
TezosAddress = 151 TezosAddress = 151
TezosSignTx = 152 TezosSignTx = 152
@ -403,17 +394,6 @@ class DebugSwipeDirection(IntEnum):
RIGHT = 3 RIGHT = 3
class LiskTransactionType(IntEnum):
Transfer = 0
RegisterSecondPassphrase = 1
RegisterDelegate = 2
CastVotes = 3
RegisterMultisignatureAccount = 4
CreateDapp = 5
TransferIntoDapp = 6
TransferOutOfDapp = 7
class NEMMosaicLevy(IntEnum): class NEMMosaicLevy(IntEnum):
MosaicLevy_Absolute = 1 MosaicLevy_Absolute = 1
MosaicLevy_Percentile = 2 MosaicLevy_Percentile = 2
@ -4124,265 +4104,6 @@ class EthereumAccessList(protobuf.MessageType):
self.address = address self.address = address
class LiskGetAddress(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 114
FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False),
2: protobuf.Field("show_display", "bool", repeated=False, required=False),
}
def __init__(
self,
*,
address_n: Optional[List["int"]] = None,
show_display: Optional["bool"] = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.show_display = show_display
class LiskAddress(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 115
FIELDS = {
1: protobuf.Field("address", "string", repeated=False, required=True),
}
def __init__(
self,
*,
address: "str",
) -> None:
self.address = address
class LiskGetPublicKey(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 121
FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False),
2: protobuf.Field("show_display", "bool", repeated=False, required=False),
}
def __init__(
self,
*,
address_n: Optional[List["int"]] = None,
show_display: Optional["bool"] = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.show_display = show_display
class LiskPublicKey(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 122
FIELDS = {
1: protobuf.Field("public_key", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
public_key: "bytes",
) -> None:
self.public_key = public_key
class LiskSignTx(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 116
FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False),
2: protobuf.Field("transaction", "LiskTransactionCommon", repeated=False, required=True),
}
def __init__(
self,
*,
transaction: "LiskTransactionCommon",
address_n: Optional[List["int"]] = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.transaction = transaction
class LiskSignedTx(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 117
FIELDS = {
1: protobuf.Field("signature", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
signature: "bytes",
) -> None:
self.signature = signature
class LiskSignMessage(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 118
FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False),
2: protobuf.Field("message", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
message: "bytes",
address_n: Optional[List["int"]] = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.message = message
class LiskMessageSignature(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 119
FIELDS = {
1: protobuf.Field("public_key", "bytes", repeated=False, required=True),
2: protobuf.Field("signature", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
public_key: "bytes",
signature: "bytes",
) -> None:
self.public_key = public_key
self.signature = signature
class LiskVerifyMessage(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 120
FIELDS = {
1: protobuf.Field("public_key", "bytes", repeated=False, required=True),
2: protobuf.Field("signature", "bytes", repeated=False, required=True),
3: protobuf.Field("message", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
public_key: "bytes",
signature: "bytes",
message: "bytes",
) -> None:
self.public_key = public_key
self.signature = signature
self.message = message
class LiskTransactionCommon(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("type", "LiskTransactionType", repeated=False, required=False),
2: protobuf.Field("amount", "uint64", repeated=False, required=False),
3: protobuf.Field("fee", "uint64", repeated=False, required=False),
4: protobuf.Field("recipient_id", "string", repeated=False, required=False),
5: protobuf.Field("sender_public_key", "bytes", repeated=False, required=False),
6: protobuf.Field("requester_public_key", "bytes", repeated=False, required=False),
7: protobuf.Field("signature", "bytes", repeated=False, required=False),
8: protobuf.Field("timestamp", "uint32", repeated=False, required=False),
9: protobuf.Field("asset", "LiskTransactionAsset", repeated=False, required=False),
}
def __init__(
self,
*,
type: Optional["LiskTransactionType"] = None,
amount: Optional["int"] = None,
fee: Optional["int"] = None,
recipient_id: Optional["str"] = None,
sender_public_key: Optional["bytes"] = None,
requester_public_key: Optional["bytes"] = None,
signature: Optional["bytes"] = None,
timestamp: Optional["int"] = None,
asset: Optional["LiskTransactionAsset"] = None,
) -> None:
self.type = type
self.amount = amount
self.fee = fee
self.recipient_id = recipient_id
self.sender_public_key = sender_public_key
self.requester_public_key = requester_public_key
self.signature = signature
self.timestamp = timestamp
self.asset = asset
class LiskTransactionAsset(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("signature", "LiskSignatureType", repeated=False, required=False),
2: protobuf.Field("delegate", "LiskDelegateType", repeated=False, required=False),
3: protobuf.Field("votes", "string", repeated=True, required=False),
4: protobuf.Field("multisignature", "LiskMultisignatureType", repeated=False, required=False),
5: protobuf.Field("data", "string", repeated=False, required=False),
}
def __init__(
self,
*,
votes: Optional[List["str"]] = None,
signature: Optional["LiskSignatureType"] = None,
delegate: Optional["LiskDelegateType"] = None,
multisignature: Optional["LiskMultisignatureType"] = None,
data: Optional["str"] = None,
) -> None:
self.votes = votes if votes is not None else []
self.signature = signature
self.delegate = delegate
self.multisignature = multisignature
self.data = data
class LiskSignatureType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("public_key", "bytes", repeated=False, required=False),
}
def __init__(
self,
*,
public_key: Optional["bytes"] = None,
) -> None:
self.public_key = public_key
class LiskDelegateType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("username", "string", repeated=False, required=False),
}
def __init__(
self,
*,
username: Optional["str"] = None,
) -> None:
self.username = username
class LiskMultisignatureType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("min", "uint32", repeated=False, required=False),
2: protobuf.Field("life_time", "uint32", repeated=False, required=False),
3: protobuf.Field("keys_group", "string", repeated=True, required=False),
}
def __init__(
self,
*,
keys_group: Optional[List["str"]] = None,
min: Optional["int"] = None,
life_time: Optional["int"] = None,
) -> None:
self.keys_group = keys_group if keys_group is not None else []
self.min = min
self.life_time = life_time
class MoneroTransactionSourceEntry(protobuf.MessageType): class MoneroTransactionSourceEntry(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {