def __validate_signature(self, signature, payload): signature_pairs = [pair.split("|") for pair in signature.split("&") if "|" in pair] matching_signature = self.__matching_signature(signature_pairs) payload_signature = Crypto.hmac_hash(self.config.private_key, payload) if not Crypto.secure_compare(payload_signature, matching_signature): raise InvalidSignatureError
def __validate_signature(self, signature, payload): signature_pairs = [ pair.split("|") for pair in signature.split("&") if "|" in pair ] matching_signature = self.__matching_signature(signature_pairs) payload_signature = Crypto.hmac_hash(self.config.private_key, payload) if not Crypto.secure_compare(payload_signature, matching_signature): raise InvalidSignatureError
def __payload_matches(self, signature, payload): payload_signature = Crypto.sha1_hmac_hash(self.config.private_key, payload) return Crypto.secure_compare(payload_signature, signature)