🚧 Some progress

This commit is contained in:
Mawoka
2022-06-22 18:32:57 +02:00
parent 021f2c7150
commit 1387c59932
2 changed files with 20 additions and 11 deletions
+4 -2
View File
@@ -1,4 +1,5 @@
import asyncio
from typing import Optional
from classquiz.db.models import Quiz, User
import xlsxwriter
@@ -107,10 +108,11 @@ async def meilisearch_init():
print("Finished MeiliSearch synchronisation")
def check_hashcash(data: str, input_data: str) -> bool:
def check_hashcash(data: str, input_data: str, claim_in: Optional[str] = "19") -> bool:
"""
It checks that the hashcash is valid, and if it is, it returns True
:param claim_in: The claim the data should have (bytes)
:param data: The hashcash string
:type data: str
:param input_data: The claim, the data the server provided
@@ -126,7 +128,7 @@ def check_hashcash(data: str, input_data: str) -> bool:
return False
try:
assert version == "1"
assert claim == "19"
assert claim == claim_in
assert res == input_data
assert ext == ""
return True