This commit is contained in:
2025-09-29 00:51:15 -04:00
parent d3498ba636
commit cef92c3b14
9 changed files with 785 additions and 481 deletions

View File

@@ -2,12 +2,12 @@ import nacl.signing
import hashlib
import base64
import config
import random
import copy
import json
import re
import os
vona_version = "1.3.0"
vona_version = "1.4.0"
def canonical_json(value):
@@ -81,15 +81,17 @@ def sign_json_without_discard(data):
return data
def make_event_id():
event_id = "$"
def make_event_id(seed=None):
if seed is not None:
random.seed(seed)
random_bytes = bytearray(random.getrandbits(8) for _ in range(32))
event_id = "$"
event_id += re.sub(
r"[\/+=]",
"_",
base64.b64encode(
os.urandom(32),
).decode("utf-8"),
base64.b64encode(random_bytes).decode("utf-8"),
).rstrip("=")[:44]
event_id += ":" + config.server_name