diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ca6258..9c1c8ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.5] - 2025-11-26 + +### Fixed + +- Correctly encode empty bip32 paths instead of skipping them. + ## [0.5.4] - 2025-11-25 ### Added -- Support for `path_slip21` in the manifest. +- Support for `paths_slip21` in the manifest. ## [0.5.3] - 2025-08-27 diff --git a/ledgerwallet/params.py b/ledgerwallet/params.py index 6c89ae2..2cdd038 100644 --- a/ledgerwallet/params.py +++ b/ledgerwallet/params.py @@ -141,6 +141,9 @@ def _decode(self, obj, context, path): return "/".join(out) def _encode(self, obj, context, path): + if obj == "": + # empty path + return list() out = list() elements = obj.split("/") if elements[0] == "m": @@ -244,7 +247,7 @@ def main(): ] ) - params2 = ( + params1_expected = ( b"\x01\x0D\x53\x53\x48\x2F\x50\x47\x50\x20\x41\x67\x65\x6E\x74" b"\x02\x05\x30\x2E\x30\x2E\x34\x03\x29\x01\x00\x00\x00\x00\xFF" b"\xFF\xFF\x00\x00\x18\xFC\x24\x02\x24\x0A\x24\x1A\x7E\x32\x66" @@ -253,7 +256,38 @@ def main(): b"\x2B\x34\x01\x80\x00\x00\x0D\x01\x80\x00\x00\x11\x87\x00\x4D" b"\x59\x50\x41\x54\x48" ) - assert params1 == params2 + assert params1 == params1_expected + + params2 = AppParams.build( + [ + {"type_": "BOLOS_TAG_APPNAME", "value": "Vanadium"}, + {"type_": "BOLOS_TAG_APPVERSION", "value": "0.0.1"}, + { + "type_": "BOLOS_TAG_ICON", + "value": ( + b"\x01\x00\x00\x00\x00\xFF\xFF\xFF\x00\x00\x18\xFC\x24\x02" + b"\x24\x0A\x24\x1A\x7E\x32\x66\x62\x6E\x62\x7E\x32\x00\x1A" + b"\x40\x0A\x5F\x02\x5F\x02\x40\x02\x40\xFE\x7F\x00\x00" + ), + }, + { + "type_": "BOLOS_TAG_DERIVEPATH", + "value": { + "curve": Curve.secp256k1 | Curve.slip21, + "paths": [""], + "paths_slip21": ["VANADIUM"], + }, + }, + ] + ) + params2_expected = ( + b"\x01\x08\x56\x61\x6E\x61\x64\x69\x75\x6D\x02\x05\x30\x2E\x30" + b"\x2E\x31\x03\x29\x01\x00\x00\x00\x00\xFF\xFF\xFF\x00\x00\x18" + b"\xFC\x24\x02\x24\x0A\x24\x1A\x7E\x32\x66\x62\x6E\x62\x7E\x32" + b"\x00\x1A\x40\x0A\x5F\x02\x5F\x02\x40\x02\x40\xFE\x7F\x00\x00" + b"\x04\x0C\x09\x00\x89\x00\x56\x41\x4E\x41\x44\x49\x55\x4D" + ) + assert params2 == params2_expected if __name__ == "__main__":