keepmenu icon indicating copy to clipboard operation
keepmenu copied to clipboard

Some TOTP entries are not working

Open seidler2547 opened this issue 3 years ago • 11 comments

For some of my database entries there is no TOTP value generated. But KeepassXC can generate it and when I use keepmenu to "View/Type individual entries" and go to the entry, I can see two fields "TOTP Seed" and "TOTP Settings", but the "TOTP" field is empty.

seidler2547 avatar May 18 '22 20:05 seidler2547

Can you please post both working and non-working values (feel free to randomize numbers/urls, etc, I'm more looking at the format) for the TOTP Seed field?

firecat53 avatar Jun 04 '22 00:06 firecat53

I think where it works is when the attribute otp is present, using the format otpauth://totp/blah?secret=SUPERSECRET&period=30&digits=6 and where it doesn't work it has two fields, one called TOTP Seed with the secret and one called TOTP Settings with the value 30;6.

seidler2547 avatar Jun 08 '22 17:06 seidler2547

Both methods are actually well described here: https://keepassium.com/articles/how-to-setup-totp/

seidler2547 avatar Jun 08 '22 17:06 seidler2547

That would make sense. Keepmenu only processes the first url-style format. Can you create a test .kdbx database with one working entry and a couple of the non-working entries so I can look at the actual field names/values that will need to be processed? Thanks!

firecat53 avatar Jun 08 '22 17:06 firecat53

Here's the file. Password is password All "Test TOTP" entries should generate the same token and all "Other TOTP" entries as well. TOTP-Test.zip

seidler2547 avatar Jun 08 '22 20:06 seidler2547

Give the totp branch a try and see if that works for you. Thanks for the detailed info and the sample kdbx file! Made solving this significantly easier!

firecat53 avatar Jul 13 '22 03:07 firecat53

@firecat53 some additional formats to detect:

  • the original keepass2 has its own totp feature comprised of distinct entry fields and autotype triggers. keepass2 can in fact import otpauth:// strings into this fieldset.

  • keepass2's keeotp / keeotp2 plugins can use a slightly different format for the otp field. this is partially supported by keepassxc (and I myself have a lot of entries with this format 😅)

    OTP type otp field value with all possible parameters
    Time-based key=whatever&type=Totp&step=30&size=6&otpHashMode=Sha1&encoding=Base32
    HMAC-based key=whatever&type=Hotp&counter=0&size=6&otpHashMode=Sha1&encoding=Base32
    parameter value Notes
    key string the only required parameter
    type Hotp/Totp default: Totp
    step int default: 30, available if type=Totp
    size int default: 6
    counter int default: 0, incremented on keygen. available if type=Hotp
    otpHashMode Sha1/Sha256/Sha512 default: Sha1
    encoding Base32/Base64/Hex/UTF8 default: Base32

bdeshi avatar Jul 13 '22 09:07 bdeshi

@firecat53 some additional formats to detect:

here's a demo db with samples of both. Database.zip Password: x

bdeshi avatar Jul 13 '22 09:07 bdeshi

@firecat53 also, I should note, the "TOTP Seed", "TOTP Settings" fields were introduced by keepass2's KeeTrayTOTP & TrayTOTP plugins. Keepassium just implemented support for this convention in their application.

bdeshi avatar Jul 13 '22 09:07 bdeshi

@firecat53 some additional formats to detect:

  • the original keepass2 has its own totp feature comprised of distinct entry fields and autotype triggers. keepass2 can in fact import otpauth:// strings into this fieldset.

  • keepass2's keeotp / keeotp2 plugins can use a slightly different format for the otp field. this is partially supported by keepassxc (and I myself have a lot of entries with this format sweat_smile)

@firecat53 i can work on adding support for these, should i work on top of the totp branch?

bdeshi avatar Jul 20 '22 05:07 bdeshi

That would be great! I've got family coming in this weekend so time will be limited for awhile. Let me know if you have implementation questions and please add tests as well. Thanks!

firecat53 avatar Jul 20 '22 23:07 firecat53

@seidler2547 Please test if the new OTP support works for you. Thanks!

firecat53 avatar Oct 17 '22 14:10 firecat53

@firecat53 sorry for the delay, my use cases work fine now. Thanks!

seidler2547 avatar Oct 24 '22 18:10 seidler2547