Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gizmo-ds/totp-wasm
HOTP & TOTP & Steam Guard TOTP
https://github.com/gizmo-ds/totp-wasm
bun deno nodejs rust wasm webassembly
Last synced: about 2 months ago
JSON representation
HOTP & TOTP & Steam Guard TOTP
- Host: GitHub
- URL: https://github.com/gizmo-ds/totp-wasm
- Owner: gizmo-ds
- License: mit
- Created: 2022-09-09T00:28:35.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-04T07:35:22.000Z (10 months ago)
- Last Synced: 2024-11-01T00:04:25.264Z (about 2 months ago)
- Topics: bun, deno, nodejs, rust, wasm, webassembly
- Language: Rust
- Homepage: https://jsr.io/@gizmo-ds/totp-wasm
- Size: 606 KB
- Stars: 20
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# totp-wasm
HOTP([RFC 4226](https://tools.ietf.org/html/rfc4226)) & TOTP([RFC 6238](https://tools.ietf.org/html/rfc6238)) & Steam Guard TOTP
## Demo
[https://totp-wasm.vercel.app](https://totp-wasm.vercel.app)
## Usage
### Deno
```typescript
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](./examples/browser)
### Node.js
[example](./examples/node)
### Bun
[example](./examples/bun)
## Build
Prerequisites
- [Rust](https://www.rust-lang.org)
- [Node.js](https://nodejs.org)```bash
rustup target add wasm32-unknown-unknown
cargo install --version=0.2.86 wasm-bindgen-cli
pnpm install
node scripts/build.mjs
```## Runing examples
```bash
cd examples/browser
pnpm install
pnpm dev
```# Related Projects
Here are some related projects that you may find useful:
- [totp-wasm-zig](https://github.com/gizmo-ds/totp-wasm-zig): Zig implementation of this project.
- [UdonOTPLib](https://github.com/gizmo-ds/UdonOTPLib): C# implementation for the VRChat game.## License
Code is distributed under [MIT](./LICENSE) license, feel free to use it in your proprietary projects as well.