osmank3 / otp-keys

Show and copy otp keys on Gnome Shell panel
GNU General Public License v3.0
9 stars 5 forks source link

Missing '=' and parameter value #12

Closed ccjmne closed 8 months ago

ccjmne commented 9 months ago

Hey! I just installed that extension on Gnome 45, set up one OTP, and had it work quite well. When I tried clicking the token to copy it, nothing happened... I later clicked on more stuff but the application had all but crashed. Disabling/reenabling it doesn't seem to help either!

Here it is:

The settings of extension otp-keys@osmank3.net had an error:

GLib.UriError: Missing ‘=’ and parameter value

Stack trace:
  parseURL@file:///home/ccjmne/.local/share/gnome-shell/extensions/otp-keys@osmank3.net/otplib.js:62:35
  getOtp@file:///home/ccjmne/.local/share/gnome-shell/extensions/otp-keys@osmank3.net/otplib.js:19:46
  _sync@file:///home/ccjmne/.local/share/gnome-shell/extensions/otp-keys@osmank3.net/prefs.js:248:40
  OtpList@file:///home/ccjmne/.local/share/gnome-shell/extensions/otp-keys@osmank3.net/prefs.js:140:14
  OtpRoot@file:///home/ccjmne/.local/share/gnome-shell/extensions/otp-keys@osmank3.net/prefs.js:24:21
  fillPreferencesWindow@file:///home/ccjmne/.local/share/gnome-shell/extensions/otp-keys@osmank3.net/prefs.js:750:23
  _loadPrefs@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:41:18
  async*_init@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:26:14
  ExtensionPrefsDialog@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:17:4
  OpenExtensionPrefsAsync@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:139:33
  async*LaunchExtensionPrefsAsync@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:126:14
  _handleMethodCall@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:373:35
  _wrapJSObject/<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:408:34
  _init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34

I should point out that this is a pretty neat project, thank you for it! Also, I might be able to contribute, I'll look into it maybe later this week-end :)

Cheers!

osmank3 commented 9 months ago

Hi @ccjmne! Is your issuer has "&" character?

ccjmne commented 9 months ago

Hahaha... Yep, it does.

I haven't looked at the code but from the error message and your question I suppose that it's passed into some sort of HTTP query parameter?

I'll change the name of my issuer. Thank you for the quick reply! If you think it makes sense, I'd be willing to look into circumventing this issue; it may just boil down to some encodeUriComponent call.

Thanks again!

Eric

On Thu, 15 Feb 2024, 7:50 pm Osman Karagöz, @.***> wrote:

Hi @ccjmne https://github.com/ccjmne! Is your issuer has "&" character?

— Reply to this email directly, view it on GitHub https://github.com/osmank3/otp-keys/issues/12#issuecomment-1946947613, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUBVENKENLTXTGUOPHL7BDYTZKHZAVCNFSM6AAAAABDKS7C52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBWHE2DONRRGM . You are receiving this because you were mentioned.Message ID: @.***>

osmank3 commented 9 months ago

Since I noticed the existence of the error, I have been looking for a method to solve it, but I haven't found anything yet. If you find a method, feel free to share it. If I can't solve the error, I'll look into ways to prevent the entry of the "&" character for issuer.

osmank3 commented 9 months ago

@ccjmne By the way, to edit the issuer name, you can open Seahorse and correct the issuer key in the otp-link on related otp-key.

ccjmne commented 9 months ago

@osmank3 Ah, thank you so much for that! I did exactly that and it all works perfectly. Fantastic :)

I wonder whether the Issuer or even the Username have any significance for generating appropriate TOTP... I changed both out of curiosity and the generated tokens still appear to be suitable. I guess I'll have to read up on that!

osmank3 commented 9 months ago

@ccjmne Technically, secret, algorithm(sha1,sha256, sha512) and period(30s,60s) are sufficient to create TOTP, digits indicates how many last characters of the resulting code will be used. Username and issuer are not used in code generation, but are necessary to associate which code is related to where to use.

osmank3 commented 8 months ago

Fixed with commit id 0b938bc378d4f6bfb1fce3c494df061b5b3efe88

ccjmne commented 8 months ago

Excellent! Thank you very much @osmank3!