コード例 #1
0
ファイル: slip39.py プロジェクト: particl/trezor-firmware
def generate_from_secret(master_secret: bytes, count: int,
                         threshold: int) -> list:
    """
    Generates new Shamir backup for 'master_secret'. Multiple groups are not yet supported.
    """
    return slip39.generate_single_group_mnemonics_from_data(
        master_secret, storage.get_slip39_identifier(), threshold, count)
コード例 #2
0
def generate_from_secret(master_secret: bytes, count: int,
                         threshold: int) -> str:
    """
    Generates new Shamir backup for 'master_secret'. Multiple groups are not yet supported.
    """
    identifier, group_mnemonics = slip39.generate_single_group_mnemonics_from_data(
        master_secret, threshold, count)
    storage.set_slip39_iteration_exponent(slip39.DEFAULT_ITERATION_EXPONENT)
    storage.set_slip39_identifier(identifier)
    return group_mnemonics
コード例 #3
0
async def backup_slip39_wallet(ctx: wire.Context, secret: bytes) -> None:
    # get number of shares
    await layout.slip39_show_checklist_set_shares(ctx)
    shares_count = await layout.slip39_prompt_number_of_shares(ctx)

    # get threshold
    await layout.slip39_show_checklist_set_threshold(ctx, shares_count)
    threshold = await layout.slip39_prompt_threshold(ctx, shares_count)

    # generate the mnemonics
    mnemonics = slip39.generate_single_group_mnemonics_from_data(
        secret, storage.device.get_slip39_identifier(), threshold,
        shares_count)

    # show and confirm individual shares
    await layout.slip39_show_checklist_show_shares(ctx, shares_count,
                                                   threshold)
    await layout.slip39_show_and_confirm_shares(ctx, mnemonics)