Exemple #1
0
 def generate_webhook_signature(
     self, payload: str, secret: str, timestamp: timezone.datetime = None,
 ) -> str:
     timestamp = timezone.now() if not timestamp else timestamp
     computed_timestamp: int = int(timestamp.timestamp())
     signature: str = compute_webhook_signature(
         "%d.%s" % (computed_timestamp, payload), secret,
     )
     return f"t={computed_timestamp},v1={signature}"
Exemple #2
0
 def datetime_to_timestamp(datetime: timezone.datetime) -> float:
     """Convert datetime to timestamp"""
     return datetime.timestamp()