emacs-circe / circe

Circe, a Client for IRC in Emacs
GNU General Public License v3.0
395 stars 51 forks source link

Is it possible to connect with SASL by typing your username and password each time? #299

Closed computersarecool closed 7 years ago

computersarecool commented 7 years ago

I have to use SASL to connect to Freenode, but sometimes I want to connect via Circe on a computer where I would not like to store my private SASL password.

Is there a way that I can just type in the password during login instead of being forced to store it externally?

jorgenschaefer commented 7 years ago

You can set circe-pass to a function that returns the password. Does that help?

computersarecool commented 7 years ago

I am not sure I follow. In the documentation you give a helpful example of how to define a function called my-sasl-password which reads a file.

This is set in the sasl-password parameter of circe-network-options. Are you saying that I could instead set the sasl-password to a function and it would ask me to enter it each time?

wasamasa commented 7 years ago

@computersarecool That's the idea. How the function fetches the password is irrelevant (be it from a file, via user input, some credentials store, ...) as long as it returns the password so that Circe can use it. read-passwd is a ready-made one for this purpose.

jorgenschaefer commented 7 years ago

Sorry, got the variable names confused :-)

computersarecool commented 7 years ago

@jorgenschaefer Thanks for clearing up and @wasamasa Thanks so much!

I just have to fill in the field like so:

:sasl-password (lambda (x) (read-passwd "SASL password: "))

oatmealm commented 2 years ago

Hi there. I have this setup, but it doesn't seem to work. The only way I was passing simple strings. Authentication fails even though the pass' helper function seems to work. How can I check what's actuall passed through?

(after! circe
  (set-irc-server! "Libera Chat (EU)"
    '(:tls t
      :host "irc.eu.libera.chat"
      :port 6697
      :nick "nashdidan"
      :sasl-username ,(+pass-get-user "irc/libera.chat")
      :sasl-password (lambda (&rest _) (+pass-get-secret "irc/libera.chat"))
      :channels ("#emacs" "#guix" "#org-mode"))))
Thaodan commented 2 years ago

I would suggest to use auths-source-pass and then set auth-source-debug. Doing so will tell you everything is passed to circe.

See here if you want to use my setup: https://github.com/emacs-circe/circe/issues/82#issuecomment-1146557901

But if you want to to keep using that setup try to look in to the docs of pass-get-secret how to make it more verbose.

wasamasa commented 2 years ago

@oatmealm You need to use a backtick (instead of a quote) in combination with the comma, it will not work otherwise.

oatmealm commented 2 years ago

Thanks guys for the help. It worked with the backtick as suggested.