Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
);
// TODO minimal option to exclude these defaults
url = url
.replace(/issuer=([^&]*)&?/, '')
.replace(/digits=6&?/, '')
.replace(/algorithm=SHA1&?/, '')
.replace(/period=30&?/, '')
.replace(/(&|\?)$/, '')
;
state.state = 'qr';
state.msgs = [
"Create a New Account" + (state.totpRetry && (" (Take #" + (state.totpRetry + 1) + ")") || '')
, ""
];
qrcode.setErrorLevel('L'); // L: 7%, M: 15%, Q: 25%, H: 30%
qrcode.generate(url, function (qr) {
state.qr = qr;
state.msgs.push('__RAW__');
});
state.msgs.push('');
state.msgs.push("Download the Authy App at https://www.authy.com/app/");
state.msgs.push('');
state.msgs.push(url);
state.msgs.push('');
state.msgs.push("Type the 6-digit token below:");
state.error = null;
state.prompt = '6-digit Token: ';
// TODO handle token as 000000 with delimeters '-', ' ', or '.'
// TODO minimal option to exclude these defaults
url = url
.replace(/issuer=([^&]*)&?/, '')
.replace(/digits=6&?/, '')
.replace(/algorithm=SHA1&?/, '')
.replace(/period=30&?/, '')
.replace(/(&|\?)$/, '')
;
state.state = 'qr';
state.msgs = [
(state.totpRetry && ("[Take #" + (state.totpRetry + 1) + "] ") || '')
+ "Create New Account: Add Multi-Factor Authentication (2FA/MF1)"
, ""
];
qrcode.setErrorLevel('L'); // L: 7%, M: 15%, Q: 25%, H: 30%
qrcode.generate(url, function (qr) {
state.qr = qr;
state.msgs.push('__RAW__');
});
state.msgs.push(url);
state.msgs.push("");
state.msgs.push("Download the Authy App at https://www.authy.com/app/");
FNS.reCompute(ws, state);
return PromiseA.resolve();
};
export const displayQr = (text, errorLevel = "L") => {
qrcode.setErrorLevel(errorLevel);
console.log("");
qrcode.generate(text);
};
function printServerInfo(url) {
console.log('Up and running @ ' + url);
qrcode.setErrorLevel('H');
qrcode.generate(url, {small: true});
}