Fix of hexdigest
This commit is contained in:
@@ -142,7 +142,7 @@ def save_push_subscription(username, subscription_obj):
|
|||||||
# Create unique hash of subscription using plaintext data to avoid duplicates
|
# Create unique hash of subscription using plaintext data to avoid duplicates
|
||||||
sub_hash = hashlib.shake_256(
|
sub_hash = hashlib.shake_256(
|
||||||
f"{username}:{endpoint}".encode('utf-8')
|
f"{username}:{endpoint}".encode('utf-8')
|
||||||
).hexdigest()
|
).hexdigest(32)
|
||||||
|
|
||||||
# Check if subscription already exists by Hash
|
# Check if subscription already exists by Hash
|
||||||
existing = subs_col.find_one({
|
existing = subs_col.find_one({
|
||||||
@@ -197,7 +197,7 @@ def remove_push_subscription(username, endpoint):
|
|||||||
|
|
||||||
sub_hash = hashlib.shake_256(
|
sub_hash = hashlib.shake_256(
|
||||||
f"{username}:{endpoint}".encode('utf-8')
|
f"{username}:{endpoint}".encode('utf-8')
|
||||||
).hexdigest()
|
).hexdigest(32)
|
||||||
|
|
||||||
result = subs_col.update_one(
|
result = subs_col.update_one(
|
||||||
{'SubscriptionHash': sub_hash},
|
{'SubscriptionHash': sub_hash},
|
||||||
|
|||||||
Reference in New Issue
Block a user