De-linted

This commit is contained in:
Dylan Monroe 2019-09-25 16:25:52 -04:00
parent 4405fdb5fe
commit 9c765ced45
No known key found for this signature in database
GPG Key ID: 605BCD1FE75AC0A1
1 changed files with 17 additions and 16 deletions

View File

@ -62,10 +62,11 @@ Otp.prototype.next = function(callback) {
const offset = sig.getInt8(sig.byteLength - 1) & 0xf;
const hmac = sig.getUint32(offset) & 0x7fffffff;
let pass;
if (this.issuer === 'Steam')
pass = Otp.HmacToSteamCode(hmac);
else
pass = Otp.HmacToDigits(hmac, this.digits);
if (this.issuer === 'Steam') {
pass = Otp.HmacToSteamCode(hmac);
} else {
pass = Otp.HmacToDigits(hmac, this.digits);
}
callback(pass, timeLeft);
});
};
@ -91,20 +92,20 @@ Otp.prototype.hmac = function(data, callback) {
};
Otp.HmacToDigits = function(hmac, length) {
let code = hmac.toString();
code = Otp.leftPad(code.substr(code.length - length), length);
return code;
}
let code = hmac.toString();
code = Otp.leftPad(code.substr(code.length - length), length);
return code;
};
Otp.HmacToSteamCode = function(hmac) {
const steamChars = '23456789BCDFGHJKMNPQRTVWXY';
let code = '';
for (let i = 0; i < 5; ++i) {
code += steamChars.charAt(hmac % steamChars.length);
hmac /= steamChars.length;
}
return code;
}
const steamChars = '23456789BCDFGHJKMNPQRTVWXY';
let code = '';
for (let i = 0; i < 5; ++i) {
code += steamChars.charAt(hmac % steamChars.length);
hmac /= steamChars.length;
}
return code;
};
Otp.fromBase32 = function(str) {
const alphabet = 'abcdefghijklmnopqrstuvwxyz234567';