events & global sync. unstable
This commit is contained in:
1 parent
77921ba6a8
commit
f140181c45
21 files changed
+1196
-31
No files matched your search
@@ -62,9 +62,15 @@ def verify_request(request, memory) -> Tuple[bool, str, str]:
|
||||
import nacl.signing
|
||||
vk = nacl.signing.VerifyKey(b58decode(node_id))
|
||||
sig = b58decode(sig_b58)
|
||||
msg = canonical_string(request.method, request.path, request.body or b"", ts, nonce, node_id)
|
||||
path = request.path
|
||||
query_string = getattr(request, 'query_string', None)
|
||||
if query_string:
|
||||
if not isinstance(query_string, str):
|
||||
query_string = query_string.decode() if isinstance(query_string, bytes) else str(query_string)
|
||||
if query_string:
|
||||
path = f"{path}?{query_string}"
|
||||
msg = canonical_string(request.method, path, request.body or b"", ts, nonce, node_id)
|
||||
vk.verify(msg, sig)
|
||||
return True, node_id, ""
|
||||
except Exception as e:
|
||||
return False, "", f"BAD_SIGNATURE: {e}"
|
||||
|
||||
Reference in new issue
Block a user