Function: erc-tls

erc-tls is an autoloaded, interactive and byte-compiled function defined in erc.el.gz.

Signature

(erc-tls &key SERVER PORT NICK USER PASSWORD FULL-NAME CLIENT-CERTIFICATE ID)

Documentation

Connect to an IRC server over a TLS-encrypted connection.

Interactively, prompt for SERVER, PORT, NICK, and PASSWORD, along with USER and FULL-NAME when given a prefix argument. Non-interactively, also accept a CLIENT-CERTIFICATE, which should be a list containing the file name of the certificate's key followed by that of the certificate itself. Alternatively, accept a value of t instead of a list, to tell ERC to query auth-source for the certificate's details.

Example client certificate (CertFP) usage:

    (erc-tls :server "irc.libera.chat" :port 6697
             :client-certificate
             '("/home/bandali/my-key.pem"
               "/home/bandali/my-cert.pem"))

See the alternative entry-point command erc as well as Info node (erc) Connecting for a fuller description of the various parameters, like ID.

Key Bindings

Aliases

erc-ssl

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
;;;###autoload
(cl-defun erc-tls (&key (server (erc-compute-server))
                        (port   (let ((erc-default-port erc-default-port-tls))
                                  (erc-compute-port)))
                        (nick   (erc-compute-nick))
                        (user   (erc-compute-user))
                        password
                        (full-name (erc-compute-full-name))
                        client-certificate
                        id
                        ;; Used by interactive form
                        ((--interactive-env-- --interactive-env--)))
  "Connect to an IRC server over a TLS-encrypted connection.
Interactively, prompt for SERVER, PORT, NICK, and PASSWORD, along
with USER and FULL-NAME when given a prefix argument.
Non-interactively, also accept a CLIENT-CERTIFICATE, which should
be a list containing the file name of the certificate's key
followed by that of the certificate itself.  Alternatively,
accept a value of t instead of a list, to tell ERC to query
`auth-source' for the certificate's details.

Example client certificate (CertFP) usage:

    (erc-tls :server \"irc.libera.chat\" :port 6697
             :client-certificate
             \\='(\"/home/bandali/my-key.pem\"
               \"/home/bandali/my-cert.pem\"))

See the alternative entry-point command `erc' as well as Info
node `(erc) Connecting' for a fuller description of the various
parameters, like ID.

\(fn &key SERVER PORT NICK USER PASSWORD FULL-NAME CLIENT-CERTIFICATE ID)"
  (interactive
   (let ((erc-default-port erc-default-port-tls)
         (erc--display-context `((erc-interactive-display . erc-tls)
                                 ,@erc--display-context)))
     (erc-select-read-args)))
  ;; Bind `erc-server-connect-function' to `erc-open-tls-stream'
  ;; around `erc-open' when a non-default value hasn't been specified
  ;; by the user or the interactive form.  And don't bother checking
  ;; for advice, indirect functions, autoloads, etc.
  (unless (or (assq 'erc-server-connect-function --interactive-env--)
              (not (eq erc-server-connect-function #'erc-open-network-stream)))
    (push '(erc-server-connect-function . erc-open-tls-stream)
          --interactive-env--))
  (unless (assq 'erc--display-context --interactive-env--)
    (push '(erc--display-context . ((erc-buffer-display . erc-tls)))
          --interactive-env--))
  (erc--with-entrypoint-environment --interactive-env--
    (erc-open server port nick full-name t password
              nil nil nil client-certificate user id)))