Skip to content

Commit 4b1ea7f

Browse files
Support Ledger clear signing (#1603)
1 parent 9264491 commit 4b1ea7f

File tree

16 files changed

+759
-579
lines changed

16 files changed

+759
-579
lines changed

.github/workflows/checks.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Checks
22

33
env:
44
CAIRO_LANG_VERSION: "0.13.1"
5-
DEVNET_SHA: fc5a2753a2eedcc27eed7a4fae3ecac08c2ca1b4
6-
LEDGER_APP_SHA: db93a5e33d00bd44752fdc8c07aefcffa08d91c3
7-
LEDGER_APP_DEV_TOOLS_SHA: a037d42181f4bed9694246256e2c9e2a899e775c302a9c6482c81f87c28e1432
5+
DEVNET_SHA: 26292d1f92807090776b470f43b321f150f55ffd # v0.4.1
6+
LEDGER_APP_SHA: 768a7b47b0da681b28112342edd76e2c9b292c4e # v2.3.1
7+
LEDGER_APP_DEV_TOOLS_SHA: a845b2ab0b5dd824133f73858f6f373edea85ec1bd828245bf50ce9700f33bcb # v4.5.0
88

99
on:
1010
push:
@@ -200,6 +200,7 @@ jobs:
200200
run: |
201201
cd /apps/app-starknet
202202
git checkout ${{ env.LEDGER_APP_SHA }}
203+
cd starknet
203204
cargo clean
204205
cargo ledger build nanox
205206
@@ -219,6 +220,9 @@ jobs:
219220
- name: Wait for Speculos to start
220221
run: sleep 5
221222

223+
- name: Allow blind signing
224+
run: ./starknet_py/tests/unit/signer/allow_ledger_blind_signing.sh
225+
222226
- name: Update automation rules
223227
working-directory: starknet_py/tests/unit/signer
224228
run: |

docs/api/signer.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,11 @@ To use LedgerSigner, you need to install starknetpy with `ledger` extra like thi
4747
.. autoclass:: LedgerSigner
4848
:members:
4949
:member-order: groupwise
50+
51+
-----------------
52+
LedgerSigningMode
53+
-----------------
54+
55+
.. autoclass:: LedgerSigningMode
56+
:members:
57+
:member-order: groupwise

docs/guide/signing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ signing algorithm, it is possible to create ``Account`` with custom
1515
Signing with Ledger
1616
-------------------
1717
:ref:`LedgerSigner` allows you to sign transactions using a Ledger device. The device must be unlocked and Starknet app needs to be open.
18-
Currently used version of Starknet app is ``1.1.1`` and only blind-signing is possible. Clear-signing will be available in the near future.
18+
Currently used version of `Starknet app <https://github.com/LedgerHQ/app-starknet>`_ is ``2.3.1``.
1919

2020
.. codesnippet:: ../../starknet_py/tests/unit/signer/test_ledger_signer.py
2121
:language: python

docs/migration_guide.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ Migration guide
22
===============
33

44
**********************
5-
0.26.3 Migration guide
5+
0.27.0 Migration guide
66
**********************
77

8-
0.26.3 Bugfixes
8+
.. py:currentmodule:: starknet_py.net.signer.ledger_signer
9+
10+
1. Support for clear signing with :class:`LedgerSigner` has been added. It's now the default signing mode (see :class:`LedgerSigningMode`).
11+
2. ``derivation_path_str`` param has been removed from :class:`LedgerSigner` constructor, while ``account_id``, ``application_name`` and ``signing_mode`` params have been added.
12+
13+
0.27.0 Bugfixes
914
---------------
1015

1116
1. ABI parser supports now fixed size arrays.

poetry.lock

Lines changed: 65 additions & 429 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ docs = [
3232
]
3333
ledger = [
3434
"ledgerwallet>=0.5.0,<1.0.0",
35-
"bip-utils>=2.9.3,<3.0.0",
3635
]
3736

3837
[project.urls]

starknet_py/constants.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@
3939

4040
ROOT_PATH = Path(__file__).parent
4141

42-
# Ledger constants
43-
STARKNET_CLA = 0x5A
44-
EIP_2645_PURPOSE = 0x80000A55
45-
EIP_2645_PATH_LENGTH = 6
46-
PUBLIC_KEY_RESPONSE_LENGTH = 65
47-
SIGNATURE_RESPONSE_LENGTH = 65
48-
VERSION_RESPONSE_LENGTH = 3
49-
5042
# Result of `encode_shortstring("ANY_CALLER")`
5143
ANY_CALLER = 0x414E595F43414C4C4552
5244

@@ -58,3 +50,7 @@ class OutsideExecutionInterfaceID(IntEnum):
5850

5951

6052
EXPECTED_RPC_VERSION = "0.8.1"
53+
54+
ARGENT_V040_CLASS_HASH = (
55+
0x036078334509B514626504EDC9FB252328D1A240E4E948BEF8D0C08DFF45927F
56+
)

0 commit comments

Comments
 (0)