mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-21 23:18:13 +00:00
python: move out deprecated ckd_public
This commit is contained in:
parent
5dfb01c25d
commit
9d29952a15
@ -38,11 +38,13 @@ _At the moment, the project does **not** adhere to [Semantic Versioning](https:/
|
||||
|
||||
- `trezorlib.tx_api` was removed
|
||||
- `trezorlib.coins` and coin data was removed
|
||||
- `trezorlib.ckd_public`, which was deprecated in 0.10, was now removed.
|
||||
- `btc.sign_tx` will not preload transaction data from `prev_txes`, as usage with TxApi
|
||||
is being removed
|
||||
- PIN protection and passphrase protection for `ping()` command was removed
|
||||
- compatibility no-op code from trezorlib 0.9 was removed from `trezorlib.client`
|
||||
|
||||
|
||||
## [0.11.6] - 2019-12-30
|
||||
[0.11.6]: https://github.com/trezor/trezor-firmware/compare/python/v0.11.5...python/v0.11.6
|
||||
|
||||
@ -69,6 +71,7 @@ _At the moment, the project does **not** adhere to [Semantic Versioning](https:/
|
||||
for details.
|
||||
- support for "load device by xprv" was removed from firmware and trezorlib
|
||||
|
||||
|
||||
## [0.11.5] - 2019-09-26
|
||||
|
||||
[0.11.5]: https://github.com/trezor/trezor-firmware/compare/python/v0.11.4...python/v0.11.5
|
||||
|
@ -1,34 +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 trezorlib import ckd_public
|
||||
|
||||
|
||||
def test_ckd_public():
|
||||
xpub1 = "xpub661MyMwAqRbcEnKbXcCqD2GT1di5zQxVqoHPAgHNe8dv5JP8gWmDproS6kFHJnLZd23tWevhdn4urGJ6b264DfTGKr8zjmYDjyDTi9U7iyT"
|
||||
node1 = ckd_public.deserialize(xpub1)
|
||||
node2 = ckd_public.public_ckd(node1, [0])
|
||||
node3 = ckd_public.public_ckd(node1, [0, 0])
|
||||
xpub2 = ckd_public.serialize(node2)
|
||||
xpub3 = ckd_public.serialize(node3)
|
||||
assert (
|
||||
xpub2
|
||||
== "xpub67ymn1YTdE2iSGXitxUEZeUdHF2FsejJATroeAxVMtzTAK9o3vjmFLrE7TqE1X76iobkVc3p8h3gNzNRTwPeQGYW3CCmYCG8n5ThVkXaQzs"
|
||||
)
|
||||
assert (
|
||||
xpub3
|
||||
== "xpub6BD2MwdEg5PJPqiGetL9DJs7oDo6zP3XwAABX2vAQb5eLpY3QhHGUEm25V4nkQhnFMsqEVfTwtax2gKz8EFrt1PnBN6xQjE9jGmWDR6modu"
|
||||
)
|
@ -17,7 +17,6 @@
|
||||
import hashlib
|
||||
import hmac
|
||||
import struct
|
||||
import warnings
|
||||
|
||||
import ecdsa
|
||||
from ecdsa.curves import SECP256k1
|
||||
@ -26,8 +25,6 @@ from ecdsa.util import number_to_string, string_to_number
|
||||
|
||||
from trezorlib import messages, tools
|
||||
|
||||
warnings.warn("ckd_public module is deprecated and will be removed", DeprecationWarning)
|
||||
|
||||
|
||||
def point_to_pubkey(point):
|
||||
order = SECP256k1.order
|
||||
@ -58,10 +55,6 @@ def sec_to_public_pair(pubkey):
|
||||
)
|
||||
|
||||
|
||||
def is_prime(n):
|
||||
return bool(n & tools.HARDENED_FLAG)
|
||||
|
||||
|
||||
def fingerprint(pubkey):
|
||||
return string_to_number(tools.hash_160(pubkey)[:4])
|
||||
|
||||
@ -86,7 +79,7 @@ def get_subnode(node, i):
|
||||
# Public Child key derivation (CKD) algorithm of BIP32
|
||||
i_as_bytes = struct.pack(">L", i)
|
||||
|
||||
if is_prime(i):
|
||||
if i & tools.HARDENED_FLAG:
|
||||
raise ValueError("Prime derivation not supported")
|
||||
|
||||
# Public derivation
|
@ -16,9 +16,10 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import btc, ckd_public as bip32, messages as proto
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import H_, CallException, parse_path
|
||||
|
||||
from .. import bip32
|
||||
from ..common import MNEMONIC12
|
||||
|
||||
|
||||
|
@ -16,8 +16,9 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import btc, ckd_public as bip32, messages, tools
|
||||
from trezorlib import btc, messages, tools
|
||||
|
||||
from .. import bip32
|
||||
from ..common import MNEMONIC12
|
||||
|
||||
|
||||
|
@ -16,9 +16,10 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import btc, ckd_public as bip32, messages as proto
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import H_
|
||||
|
||||
from .. import bip32
|
||||
from ..common import MNEMONIC12
|
||||
|
||||
|
||||
|
@ -17,9 +17,9 @@
|
||||
import pytest
|
||||
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.ckd_public import deserialize
|
||||
from trezorlib.tools import H_, parse_path
|
||||
|
||||
from ..bip32 import deserialize
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TX_API = TxCache("Testnet")
|
||||
|
@ -16,9 +16,10 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import btc, ckd_public as bip32, messages as proto
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import CallException, parse_path
|
||||
|
||||
from .. import bip32
|
||||
from ..common import MNEMONIC12
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
|
@ -16,9 +16,10 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import btc, ckd_public as bip32, messages as proto
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import H_, parse_path
|
||||
|
||||
from .. import bip32
|
||||
from ..common import MNEMONIC12
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user