TOTP in Online Mode
π REL-ID SDK: TOTP Flow (Online Mode)
π Overview
In online mode, TOTP (Time-based One-Time Password) is used to provide secure, time-bound one-time codes after the user logs in. This flow involves SDK-driven registration and real-time TOTP generation.
π Flow Breakdown
flowchart TD A[π€ User is Logged In] --> TOTPRegistration[βοΈ SDK performs TOTP Registration] TOTPRegistration --> A1[π₯ App calls fetchRegisteredTOTPUsers] A1 -->|β User registered for TOTP| A2[π App shows 'Generate TOTP' option] A2 --> B[π User Selects 'Generate TOTP'] B --> C[π App calls generateTOTP] C --> F[π€ SDK emits onTOTPGenerated] F --> G[π² App Displays TOTP and Expiry Timer] %% Success Callback Styling style F fill:#d4fdd4,stroke:#228b22,stroke-width:2px %% App-Initiated Call Styling style A1 fill:#ffe4b3,stroke:#ff8c00,stroke-width:2px style C fill:#ffe4b3,stroke:#ff8c00,stroke-width:2px
π© Green - Callbacks issued by REL-ID SDK
π§ Orange - APIs invoked by the Client App
π§© Step-by-Step Explanation
β
1. User Logs In
- After successful login, the SDK automatically attempts to register the user for TOTP (if not already registered).
π 2. App Verifies Eligibility
- App calls
fetchRegisteredTOTPUsers()
to check which users are eligible for TOTP. - If the user is registered, the app enables the "Generate TOTP" option.
π 3. User Requests TOTP
- User taps on "Generate TOTP" in the app UI.
π 4. App Calls generateTOTP(userID)
generateTOTP(userID)
- This triggers the SDK to generate a new TOTP.
- Depending on configuration, the SDK may require authentication (LDA or password).
π€ 5. SDK Emits onTOTPGenerated
onTOTPGenerated
- SDK returns the one-time code and its expiration (in seconds) via the
onTOTPGenerated
event.
π² 6. App Displays Code
- App displays the TOTP along with a countdown timer to indicate expiration.
π Notes
- TOTP can be used for step-up authentication or secure offline logins.
- Ensure proper UI feedback for expiry and regeneration.
Updated about 2 months ago
Whatβs Next