1818router = APIRouter ()
1919
2020
21+ async def toggle_pending (db , auth_session : AuthSession ):
22+ # We need to set this to pending now
23+ auth_session .proof_status = AuthSessionState .PENDING
24+ await AuthSessionCRUD (db ).patch (auth_session .id , auth_session )
25+ connections = connections_reload ()
26+ sid = connections .get (str (auth_session .id ))
27+ if sid :
28+ await sio .emit ("status" , {"status" : "pending" }, to = sid )
29+
30+
2131@router .get ("/url/pres_exch/{pres_exch_id}" )
2232async def send_connectionless_proof_req (
2333 pres_exch_id : str , req : Request , db : Database = Depends (get_db )
@@ -40,6 +50,9 @@ async def send_connectionless_proof_req(
4050 )
4151 wallet_deep_link = gen_deep_link (auth_session )
4252 template = Template (template_file )
53+
54+ # If the qrcode was scanned by mobile phone camera toggle the pending flag
55+ await toggle_pending (db , auth_session )
4356 response = HTMLResponse (template .render ({"wallet_deep_link" : wallet_deep_link }))
4457
4558 if "text/html" in req .headers .get ("accept" ):
@@ -54,12 +67,9 @@ async def send_connectionless_proof_req(
5467 connections = connections_reload ()
5568 sid = connections .get (str (auth_session .id ))
5669
57- # If the qrcode has been scanned, toggle the verified flag
70+ # If the qrcode has been scanned, toggle the pending flag
5871 if auth_session .proof_status is AuthSessionState .NOT_STARTED :
59- auth_session .proof_status = AuthSessionState .PENDING
60- await AuthSessionCRUD (db ).patch (auth_session .id , auth_session )
61- if sid :
62- await sio .emit ("status" , {"status" : "pending" }, to = sid )
72+ await toggle_pending (db , auth_session )
6373
6474 msg = auth_session .presentation_request_msg
6575
0 commit comments