DefinitelyTyped/types/otplib/otplib-tests.ts
2017-11-16 17:15:41 +03:00

8 lines
306 B
TypeScript

import * as otplib from "otplib";
const secretValue = otplib.authenticator.generateSecret();
const tokenValue = otplib.authenticator.generate(secretValue);
let isValid = otplib.authenticator.check(tokenValue, secretValue);
isValid = otplib.authenticator.verify({secret: secretValue, token: tokenValue});