Merge pull request #1966 from exactlyaron/fix/generate-totp-issue-1964

Fix Generate TOTP & HOPT
This commit is contained in:
a3957273 2025-02-15 23:06:55 +00:00 committed by GitHub
commit 95c6406d05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 5247 additions and 3267 deletions

View file

@ -575,12 +575,11 @@ Top Drawer`, {
}),
it("Generate HOTP", () => {
const result = chef.generateHOTP("Cut The Mustard", {
name: "colonel",
const result = chef.generateHOTP("JBSWY3DPEHPK3PXP", {
});
const expected = `URI: otpauth://hotp/colonel?secret=IN2XIICUNBSSATLVON2GC4TE
const expected = `URI: otpauth://hotp/?secret=JBSWY3DPEHPK3PXP&algorithm=SHA1&digits=6&counter=0
Password: 034148`;
Password: 282760`;
assert.strictEqual(result.toString(), expected);
}),

View file

@ -11,12 +11,12 @@ import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Generate HOTP",
input: "12345678901234567890",
expectedOutput: "URI: otpauth://hotp/OTPAuthentication?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ\n\nPassword: 755224",
input: "JBSWY3DPEHPK3PXP",
expectedOutput: `URI: otpauth://hotp/?secret=JBSWY3DPEHPK3PXP&algorithm=SHA1&digits=6&counter=0\n\nPassword: 282760`,
recipeConfig: [
{
op: "Generate HOTP",
args: ["", 32, 6, 0],
args: ["", 6, 0], // [Name, Code length, Counter]
},
],
},