Weglot for Datasnipper - updated templates. Approved to move Walmart screenshots scripts to a cloud host. Need to re-write it in playwright

This commit is contained in:
Norm Rasmussen
2024-03-27 22:17:31 -04:00
parent 30f5cfd5e4
commit ee29257e17
7 changed files with 46 additions and 22 deletions

View File

@ -0,0 +1,23 @@
import base64
import hashlib
import hmac
import json
import logging
from typing import Any
def verify_northpass_authorization(auth_token: str, request_data: dict) -> bool:
"""
Verifies that the authorization token is valid.
Args:
auth_token: The authorization token provided from Northpass
request_data: The data provided by Northpass
Returns: True if the authorization token is valid or False if not
"""
asm_northpass_secret = "EXAMPLE-SECRET".encode("utf-8")
encoded_body = json.dumps(request_data.__dict__, separators=(",", ":")).encode("utf-8")
asm_hash = hmac.new(key=asm_northpass_secret, msg=encoded_body, digestmod=hashlib.sha256).digest()
return auth_token == base64.b64encode(asm_hash).decode("utf-8")