Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🔐 Zero dependencies Deno/Bun/Node/Browser module for TOTP and HOTP generator based on RFC 6238 and RFC 4226 🗝️

License

NotificationsYou must be signed in to change notification settings

haikelfazzani/otp

Repository files navigation

🔐 Deno/Bun/Node/Browser module for TOTP and HOTP generator based onRFC 6238 and RFC 4226 🗝️

  • Zero dependencies: Works seamlessly across different environments without requiring additional libraries.
  • Supports TOTP and HOTP: Generate both time-based and counter-based one-time passwords
one-time-passone-time-passone-time-passone-time-passone-time-pass

Try it out on JSFiddle:Live Demo

Install

npm i one-time-pass

Usage

Import

import{generateTOTP}from"one-time-pass";// Denoimport{generateTOTP}from"npm:one-time-pass";// Nodejsconst{ generateTOTP}=require("one-time-pass");// Or include it via CDN<scriptsrc="https://cdn.jsdelivr.net/npm/one-time-pass/dist/index.umd.js"></script>window.otp.generateTOTP("key");

Examples

generate TOTP

import{generateTOTP}from"one-time-pass";(async()=>{constdefaultOptions={hash:'SHA-1',timeStep:30,// epoch intervaldigits:6,timestamp:Date.now()}constcode=awaitgenerateTOTP("key",defaultOptions?);console.log(code);})();

generate HOTP

import{generateHOTP}from"one-time-pass";(async()=>{constcounter=14653;consthash="SHA-1";constdigits=6;constcode=awaitgenerateHOTP("secretKey",counter,hash,digits);console.log(code);})();

Ressouces

Notes

  • We welcome pull requests! Feel free to contribute to this project.

Author

License

GNU GENERAL PUBLIC LICENSE V3

About

🔐 Zero dependencies Deno/Bun/Node/Browser module for TOTP and HOTP generator based on RFC 6238 and RFC 4226 🗝️

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp