gizmo-ds / totp-wasm

HOTP & TOTP & Steam Guard TOTP

Home Page:https://jsr.io/@gizmo-ds/totp-wasm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

totp-wasm

HOTP(RFC 4226) & TOTP(RFC 6238) & Steam Guard TOTP

Demo

https://totp-wasm.vercel.app

Usage

Deno

import {
  totp,
  init,
  wasm_data,
} from 'https://deno.land/x/totp_wasm/deno/mod.ts'

await init(wasm_data)
const code = totp('GM4VC2CQN5UGS33ZJJVWYUSFMQ4HOQJW', 1662681600, 6, 30)
console.log(code)
// 473526

Browser

example

Node.js

example

Bun

example

Build

Prerequisites

rustup target add wasm32-unknown-unknown
cargo install --version=0.2.86 wasm-bindgen-cli
pnpm install
node scripts/build.mjs

Runing examples

cd examples/browser
pnpm install
pnpm dev

Related Projects

Here are some related projects that you may find useful:

License

Code is distributed under MIT license, feel free to use it in your proprietary projects as well.

About

HOTP & TOTP & Steam Guard TOTP

https://jsr.io/@gizmo-ds/totp-wasm

License:MIT License


Languages

Language:Rust 65.6%Language:JavaScript 24.8%Language:TypeScript 9.6%