2018-06-21 14:28:34 +00:00
|
|
|
# This file is part of the Trezor project.
|
2018-06-06 20:50:27 +00:00
|
|
|
#
|
2019-05-29 16:44:09 +00:00
|
|
|
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
2018-06-06 20:50:27 +00:00
|
|
|
#
|
|
|
|
# This library is free software: you can redistribute it and/or modify
|
2018-06-21 14:28:34 +00:00
|
|
|
# it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
# as published by the Free Software Foundation.
|
2018-06-06 20:50:27 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
2018-06-21 14:28:34 +00:00
|
|
|
# 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>.
|
2018-06-06 20:50:27 +00:00
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2018-08-10 12:04:58 +00:00
|
|
|
from trezorlib import lisk
|
2018-08-10 12:37:49 +00:00
|
|
|
from trezorlib.tools import parse_path
|
|
|
|
|
2020-10-26 12:32:03 +00:00
|
|
|
LISK_PATH = parse_path("m/44h/134h/0h")
|
|
|
|
LISK_PUBKEY = "68ffcc8fd29675264ba2c01e0926697b66b197179e130d4996ee07cd13892c1c"
|
2018-06-06 20:50:27 +00:00
|
|
|
|
|
|
|
|
2019-08-22 16:47:01 +00:00
|
|
|
@pytest.mark.altcoin
|
2018-06-06 20:50:27 +00:00
|
|
|
@pytest.mark.lisk
|
2020-10-26 12:32:03 +00:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"message, signature",
|
|
|
|
(
|
|
|
|
pytest.param(
|
|
|
|
"This is an example of a signed message.",
|
|
|
|
"96dbdc588b6ec21a17b3d6d6c3c323179376302094c1125f106c9df2d44df9e8f579c8ea241caed7796feb490a7f3ffb8ff4a54a1f8cc437fa59381c32a01408",
|
|
|
|
id="short",
|
|
|
|
),
|
|
|
|
pytest.param(
|
|
|
|
"VeryLongMessage!" * 64,
|
|
|
|
"fdac2a32d0d2f39a5ad189daa843ccae6816f0cee17f54667edbbc4119aea2dbce2877e4c660ec4d9a916cb122674efdb435ff0de08a1950e71958b4ae450609",
|
|
|
|
id="long",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
def test_sign(client, message, signature):
|
|
|
|
sig = lisk.sign_message(client, LISK_PATH, message)
|
|
|
|
assert sig.public_key.hex() == LISK_PUBKEY
|
|
|
|
assert sig.signature.hex() == signature
|