https://github.com/oslo-project/otp
One-time passwords with HOTP and TOTP
https://github.com/oslo-project/otp
Last synced: 5 months ago
JSON representation
One-time passwords with HOTP and TOTP
- Host: GitHub
- URL: https://github.com/oslo-project/otp
- Owner: oslo-project
- License: mit
- Created: 2024-05-05T04:22:44.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-11-02T01:36:01.000Z (5 months ago)
- Last Synced: 2024-11-02T02:25:54.696Z (5 months ago)
- Language: TypeScript
- Homepage: https://otp.oslojs.dev
- Size: 61.5 KB
- Stars: 57
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - oslo-project/otp - One-time passwords with HOTP and TOTP (TypeScript)
README
# @oslojs/otp
**Documentation: https://otp.oslojs.dev**
A JavaScript library for generating and verifying OTPs by [Oslo](https://oslojs.dev).
Supports HMAC-based one-time passwords (HOTP) and time-based one-time passwords (TOTP) as defined in [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226) and [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238).
- Runtime-agnostic
- No third-party dependencies
- Fully typed```ts
import { generateTOTP, verifyTOTP } from "@oslojs/otp";const totp = generateTOTP(key, 30, 6);
const valid = verifyTOTP(totp, key, 30, 6);
```## Installation
```
npm i @oslojs/otp
```