Пример #1
0
 def validate_access_credentials(self, proposed_secret_key):
     """ Returns True/False if the provided secret key is correct for this user."""
     return compare_password(
         proposed_secret_key,
         self.access_key_secret_salt,
         self.access_key_secret
     )
Пример #2
0
 def debug_validate_password(self, compare_me):
     """
     Checks if the input matches the instance's password hash, but does
     the hashing for you for use on the command line. This is necessary
     for manually checking that setting and validating passwords work.
     """
     compare_me = device_hash(compare_me)
     return compare_password(compare_me, self.salt, self.password)
Пример #3
0
 def proposed_secret_key_is_valid(self, proposed_secret_key) -> bool:
     """
     Checks if the proposed secret key is valid for this ApiKey.
     """
     return compare_password(
         proposed_secret_key.encode(),
         self.access_key_secret_salt.encode(),
         self.access_key_secret.encode(),
     )
Пример #4
0
 def validate_password(self, compare_me):
     """
     Checks if the input matches the instance's password hash.
     """
     return compare_password(compare_me, self.salt, self.password)
Пример #5
0
 def debug_validate_password(self, compare_me):
     """ Checks if the input matches the instance's password hash, but does
     the hashing for you for use on the command line."""
     compare_me = device_hash(compare_me)
     return compare_password(compare_me, self['salt'], self['password'])