diff --git a/core/src/trezor/utils.py b/core/src/trezor/utils.py index 34548bacc1..f45f574d07 100644 --- a/core/src/trezor/utils.py +++ b/core/src/trezor/utils.py @@ -16,10 +16,10 @@ from trezorutils import ( # noqa: F401 USE_BUTTON, USE_HAPTIC, USE_OPTIGA, - USE_TROPIC, USE_SD_CARD, USE_THP, USE_TOUCH, + USE_TROPIC, VERSION, bootloader_locked, check_firmware_header, diff --git a/core/tests/test_trezor.crypto.tropic.py b/core/tests/test_trezor.crypto.tropic.py new file mode 100644 index 0000000000..10bba7738c --- /dev/null +++ b/core/tests/test_trezor.crypto.tropic.py @@ -0,0 +1,27 @@ +import unittest + +from trezor.crypto import tropic + + +class TestCryptoTropic(unittest.TestCase): + def test_ping(self): + self.assertEqual(tropic.ping("HeLlO!"), "HeLlO!") + + def test_get_certificate(self): + self.assertEqual(len(tropic.get_certificate()), 512) + + def test_sign(self): + try: + tropic.sign(0, "ASD") + assert False + except ValueError as e: + self.assertIn("invalid length", str(e).lower()) + + tropic.key_generate(0) + + # signing should work now that we have a key + self.assertEqual(len(tropic.sign(0, "a" * 32)), 64) + + +if __name__ == "__main__": + unittest.main()