first commit
This commit is contained in:
commit
34ea15a54d
246 changed files with 18660 additions and 0 deletions
16
backend/app/services/qr.py
Normal file
16
backend/app/services/qr.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import base64
|
||||
import io
|
||||
import json
|
||||
|
||||
import qrcode
|
||||
|
||||
|
||||
def build_qr_payload(qr_token: str) -> str:
|
||||
return json.dumps({"v": 1, "token": qr_token}, separators=(",", ":"))
|
||||
|
||||
|
||||
def qr_png_base64(data: str) -> str:
|
||||
image = qrcode.make(data, box_size=8, border=2)
|
||||
buffer = io.BytesIO()
|
||||
image.save(buffer, format="PNG")
|
||||
return base64.b64encode(buffer.getvalue()).decode("ascii")
|
||||
Loading…
Add table
Add a link
Reference in a new issue