1
0

trezor: allow PIN of length 50 for T1 firmware >=1.10.0 and TT firmware >=2.4.0 (closes #8526)

This commit is contained in:
Sander van Grieken
2023-07-07 12:33:55 +02:00
parent c4e8869c1a
commit be0ef5f961

View File

@@ -287,8 +287,15 @@ class TrezorClientBase(HardwareClientBase, Logger):
pin = self.handler.get_pin(msg.format(self.device), show_strength=show_strength)
if not pin:
raise Cancelled
if len(pin) > 9:
self.handler.show_error(_('The PIN cannot be longer than 9 characters.'))
# check PIN length. Depends on model and firmware version
# https://github.com/trezor/trezor-firmware/issues/1167
limit = 9
if self.features.model == "1" and (1, 10, 0) <= self.client.version:
limit = 50
elif self.features.model == "2" and (2, 4, 0) <= self.client.version:
limit = 50
if len(pin) > limit:
self.handler.show_error(_('The PIN cannot be longer than {} characters.').format(limit))
raise Cancelled
return pin