From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Jean Louis <bugs@gnu.support>
Newsgroups: gmane.emacs.devel
Subject: Re: New package for NonGNU ELPA : totp-auth
Date: Wed, 7 Feb 2024 09:46:43 +0300
Message-ID: <ZcMnU9XXa2vawuOo@lco.syogm.com>
References: <47974953-df92-4d26-a3d6-271a7d6003b7@etla.org>
 <E1rXYQB-0001gG-E5@fencepost.gnu.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="22114"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Mutt/2.2.10+64 (b470a9a) (2023-06-05)
Cc: Vivek Das Mohapatra <vivek@etla.org>, emacs-devel@gnu.org
To: Richard Stallman <rms@gnu.org>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 08 07:25:09 2024
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>
Envelope-to: ged-emacs-devel@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>)
	id 1rXxqP-0005WW-C2
	for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Feb 2024 07:25:09 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-devel-bounces@gnu.org>)
	id 1rXxpk-0003Qz-VH; Thu, 08 Feb 2024 01:24:29 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bugs@gnu.support>) id 1rXxpi-0003Qm-PH
 for emacs-devel@gnu.org; Thu, 08 Feb 2024 01:24:26 -0500
Original-Received: from stw1.rcdrun.com ([217.170.207.13])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bugs@gnu.support>)
 id 1rXxpe-0002X6-Hi; Thu, 08 Feb 2024 01:24:26 -0500
Original-Received: from localhost ([::ffff:41.75.172.87])
 (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384)
 by stw1.rcdrun.com with ESMTPSA
 id 000000000010B8A0.0000000065C47370.0000398B; Wed, 07 Feb 2024 23:23:44 -0700
Mail-Followup-To: Richard Stallman <rms@gnu.org>,
 Vivek Das Mohapatra <vivek@etla.org>, emacs-devel@gnu.org
Content-Disposition: inline
In-Reply-To: <E1rXYQB-0001gG-E5@fencepost.gnu.org>
Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support;
 helo=stw1.rcdrun.com
X-Spam_score_int: -8
X-Spam_score: -0.9
X-Spam_bar: /
X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_12_24=1.049,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no
X-Spam_action: no action
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=subscribe>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org
Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.devel:316018
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/316018>

* 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/