Repository navigation
[Extension]: Proton Authenticator shows the same TOTP code for every account #1895
Replies: 3 comments 1 reply
|
Thanks for opening this! Tinycast stays small and focused, so new features are chosen Tip Planning to build this? Discussing the approach here first is highly preferred. |
|
@akaready if it wont break other extension or other features open a pr |
|
Thank you for the go-ahead on this. I've rebased the fix onto the current The fix is a I noticed the process has changed since I opened this. Would it be okay for me to open the pull request against this, or would you prefer I start a Vouch Request? Happy to do whichever suits you best. |
Uh oh!
There was an error while loading. Please reload this page.
Existing issues
Extension URL
https://github.com/raycast/extensions/tree/main/extensions/proton-authenticator
What happened?
Proton Authenticator → Get Totp lists every account with the same 6-digit code. The code changes every 30 seconds, but it is identical across accounts and doesn't match the codes in the Proton Authenticator app.
Expected: each account shows its own code, matching Proton Authenticator. Actual: one shared code, and it's wrong for all of them.
It looks like a gap in Tinycast's
Buffershim rather than anything Raycast-only:otplib12, which decodes each base32 secret with the bundledthirty-twopackage. That package builds its buffers with the legacynew Buffer(string)form.Bufferisclass Buffer extends Uint8Arraywith no constructor of its own, sonew Buffer("JBSWY3DP…")goes toUint8Array, which reads the string as a length. The secret comes out as an empty buffer (a numeric-looking string such asnew Buffer("6869", "hex")becomes 6,869 zero bytes instead).Hash.digesttreats an empty key as "no key", so it returns a plain hash of the time counter. Same input for every account, so the same code.Steps to reproduce
proton-authenticator, authorFared) and import two or more accounts.The same failure without any real secrets, using the RFC 4226 / RFC 6238 test secrets through the runtime fixture harness:
Screenshots or recording
I've left out a screenshot because the codes are live 2FA codes. The harness output above shows the same thing with public test secrets.
Tinycast version + channel
0.12.11 stable, build 138. The
Bufferclass and theHash.digestcheck are unchanged on currentmain.macOS version
27.2 (build 26B123), Apple Silicon.
Extension limits
Contribution
approvedI have a small fix ready, with a case in
fixtures.mjsand one inext-test: aBufferconstructor that decodes a string likeBuffer.from, andcreateHmackeeping an empty key as an HMAC. Thank you for considering it, and happy to change the approach if you'd prefer something different.All reactions