Exemplo n.º 1
0
 async def lock(self):
     # lock the keystore
     self.keystore.lock()
     # disable hosts
     for host in self.hosts:
         await host.disable()
     # disable usb and dev
     set_usb_mode(False, False)
Exemplo n.º 2
0
 def update_config(self, usb=False, dev=False, **kwargs):
     config = {"usb": usb, "dev": dev}
     self.keystore.save_aead(
         self.path + "/settings",
         adata=json.dumps(config).encode(),
         key=self.keystore.enc_secret,
     )
     self.usb = usb
     self.dev = dev
     set_usb_mode(usb=self.usb, dev=self.dev)
Exemplo n.º 3
0
 async def unlock(self):
     """
     - setup PIN if not set
     - enter PIN if set
     """
     await self.keystore.unlock()
     # now keystore is unlocked - we can proceed
     # load configuration
     self.load_config()
     set_usb_mode(usb=self.usb, dev=self.dev)
Exemplo n.º 4
0
    async def unlock(self):
        """
        - setup PIN if not set
        - enter PIN if set
        """
        # get_auth_word function can generate words from part of the PIN
        get_auth_word = self.keystore.get_auth_word
        # pin is not set - choose one
        if not self.keystore.is_pin_set:
            pin = await self.gui.setup_pin(get_word=get_auth_word)
            self.keystore.set_pin(pin)

        # if keystore is locked - ask for PIN code
        while self.keystore.is_locked:
            pin = await self.gui.get_pin(get_word=get_auth_word)
            self.keystore.unlock(pin)

        # now keystore is unlocked - we can proceed
        # load configuration
        self.load_config()
        set_usb_mode(usb=self.usb, dev=self.dev)