1.1.0 • Published 10 months ago

smartotps v1.1.0

Weekly downloads
-
License
-
Repository
gitlab
Last release
10 months ago

smartotp.sdk.react-native

import {SmartOtp} from "./index";

const secret = 'JBSWY3DPEHPK3PXP';

async function testTOTP() {
	try {
		const { otp, expires } = await SmartOtp.generate(secret, {
			digits: 6,
			algorithm: 'SHA-1',
			encoding: 'hex',
			period: 30,
		});
		console.log(`Generated OTP: ${otp}`);
		console.log(`Expires at: ${new Date(expires).toLocaleTimeString()}`);
	} catch (error) {
		console.error('Error generating OTP:', error);
	}
}

// Run the test
testTOTP();