Skip to content

tksst/mobilepass-js

Repository files navigation

mobilepass-js

This is a JavaScript implementation of the MobilePASS token client.

Usage

install

npm install mobilepass
pnpm add mobilepass
bun add mobilepass

code (ESModule)

import { generateOtp } from "mobilepass";

const actcode = "XUU75-RROTT-Y5IP6-U3BMV";
const counter = 1;

const otp = await generateOtp(actcode, counter);
console.log(`OTP: ${otp}`);

code (CommonJS)

const { generateOtp } = require("mobilepass");

const actcode = "XUU75-RROTT-Y5IP6-U3BMV";
const counter = 1;

(async () => {
  const otp = await generateOtp(actcode, counter);

  console.log(`OTP: ${otp}`);
})();

Compatibility

  • Node.js 15.0.0 and later
  • Any other JavaScript environment that supports WebCrypto API