def authenticate_complete(self, username, resp):
        memkey = resp.clientData.challenge
        challenges = self._memstore.retrieve(self._client.id, username, memkey)
        user = self._get_user(username)
        for handle, data in challenges.items():
            if data['keyHandle'] == resp.keyHandle:
                dev = user.devices[handle]
                if dev.compromised:
                    raise BadInputException('Device is compromised')

                counter, presence = verify_authenticate(
                    dev.bind_data,
                    data['challenge'],
                    resp,
                    self._client.valid_facets
                )
                if presence == chr(0):
                    raise Exception('User presence byte not set!')
                if (dev.counter or -1) > counter:
                    dev.counter = counter
                    dev.authenticated_at = datetime.now()
                    return handle
                dev.compromised = True
                raise DeviceCompromisedException('Device counter mismatch',
                                                 dev.get_descriptor())
        else:
            raise BadInputException('No device found for keyHandle: %s' %
                                    resp.keyHandle)
dataset/ETHPy150Open Yubico/u2fval/u2fval/core/controller.py/U2FController.authenticate_complete/swapped operands of `>`