Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(users): Create API to Verify TOTP #4597

Merged
merged 1 commit into from
May 9, 2024
Merged

feat(users): Create API to Verify TOTP #4597

merged 1 commit into from
May 9, 2024

Conversation

ThisIsMani
Copy link
Contributor

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This PR allows users to complete the TOTP flow.
It adds a new api /user/totp/verify, which will verify the totp entered by the user and mark the user totp status as set if it is in InProgress.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Closes #4596.

How did you test it?

curl --location 'http://localhost:8080/user/totp/verify' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SPT with Purpose as TOTP' \
--data '{
    "totp": "189646"
}'

If the TOTP is correct, the the API should return the next token that is in the current flow.

{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiZjYwOWFiMDAtNzg5Ny00NTU2LWFlMGMtNGQ4MDZmZGFkZTkxIiwicHVycG9zZSI6ImZvcmNlX3NldF9wYXNzd29yZCIsIm9yaWdpbiI6InNpZ25fdXAiLCJleHAiOjE3MTUyNjQ0NTF9.jkhMT8x1o5WhzNxqBbBwX4jS0TQuSpemlg9_5K5Kgk8",
    "token_type": "force_set_password"
}

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@ThisIsMani ThisIsMani added C-feature Category: Feature request or enhancement A-users Area: Users labels May 8, 2024
@ThisIsMani ThisIsMani requested review from apoorvdixit88 and racnan May 8, 2024 18:01
@ThisIsMani ThisIsMani self-assigned this May 8, 2024
@ThisIsMani ThisIsMani requested review from a team as code owners May 8, 2024 18:01
@ThisIsMani ThisIsMani changed the title feat: add verify totp api feat(users): Create API to verify TOTP May 8, 2024
@ThisIsMani ThisIsMani changed the title feat(users): Create API to verify TOTP feat(users): Create API to Verify TOTP May 9, 2024
@preetamrevankar preetamrevankar added this pull request to the merge queue May 9, 2024
Merged via the queue into main with commit 9135423 May 9, 2024
15 of 18 checks passed
@preetamrevankar preetamrevankar deleted the verify_totp branch May 9, 2024 06:15
pixincreate added a commit that referenced this pull request May 10, 2024
…efactor

* 'main' of github.com:juspay/hyperswitch:
  chore(version): 2024.05.10.0
  fix(router): [NETCETERA] skip sending browser_information in authentication request for app device_channel (#4613)
  fix(users): Fix bugs caused by the new token only flows (#4607)
  ci(cypress): Fix card expiry for savecard flows (#4585)
  refactor(billing): store `payment_method_data_billing` for recurring payments (#4513)
  feat(users): new routes to accept invite and list merchants (#4591)
  fix(connector): [BAMBORA] Audit Fixes for Bambora (#4604)
  fix(connector): [iatapay]handle empty error response in case of 401 (#4291)
  feat(connector): [Payone] add connector template code (#4469)
  feat(users): Create API to Verify TOTP (#4597)
  chore(version): 2024.05.09.0
  chore(postman): update Postman collection files
  fix(core): drop three_dsserver_trans_id from authentication table (#4587)
  refactor(db): Add TenantId field to the KafkaStore struct (#4512)
  feat(users): Create `user_key_store` table and `begin_totp` API (#4577)
  Fix(connector): [BOA/CYBS] make rsync status optional (#4570)
  fix(users): Correct the condition for `verify_email` flow in decision manger (#4580)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-users Area: Users C-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Create API for TOTP Verification
4 participants