Spaces:
Running
on
Zero
Running
on
Zero
we
Browse files- mysite/asgi.py +3 -1
mysite/asgi.py
CHANGED
@@ -629,7 +629,9 @@ CHANNEL_SECRET = os.getenv('CHANNEL_SECRET')
|
|
629 |
CHANNEL_ACCESS_TOKEN = os.getenv('CHANNEL_ACCESS_TOKEN')
|
630 |
WEBHOOK_URL = os.getenv('WEBHOOK_URL')
|
631 |
import requests
|
632 |
-
|
|
|
|
|
633 |
def validate_signature(body: str, signature: str, secret: str) -> bool:
|
634 |
hash = hmac.new(secret.encode('utf-8'), body.encode('utf-8'), hashlib.sha256).digest()
|
635 |
expected_signature = base64.b64encode(hash).decode('utf-8')
|
|
|
629 |
CHANNEL_ACCESS_TOKEN = os.getenv('CHANNEL_ACCESS_TOKEN')
|
630 |
WEBHOOK_URL = os.getenv('WEBHOOK_URL')
|
631 |
import requests
|
632 |
+
import hmac
|
633 |
+
import hashlib
|
634 |
+
import base64
|
635 |
def validate_signature(body: str, signature: str, secret: str) -> bool:
|
636 |
hash = hmac.new(secret.encode('utf-8'), body.encode('utf-8'), hashlib.sha256).digest()
|
637 |
expected_signature = base64.b64encode(hash).decode('utf-8')
|