model/identity.py
def is_valid(self) -> bool:
        """Verfies if ID is valid or not"""

        if len(self.__username) > USERNAME_LIMIT:
            return False

        if self.__nonce > NONCE_LIMIT:
            return False

        content = {
            "username": self.__username,
            "public_key": self.__public_key,
            "nonce": self.__nonce,
            "timestamp": self.__timestamp,
        }

        if len(self.__hash_value) < 6:
            return False

        if self.__hash_value[:HASH_DIFFICULTY] != "0" * HASH_DIFFICULTY:
            return False

        if verify_hash(content, self.__hash_value) is False:
            return False

        return True
Verfies if ID is valid or not
Verfies if ID is valid or not
Verfies if ID is valid or not
def is_valid(self) -> bool:
        if len(self.__username) > USERNAME_LIMIT:
            return False
        if self.__nonce > NONCE_LIMIT:
            return False
        content = {
            "username": self.__username,
            "public_key": self.__public_key,
            "nonce": self.__nonce,
            "timestamp": self.__timestamp,
        }
        if len(self.__hash_value) < 6:
            return False
        if self.__hash_value[:HASH_DIFFICULTY] != "0" * HASH_DIFFICULTY:
            return False
        if verify_hash(content, self.__hash_value) is False:
            return False
        return True
def is_valid ( self ) -> bool : if len ( self . __username ) > USERNAME_LIMIT : return False if self . __nonce > NONCE_LIMIT : return False content = { "username" : self . __username , "public_key" : self . __public_key , "nonce" : self . __nonce , "timestamp" : self . __timestamp , } if len ( self . __hash_value ) < 6 : return False if self . __hash_value [ : HASH_DIFFICULTY ] != "0" * HASH_DIFFICULTY : return False if verify_hash ( content , self . __hash_value ) is False : return False return True
Verfies if ID is valid or not
Verfies if ID is valid or not
"""Verfies if ID is valid or not"""
self