mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 12:28:09 +00:00
passphrase: use same max length as T1
This commit is contained in:
parent
8120ee91f6
commit
98dab122f9
@ -1,3 +1,5 @@
|
|||||||
|
from micropython import const
|
||||||
|
|
||||||
from trezor import ui, wire
|
from trezor import ui, wire
|
||||||
from trezor.messages import ButtonRequestType, MessageType, PassphraseSourceType
|
from trezor.messages import ButtonRequestType, MessageType, PassphraseSourceType
|
||||||
from trezor.messages.ButtonRequest import ButtonRequest
|
from trezor.messages.ButtonRequest import ButtonRequest
|
||||||
@ -10,6 +12,8 @@ from trezor.ui.text import Text
|
|||||||
from apps.common import storage
|
from apps.common import storage
|
||||||
from apps.common.cache import get_state
|
from apps.common.cache import get_state
|
||||||
|
|
||||||
|
_MAX_PASSPHRASE_LEN = const(50)
|
||||||
|
|
||||||
|
|
||||||
@ui.layout
|
@ui.layout
|
||||||
async def request_passphrase_entry(ctx):
|
async def request_passphrase_entry(ctx):
|
||||||
@ -67,6 +71,8 @@ async def request_passphrase(ctx):
|
|||||||
else:
|
else:
|
||||||
on_device = storage.get_passphrase_source() == PassphraseSourceType.DEVICE
|
on_device = storage.get_passphrase_source() == PassphraseSourceType.DEVICE
|
||||||
passphrase = await request_passphrase_ack(ctx, on_device)
|
passphrase = await request_passphrase_ack(ctx, on_device)
|
||||||
|
if len(passphrase) > _MAX_PASSPHRASE_LEN:
|
||||||
|
raise wire.DataError("Maximum passphrase length is %d" % _MAX_PASSPHRASE_LEN)
|
||||||
return passphrase
|
return passphrase
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user