JS OTP

100% Javascript Implementation of HOTP and TOTP for Two-Factor Authentication.

Cybersecurity & Ethical HackingJavaScriptMIT

Abstract

JS OTP is an open-source Cybersecurity & Ethical Hacking project. 100% Javascript Implementation of HOTP and TOTP for Two-Factor Authentication. A small javascript library (17k minified, 6.3k minified and gzipped) that handles generation of HMAC-based One-time Password Algorithm (HOTP) codes as per the HOTP RFC Draft and the Time-based One-time Password Algorithm (TOTP) codes as per the TOTP RFC Draft. This library produces the same codes as the Google Authenticator app. It is built using JavaScript. The complete source code is publicly available on GitHub under the MIT License, making it a useful reference for students building a Cybersecurity & Ethical Hacking mini project or final-year project.

1. Introduction

A small javascript library (17k minified, 6.3k minified and gzipped) that handles generation of HMAC-based One-time Password Algorithm (HOTP) codes as per the HOTP RFC Draft and the Time-based One-time Password Algorithm (TOTP) codes as per the TOTP RFC Draft. This library produces the same codes as the Google Authenticator app.

This package only exposes jsOTP and jsSHA to global scope and does not depend on jQuery.

2. Objective

100% Javascript Implementation of HOTP and TOTP for Two-Factor Authentication.

This project demonstrates how JavaScript can be applied to a real-world Cybersecurity & Ethical Hacking problem.

4. Technology Stack

JavaScript

5. System Requirements

General requirements for this technology stack — check the README for exact versions.

  • Node.js (LTS) and npm
  • A modern web browser
  • VS Code or any code editor
  • Git (to clone the repository)

6. Installation & Setup

git clone https://github.com/jiangts/JS-OTP.git
cd JS-OTP

Full setup instructions are in the project README.

7. Future Enhancements

Suggested extensions you can add to make this your own project.

  • Add logging and alert notifications (email / Telegram)
  • Write a threat model document for the tool
  • Package it with Docker for safe lab testing

8. Viva / Review Questions

Common questions examiners ask for projects in this domain.

  1. Which threat or attack does this project defend against?
  2. What detection or protection technique is used and what are its limits?
  3. How are false positives and false negatives handled?
  4. Which cryptographic algorithms or security standards are involved?
  5. What legal and ethical rules apply when testing a tool like this?

9. Source Code & License

This project is developed by jiangts and published on GitHub under the MIT License. Please follow the license terms and credit the original author when you use or modify this code.

Want to build this as your internship project?

Work on a Cybersecurity & Ethical Hacking project like this with mentor guidance, weekly reviews and an internship certificate from Training Trains, Erode — online or offline.

Apply for Cybersecurity & Ethical Hacking Internship