示例#1
0
 async def show_mnemonic(self):
     if await self.show(
             Prompt(
                 "Warning", "You need to confirm your PIN code "
                 "to display your recovery phrase.\n\n"
                 "Continue?")):
         self.lock()
         await self.unlock()
         await self.show(MnemonicScreen(self.mnemonic))
示例#2
0
    async def storage_menu(self):
        """Manage storage and display of the recovery phrase"""
        enabled = self.connection.isCardInserted()
        buttons = [
            # id, text
            (None, "Smartcard storage"),
            (0, "Save key to the card", enabled),
            (1, "Load key from the card", enabled),
            (2, "Delete key from the card", enabled),
            (3, "Show recovery phrase"),
        ]

        # we stay in this menu until back is pressed
        while True:
            # wait for menu selection
            menuitem = await self.show(Menu(buttons, last=(255, None)))
            # process the menu button:
            # back button
            if menuitem == 255:
                return
            elif menuitem == 0:
                await self.save_mnemonic()
                await self.show(
                    Alert(
                        "Success!",
                        "Your key is stored on the smartcard now.",
                        button_text="OK",
                    ))
            elif menuitem == 1:
                await self.load_mnemonic()
                await self.show(
                    Alert("Success!", "Your key is loaded.", button_text="OK"))
            elif menuitem == 2:
                await self.delete_mnemonic()
                await self.show(
                    Alert(
                        "Success!",
                        "Your key is deleted from the smartcard.",
                        button_text="OK",
                    ))
            elif menuitem == 3:
                await self.show(MnemonicScreen(self.mnemonic))
示例#3
0
    async def storage_menu(self):
        """Manage storage and display of the recovery phrase"""
        buttons = [
            # id, text
            (None, "Manage keys on SD card and internal flash"),
            (0, "Save key"),
            (1, "Load key"),
            (2, "Delete key"),
            (None, "Other"),
            (3, "Show recovery phrase"),
        ]

        # we stay in this menu until back is pressed
        while True:
            # wait for menu selection
            menuitem = await self.show(Menu(buttons, last=(255, None)))
            # process the menu button:
            # back button
            if menuitem == 255:
                return
            elif menuitem == 0:
                if await self.save_mnemonic():
                    await self.show(
                        Alert("Success!",
                              "Your key is stored now.",
                              button_text="OK"))
            elif menuitem == 1:
                if await self.load_mnemonic():
                    await self.show(
                        Alert("Success!",
                              "Your key is loaded.",
                              button_text="OK"))
            elif menuitem == 2:
                if await self.delete_mnemonic():
                    await self.show(
                        Alert("Success!",
                              "Your key is deleted.",
                              button_text="OK"))
            elif menuitem == 3:
                await self.show(MnemonicScreen(self.mnemonic))
示例#4
0
 async def storage_menu(self):
     """Manage storage and display of the recovery phrase"""
     # This class can only show mnemonic, can't save
     await self.show(MnemonicScreen(self.mnemonic))
     """