mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-23 09:29:14 -04:00
This changeset copies everything in notifications_utils to turn into a local project module. It includes dependency changes to account for this adjustment and the notifications_utils tests. It also fixes all of the import statements. Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
14 lines
429 B
Python
14 lines
429 B
Python
from itsdangerous import URLSafeTimedSerializer
|
|
|
|
from notifications_utils.formatters import url_encode_full_stops
|
|
|
|
|
|
def generate_token(payload, secret, salt):
|
|
return url_encode_full_stops(URLSafeTimedSerializer(secret).dumps(payload, salt))
|
|
|
|
|
|
def check_token(token, secret, salt, max_age_seconds):
|
|
ser = URLSafeTimedSerializer(secret)
|
|
payload = ser.loads(token, max_age=max_age_seconds, salt=salt)
|
|
return payload
|