totp-basic
v0.0.9
Published
A Basic TOTP (Time-based One-time Password Algorithm) implementation in TypeScript for use with cloudflare-workers
Downloads
22
Maintainers
Readme
totp-basic
A totp library in typescript
that requires no external libraries.
Uses crypto.subtle API support, so that it can be used in browsers, as-is! It can also be used in cloudflare-workers amongst others!
Usage
npm install totp-basic
import {verifyTOTP, generateTOTP} from "totp-basic";
const secret = 'mysecret';
const otp = await generateTOTP(secret);
const isValid = await verifyTOTP(secret, otp);