all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Richard Stallman <rms@gnu.org>
Cc: Vivek Das Mohapatra <vivek@etla.org>, emacs-devel@gnu.org
Subject: Re: New package for NonGNU ELPA : totp-auth
Date: Wed, 7 Feb 2024 09:46:43 +0300	[thread overview]
Message-ID: <ZcMnU9XXa2vawuOo@lco.syogm.com> (raw)
In-Reply-To: <E1rXYQB-0001gG-E5@fencepost.gnu.org>

* Richard Stallman <rms@gnu.org> [2024-02-07 06:17]:
> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> 
> This is a useful feature, but should it be implemented as a part of
> Emacs?  Is there / should there be a shell command for this?
> 
> Given a shell command for this, do we want it implemented in Emacs
> too?

I have implemented it this way below, and it works well now for long time already. It uses the external shell command. I would rather use Emacs Lisp for it. It is required at many logins. I did not show more than 3 logins below, and they are also fake keys.

(defvar oath-keys '(digitalocean "31CHLCURYJ5VRDHB" 
		    tether "J2AMLDF473VHD517"
		    twilio "EB1JS6TJNL1TQCWSNEZJG6IQ4XZGSC4UMI276X3TEODG2VQRTE5A")

(defun call-process-to-string (program &optional infile display &rest args)
  (with-temp-buffer
    (apply #'call-process program infile t display args)
    (buffer-string)))

(defun oath ()
  "Ask for service and kill OATH result to memory."
  (interactive)
  (let* ((key (rcd-choose (map-keys oath-keys) "OATH Service: "))
	 (result (call-process-to-string "oathtool" nil nil "-b" "--totp=sha1" (plist-get oath-keys (intern key))))
	 (result (string-trim result)))
    (message result)
    (kill-new result)))

Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



  reply	other threads:[~2024-02-07  6:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 15:35 New package for NonGNU ELPA : totp-auth Vivek Das Mohapatra
2024-02-06 10:04 ` Philip Kaludercic
2024-02-06 10:24   ` Po Lu
2024-02-06 10:27     ` Philip Kaludercic
2024-02-07  3:16 ` Richard Stallman
2024-02-07  6:46   ` Jean Louis [this message]
2024-02-08 19:15     ` Morgan Willcock
2024-02-12  9:10       ` Jean Louis
2024-02-14 13:05         ` Jean Louis
2024-02-07  8:23   ` Philip Kaludercic
2024-02-07  8:48   ` Michael Albinus
2024-02-10  3:55     ` Richard Stallman
2024-02-07 11:43   ` Vivek Das Mohapatra
2024-02-10  3:55     ` Richard Stallman
2024-02-07 13:43 ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZcMnU9XXa2vawuOo@lco.syogm.com \
    --to=bugs@gnu.support \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    --cc=vivek@etla.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.