mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-21 20:12:02 +00:00
core/slip39: fix UI for 33 words (#408)
core/slip39: fix UI for 33 words
This commit is contained in:
commit
e62553435d
@ -409,8 +409,17 @@ async def _slip39_show_share_words(ctx, share_index, share_words):
|
|||||||
def _slip39_split_share_into_pages(share_words):
|
def _slip39_split_share_into_pages(share_words):
|
||||||
share = list(enumerate(share_words)) # we need to keep track of the word indices
|
share = list(enumerate(share_words)) # we need to keep track of the word indices
|
||||||
first = share[:2] # two words on the first page
|
first = share[:2] # two words on the first page
|
||||||
middle = share[2:-2]
|
length = len(share_words)
|
||||||
last = share[-2:] # two words on the last page
|
if length == 20:
|
||||||
|
middle = share[2:-2]
|
||||||
|
last = share[-2:] # two words on the last page
|
||||||
|
elif length == 33:
|
||||||
|
middle = share[2:]
|
||||||
|
last = [] # no words at the last page, because it does not add up
|
||||||
|
else:
|
||||||
|
# Invalid number of shares. SLIP-39 allows 20 or 33 words.
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
chunks = utils.chunks(middle, 4) # 4 words on the middle pages
|
chunks = utils.chunks(middle, 4) # 4 words on the middle pages
|
||||||
return first, list(chunks), last
|
return first, list(chunks), last
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user