I am calling bcrypt.checkpw
to check unencrypted password matches with hashed password stored in the credential database, but receive
TypeEr
i use something like that
class User(Base):
__tablename__ = "user"
id = Column(BigInteger, primary_key=True, autoincrement=True)
login = Column(String, nullable=False, unique=True)
password = Column(String, nullable=False)
@staticmethod
def make_password_hash(password):
hash = bcrypt.hashpw(password=password.encode('utf-8'), salt=bcrypt.gensalt())
return hash.decode('utf-8')
def is_password_valid(self, password):
return bcrypt.checkpw(password.encode('utf-8'), self.password.encode('utf-8'))