UNPKG

cypress-otp

Version:

Encode a Cypress fixture with Protocol Buffers

16 lines (12 loc) 301 B
const otplib = require("otplib"); let previousSecret; module.exports = (otpSecret) => { if(otpSecret) { previousSecret = otpSecret; } const secret = previousSecret; if(!secret) { throw new Error("No secret has been provided."); } return otplib.authenticator.generate(secret); }