ayn2op / discordo

A lightweight, secure, and feature-rich Discord terminal client.
MIT License
2.12k stars 66 forks source link

Login details aren't remembered when quitting and restarting #358

Closed lukalot closed 7 months ago

lukalot commented 7 months ago

Distro: NixOS

Every time restarting Discordo I'm prompted for login details, regardless of the 'Remember Me' checkbox being checked on last login.

lukalot commented 7 months ago

Are there any logs / other info I could provide to clarify what's happening

cyberme0w commented 7 months ago

I'd wager this is related to the token being stored via go-keyring. I haven't touched NixOS myself yet, but I found this unix.stackexchange post which talked about how to enable Gnome's keyring. Perhaps that helps?

Otherwise (and I know this is more of a workaround than a solution to the problem) there's always the option to log in via token, which you could store in pass or any other password manager.

cyberme0w commented 7 months ago

Related to this, and given how there have been a few issues already regarding the keyring, perhaps 99designs/keyring is a good alternative to zalando/go-keyring, as it supports pass as a backend, in addition to all the standard keyrings.

ayn2op commented 7 months ago

Related to this, and given how there have been a few issues already regarding the keyring, perhaps 99designs/keyring is a good alternative to zalando/go-keyring, as it supports pass as a backend, in addition to all the standard keyrings.

99designs/keyring uses Cgo, while zalando/go-keyring does not.

cyberme0w commented 7 months ago

99designs/keyring uses Cgo, while zalando/go-keyring does not.

I'm not a Go developer, so I might be understanding this wrong, but the only cgo-related code I see is this header in keychain.go:

// +build darwin,cgo

which was added to enable cross-compilation between Linux and Darwin:

commit 756c48deecbd97e8fe3581f20efbaa136689cf80
(...)

Add cgo build tag for crosscompiles

go-keychain is all cgo as of right now, so attempting to cross-compile a
darwin executable of aws-vault on linux results in errors about undefined
functions. If the cgo build tag is added here, linux cross-compiles of
darwin complete successfully (albeit without keychain functionality). I
am interested in this because I want transparent access across a host
macbook and multiple vagrant machines running on it with the .aws-vault
directory mapped into them, which seemed to work after I compiled
binaries including this change.

diff (...)
-// +build darwin
+// +build darwin,cgo

My understanding is that typically for Cgo, one would #include "somelib.h" (or any other relevant C code) and then make it available via `import "C".

Then again, maybe I'm looking in the wrong place. Is the library worth a second look?

ayn2op commented 7 months ago

99designs/keyring uses Cgo, while zalando/go-keyring does not.

I'm not a Go developer, so I might be understanding this wrong, but the only cgo-related code I see is this header in keychain.go:

// +build darwin,cgo

which was added to enable cross-compilation between Linux and Darwin:

commit 756c48deecbd97e8fe3581f20efbaa136689cf80
(...)

Add cgo build tag for crosscompiles

go-keychain is all cgo as of right now, so attempting to cross-compile a
darwin executable of aws-vault on linux results in errors about undefined
functions. If the cgo build tag is added here, linux cross-compiles of
darwin complete successfully (albeit without keychain functionality). I
am interested in this because I want transparent access across a host
macbook and multiple vagrant machines running on it with the .aws-vault
directory mapped into them, which seemed to work after I compiled
binaries including this change.

diff (...)
-// +build darwin
+// +build darwin,cgo

My understanding is that typically for Cgo, one would #include "somelib.h" (or any other relevant C code) and then make it available via `import "C".

Then again, maybe I'm looking in the wrong place. Is the library worth a second look?

99designs/keyring depends on 99designs/go-keychain which uses uses cgo to use macOS-specific API