trezor / python-shamir-mnemonic

MIT License
168 stars 60 forks source link

Q: About `extendable` validation #50

Closed lontivero closed 3 months ago

lontivero commented 3 months ago

During recovery, it is okay to assume all shares have the same value for extendable or should the code to verify that?

andrewkozlik commented 3 months ago

All shares must have the same value of the extendable flag and the code should verify that to be compliant with the specification and the reference implementation.

The SLIP 39 specification states in section Combining the shares

  1. Check the following conditions: ...
    • All shares MUST have the same identifier id, extendable backup flag ext, iteration exponent e, group threshold GT, group count G and length.

Indeed this reference implementation checks that in add_share(): https://github.com/trezor/python-shamir-mnemonic/blob/17fcce14736afe498871d3018e4fa9330443471a/shamir_mnemonic/recovery.py#L73-L76 where matches() checks that the common parameters are identical with the current set that is being recovered, including the extendable backup flag: https://github.com/trezor/python-shamir-mnemonic/blob/17fcce14736afe498871d3018e4fa9330443471a/shamir_mnemonic/share.py#L41-L48

lontivero commented 3 months ago

Thank you, I didn't see it.

El mar, 13 de ago de 2024, 03:55, Andrew Kozlik @.***> escribió:

Closed #50 https://github.com/trezor/python-shamir-mnemonic/issues/50 as completed.

— Reply to this email directly, view it on GitHub https://github.com/trezor/python-shamir-mnemonic/issues/50#event-13858554873, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA7HZLKSOKAIRNOA5VOLPLZRGUV3AVCNFSM6AAAAABMNLZ2BWVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTHA2TQNJVGQ4DOMY . You are receiving this because you authored the thread.Message ID: @.*** com>