12 lines
254 B
Python
12 lines
254 B
Python
# unipay/utils.py
|
|
import time, secrets, json
|
|
def now_ts() -> str:
|
|
return str(int(time.time()))
|
|
|
|
def nonce_str(n=32):
|
|
return secrets.token_hex(n//2)
|
|
|
|
def safe_json_dumps(obj):
|
|
return json.dumps(obj, separators=(",", ":"), ensure_ascii=False)
|
|
|