mirror of
https://github.com/TronoSfera/Law.git
synced 2026-05-19 02:23:45 +03:00
1 KiB
1 KiB
OTP Service Context
Purpose
Secure public access for:
- Creating request (phone confirmation is mandatory)
- Viewing request status/chat/files by
track_number
Flow
- Send OTP (
CREATE_REQUEST/VIEW_REQUEST) - Store hashed code
- Expire in 10 minutes
- Max attempts limit
- On verify -> issue public JWT cookie (7 days, same device)
- If valid JWT exists on device, do not resend OTP until cookie expiration
Current Dev Mode
- OTP code is printed to backend console log (
[OTP MOCK] ... code=XXXXXX) - SMS provider call is mocked (
sms_response.provider = mock_sms) CREATE_REQUESTverification issues cookie withpurpose=CREATE_REQUESTandsub=<phone>- Request creation endpoint requires that cookie and then switches cookie to
purpose=VIEW_REQUEST,sub=<track_number> VIEW_REQUESTverification issues cookie withpurpose=VIEW_REQUESTandsub=<track_number>
Anti-abuse
- Rate limit (Redis)
- Cooldown between sends
- Lock after N failed attempts
- Throttling by phone + track number + IP