Esempio n. 1
0
    def get_passphrase(self, available_on_device):
        if self.creating_wallet:
            if isinstance(self.handler, CustomerUI):
                msg = "6"
            else:
                msg = _(
                    "Enter a passphrase to generate this wallet.  Each time "
                    "you use this wallet your {} will prompt you for the "
                    "passphrase.  If you forget the passphrase you cannot "
                    "access the bitcoins in the wallet.").format(self.device)
        else:
            if isinstance(self.handler, CustomerUI):
                msg = "3"
            else:
                msg = _("Enter the passphrase to unlock this wallet:")

        self.handler.passphrase_on_device = available_on_device
        passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
        if passphrase is PASSPHRASE_ON_DEVICE:
            return passphrase
        if passphrase is None:
            raise Cancelled
        passphrase = bip39_normalize_passphrase(passphrase)
        length = len(passphrase)
        if length > 50:
            self.handler.show_error(
                _("Too long passphrase ({} > 50 chars).").format(length))
            raise Cancelled
        return passphrase
Esempio n. 2
0
    def callback_PassphraseRequest(self, req):
        if req and hasattr(req, 'on_device') and req.on_device is True:
            return self.proto.PassphraseAck()

        if self.creating_wallet:
            msg = _(
                "Enter a passphrase to generate this wallet.  Each time "
                "you use this wallet your {device} will prompt you for the "
                "passphrase.  If you forget the passphrase you cannot "
                "access the {name_lower}s in the wallet.").format(
                    device=self.device, name_lower=constants.net.NAME_LOWER)
        else:
            msg = _("Enter the passphrase to unlock this wallet:")
        passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
        if passphrase is None:
            return self.proto.Cancel()
        passphrase = bip39_normalize_passphrase(passphrase)

        ack = self.proto.PassphraseAck(passphrase=passphrase)
        length = len(ack.passphrase)
        if length > 50:
            self.handler.show_error(
                _("Too long passphrase ({} > 50 chars).").format(length))
            return self.proto.Cancel()
        return ack
Esempio n. 3
0
 def callback_PassphraseRequest(self, req):
     if self.creating_wallet:
         msg = _("Enter a passphrase to generate this wallet.  Each time "
                 "you use this wallet your %s will prompt you for the "
                 "passphrase.  If you forget the passphrase you cannot "
                 "access the bitcoins in the wallet.") % self.device
     else:
         msg = _("Enter the passphrase to unlock this wallet:")
     passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
     if passphrase is None:
         return self.proto.Cancel()
     passphrase = bip39_normalize_passphrase(passphrase)
     return self.proto.PassphraseAck(passphrase=passphrase)
Esempio n. 4
0
 def callback_PassphraseRequest(self, req):
     if self.creating_wallet:
         msg = _("Enter a passphrase to generate this wallet.  Each time "
                 "you use this wallet your %s will prompt you for the "
                 "passphrase.  If you forget the passphrase you cannot "
                 "access the bitcoins in the wallet.") % self.device
     else:
         msg = _("Enter the passphrase to unlock this wallet:")
     passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
     if passphrase is None:
         return self.proto.Cancel()
     passphrase = bip39_normalize_passphrase(passphrase)
     return self.proto.PassphraseAck(passphrase=passphrase)
Esempio n. 5
0
    def callback_PassphraseRequest(self, req):
        if req and hasattr(req, 'on_device') and req.on_device is True:
            return self.proto.PassphraseAck()

        if self.creating_wallet:
            msg = _("Enter a passphrase to generate this wallet.  Each time "
                    "you use this wallet your {} will prompt you for the "
                    "passphrase.  If you forget the passphrase you cannot "
                    "access the BitcoinInterest in the wallet.").format(self.device)
        else:
            msg = _("Enter the passphrase to unlock this wallet:")
        passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
        if passphrase is None:
            return self.proto.Cancel()
        passphrase = bip39_normalize_passphrase(passphrase)
        return self.proto.PassphraseAck(passphrase=passphrase)
Esempio n. 6
0
 def get_passphrase(self):
     if self.creating_wallet:
         msg = _("Enter a passphrase to generate this wallet.  Each time "
                 "you use this wallet your {} will prompt you for the "
                 "passphrase.  If you forget the passphrase you cannot "
                 "access the namecoins in the wallet.").format(self.device)
     else:
         msg = _("Enter the passphrase to unlock this wallet:")
     passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
     if passphrase is None:
         raise Cancelled
     passphrase = bip39_normalize_passphrase(passphrase)
     length = len(passphrase)
     if length > 50:
         self.handler.show_error(_("Too long passphrase ({} > 50 chars).").format(length))
         raise Cancelled
     return passphrase
Esempio n. 7
0
 def get_passphrase(self):
     if self.creating_wallet:
         msg = _("Enter a passphrase to generate this wallet.  Each time "
                 "you use this wallet your {} will prompt you for the "
                 "passphrase.  If you forget the passphrase you cannot "
                 "access the bitcoins in the wallet.").format(self.device)
     else:
         msg = _("Enter the passphrase to unlock this wallet:")
     passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
     if passphrase is None:
         raise Cancelled
     passphrase = bip39_normalize_passphrase(passphrase)
     length = len(passphrase)
     if length > 50:
         self.handler.show_error(_("Too long passphrase ({} > 50 chars).").format(length))
         raise Cancelled
     return passphrase
Esempio n. 8
0
    def callback_PassphraseRequest(self, req):
        if self.creating_wallet:
            msg = _("Enter a passphrase to generate this wallet.  Each time "
                    "you use this wallet your {} will prompt you for the "
                    "passphrase.  If you forget the passphrase you cannot "
                    "access the bitcores in the wallet.").format(self.device)
        else:
            msg = _("Enter the passphrase to unlock this wallet:")
        passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
        if passphrase is None:
            return self.proto.Cancel()
        passphrase = bip39_normalize_passphrase(passphrase)

        ack = self.proto.PassphraseAck(passphrase=passphrase)
        length = len(ack.passphrase)
        if length > 50:
            self.handler.show_error(_("Too long passphrase ({} > 50 chars).").format(length))
            return self.proto.Cancel()
        return ack
Esempio n. 9
0
    def callback_PassphraseRequest(self, req):
        if self.creating_wallet:
            msg = _("Enter a passphrase to generate this wallet.  Each time "
                    "you use this wallet your {} will prompt you for the "
                    "passphrase.  If you forget the passphrase you cannot "
                    "access the bitcoins in the wallet.").format(self.device)
        else:
            msg = _("Enter the passphrase to unlock this wallet:")
        passphrase = self.handler.get_passphrase(msg, self.creating_wallet)
        if passphrase is None:
            return self.proto.Cancel()
        passphrase = bip39_normalize_passphrase(passphrase)

        ack = self.proto.PassphraseAck(passphrase=passphrase)
        length = len(ack.passphrase)
        if length > 50:
            self.handler.show_error(_("Too long passphrase ({} > 50 chars).").format(length))
            return self.proto.Cancel()
        return ack