Skip to content

A module for OTP (One-Time Password) management implemented as a GenServer using Elixir. The `OtpGenLib` module provides functionality to: - Generate a 6-digit OTP for a given key. - Verify an OTP for correctness. - Automatically expire OTPs after a configured timeout. - Log OTP expiration events for debugging or monitoring.

Notifications You must be signed in to change notification settings

rathi-abhinav/OtpGenLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OtpGenLib

OtpGenLib is a library built for generating and verifying One-Time Passwords (OTPs) using Elixir. The OTPs are securely hashed and expire after a configured timeout. This library is designed for authentication workflows where OTPs are required for user verification or transaction approvals.

Features

  • OTP Generation: Generates a random 6-digit OTP for a given key (e.g., user email or ID).
  • OTP Verification: Verifies the user-provided OTP against the stored OTP hash.
  • OTP Expiry: OTPs automatically expire after a configured timeout (default: 30 seconds).
  • Concurrency: Utilizes Elixir's GenServer for stateful, thread-safe operations.
  • Logging: Logs OTP expiration events for monitoring and debugging purposes.

Installation

To add this library to your project, you can use the following in your mix.exs file:

defp deps do
  [
    {:otp_gen_lib, git: "https://github.com/rathi-abhinav/OtpGenLib.git"}
  ]
end

*normal_app_module.ex is just to see how it can be used.

About

A module for OTP (One-Time Password) management implemented as a GenServer using Elixir. The `OtpGenLib` module provides functionality to: - Generate a 6-digit OTP for a given key. - Verify an OTP for correctness. - Automatically expire OTPs after a configured timeout. - Log OTP expiration events for debugging or monitoring.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages