Received: (at 69013) by debbugs.gnu.org; 10 Feb 2024 17:29:26 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 10 12:29:26 2024 Received: from localhost ([127.0.0.1]:56545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rYrAK-0002aA-U9 for submit <at> debbugs.gnu.org; Sat, 10 Feb 2024 12:29:26 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:52149) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1rYrAH-0002Zf-Fm for 69013 <at> debbugs.gnu.org; Sat, 10 Feb 2024 12:29:23 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6C4E7442D1F; Sat, 10 Feb 2024 12:28:59 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1707586135; bh=LPmWdVegxTjXFp4ygC//4zYQKiJWx4ZyhGS4ZbS9GDk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=nDzezxIidxbT5Z6NXFEays81Jf1ZFFmCLEPopf6veovXP19d0zPvqSLxhw2dsO7Ze fVJqC/jUabJDse+qmoHvqPovxjq558MFBBhaewI0oPybrJ28e46qNPPVByqpHDN0Y4 DeSi+VPOrAy9ptgpdGeJO9CA3KssLzPYibrna5XxH1idp/gfOQcR6gTj3+lcD/fmj/ 7xMrHAcsag5z36hchnuIsI0LG8CUjQMjM3NyP2DaokOvTbbqyW2A1KlqzkEj9xQKOw czGgDoSPVvt3SagJnrtJMZzceQb/O0SNsRm6OAn0hF8Gtg8H2zVitJW4khL3C1K1fC Sjl9UeReRxQNw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 37317442D18; Sat, 10 Feb 2024 12:28:55 -0500 (EST) Received: from pastel (unknown [104.247.238.113]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F1A60120AC8; Sat, 10 Feb 2024 12:28:54 -0500 (EST) From: Stefan Monnier <monnier@HIDDEN> To: Stefan Kangas <stefankangas@HIDDEN> Subject: Re: bug#69013: New package for NonGNU ELPA: totp-auth In-Reply-To: <CADwFkmnKuhosfZKaXgwvXPiKR+3tS7jSH32PrDxRLSo-M4Eo4Q@HIDDEN> (Stefan Kangas's message of "Sat, 10 Feb 2024 05:15:36 -0600") Message-ID: <jwv4jeggtjw.fsf-monnier+emacs@HIDDEN> References: <47974953-df92-4d26-a3d6-271a7d6003b7@HIDDEN> <CADwFkmnKuhosfZKaXgwvXPiKR+3tS7jSH32PrDxRLSo-M4Eo4Q@HIDDEN> Date: Sat, 10 Feb 2024 12:28:53 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.037 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain PROLO_LEO1 0.1 Meta Catches all Leo drug variations so far T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 69013 Cc: 69013 <at> debbugs.gnu.org, Michael Albinus <michael.albinus@HIDDEN>, Vivek Das Mohapatra <vivek@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > + (base32 :url "https://gitlab.com/fledermaus/totp.el" > + :ignored-files ("totp-auth*.el" "Makefile" "*.md" "*.html" "tests" "RE= ADME") > + :version-map (("0.2" "1.0" "v1.0"))) Question about this one: (defun base32-lsh (v c) "Shift integer V by C bits to the left. Shift rightwards if C is negative. Any bits shifted in are 0. Suppress opinionated (and in our case wrong) warning about =E2=80=99lsh= =E2=80=99." (with-suppressed-warnings ((suspicious lsh)) (lsh v c))) I replace the above with (define-obsolete-function-alias 'base32-lsh #'ash "2024") and the tests still go through just fine. Also tracing `base32-lsh` suggests it's never called with a negative argument, which would explain why `ash` works just as well. Could point out where you rely on the unusual behavior of `lsh`, the one described in the docstring as: In this case, if VALUE is a negative fixnum treat it as unsigned, i.e., subtract 2 * =E2=80=98most-negative-fixnum=E2=80=99 from VALUE be= fore shifting it. ? > (bash-completion :url "https://github.com/szermatt/emacs-bash-completio= n" > :readme "README.md") >=20=20 > @@ -760,6 +764,10 @@ > (toc-org :url "https://github.com/snosov1/toc-org.git" > :ignored-files ("COPYING" ".travis.yml" "toc-org-test.el")) >=20=20 > + (totp-auth :url "https://gitlab.com/fledermaus/totp.el" > + :ignored-files ("base32.el" "Makefile" "*.md" "*.html" "tests") > + :version-map (("0.4" "1.0" "v1.0"))) It would be better to put the shared ignored files (i.e. `*.html`, `Makefile`, and `tests`) in `.elpaignore`, I think. Also, I'm curious about the reason why you prefer keeping `README` over `README.md`? If I were you, I'd get rid of `README`, One more thing: AFAICT, you have signed the copyright paperwork and you're the sole author of this code, so we could add it to GNU ELPA instead of NonGNU ELPA. Is that indeed the case? Would you be OK with that? In any case, I pushed your patch, thanks. See below a ptch with suggested changes (and a few FIXME questions). Stefan --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=totp-auth.patch Content-Transfer-Encoding: quoted-printable diff --git a/.gitignore b/.gitignore index e0b9fbae6f..ad6f188387 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,8 @@ *.elc *~ + +# ELPA-generated files +/totp-auth-autoloads.el +/totp-auth-pkg.el +/base32-autoloads.el +/base32-pkg.el diff --git a/README.md b/README.md index 247dd04d77..9181648782 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# totp-auth.el - Time-based One Time Password support for emacs +# totp-auth.el - Time-based One Time Password support for Emacs =20 This package generates RFC6238 Time-based One Time Passwords (in other words, what Google Authenticator implements) diff --git a/base32.el b/base32.el index 1e4304b214..48f4ec15d7 100644 --- a/base32.el +++ b/base32.el @@ -26,13 +26,7 @@ at index 32.") "The default base32hex dictionary. \nLike =E2=80=98base32-dictionary=E2=80=99 but for the base32hex encoding.= ") =20 -(defun base32-lsh (v c) - "Shift integer V by C bits to the left. -Shift rightwards if C is negative. -Any bits shifted in are 0. -Suppress opinionated (and in our case wrong) warning about =E2=80=99lsh=E2= =80=99." - (with-suppressed-warnings ((suspicious lsh)) - (lsh v c))) +(define-obsolete-function-alias 'base32-lsh #'ash "2024") =20 (defun base32-thesaurus (&optional dictionary) "Make a reverse lookup base32 for DICTIONARY. @@ -63,8 +57,8 @@ Dictionary should match =E2=80=98base32-dictionary=E2=80= =99 in format." ;; discard the 0th and 1st bits). ;; then right shift by 3 bits so we have the highest 3 ;; bits set to zero (since we want a 5-bit value): - (setq result (logand #xff (base32-lsh op-char start-bit)) - result (logand #xff (base32-lsh result -3))) + (setq result (logand #xff (ash op-char start-bit)) + result (logand #xff (ash result -3))) ;; now check to see if we need some bits from the next vyte: (when (> end-bit 7) (setq end-bit (- end-bit 7) ;; work out the first bit we don't want @@ -73,7 +67,7 @@ Dictionary should match =E2=80=98base32-dictionary=E2=80= =99 in format." ;; eg if we wanted 2 bits from byte 0 (rightmost bits 6 and 7) ;; then we want bits 8, 9, and 10, aka bits 0, 1, and 2 ;; from byte 1. which means we discard 5 bits by right shiftin= g: - r2 (logand #xff (base32-lsh op-char (- end-bit 8))) + r2 (logand #xff (ash op-char (- end-bit 8))) ;; combine the wanted bits: result (logior (logand result #x1f) (logand r2 #x1f)))) result)) @@ -90,8 +84,8 @@ Dictionary should match =E2=80=98base32-dictionary=E2=80= =99 in format." ;; but lefwards by 3 bits because we're writing into the start ;; of an 8-bit slot. ;; mask is five contiguous set bits starting at the same offset - (setq set-bits (logand #xff (base32-lsh value (- 0 -3 start-bit))) - mask (logand #xff (base32-lsh #x1f (- 0 -3 start-bit))) + (setq set-bits (logand #xff (ash value (- 0 -3 start-bit))) + mask (logand #xff (ash #x1f (- 0 -3 start-bit))) ;; turn off the masked bits in the target op-char (logand op-char (lognot mask)) ;; set the target bits to set-bits @@ -103,7 +97,7 @@ Dictionary should match =E2=80=98base32-dictionary=E2=80= =99 in format." ;; number of bits from value we have dealt with discard (- 12 end-bit) ;; discard the 3 dead bits and the dealt with bits - set-bits (logand #xff (base32-lsh value (+ 3 discard))) + set-bits (logand #xff (ash value (+ 3 discard))) op-char (logand #xff (aref str start-char)) op-char (logand op-char (lognot #xf8)) op-char (logior op-char set-bits)) diff --git a/tests/test-totp.el b/tests/test-totp.el index 99fd061d28..95e56ca0a1 100644 --- a/tests/test-totp.el +++ b/tests/test-totp.el @@ -6,15 +6,19 @@ (eval-and-compile (require 'loadhist) (let ((load-path load-path) - (this-file (or load-file-name - byte-compile-current-file - buffer-file-name))) + (this-file (if (fboundp 'macroexp-file-name) ;Emacs-28 + (macroexp-file-name) + (or load-file-name + byte-compile-current-file + buffer-file-name)))) (setq test-totp-source-dir (expand-file-name (concat (file-name-directory this-file) "/..")= )) (message "running tests in %s" test-totp-source-dir) (add-to-list 'load-path test-totp-source-dir) (mapc #'require '(totp-auth-hmac totp-auth totp-auth-interop)) - (mapcar (lambda (F) (message "%S loaded from %S" F (feature-file F))) = features))) + ;; FIXME: Annoying especially when compiling the file. + ;; Maybe do it only for those features that are newly loaded? + (dolist (F features) (message "%S loaded from %S" F (feature-file F)))= )) =20 (defun 0b (byte) "Byte to 8-character string formatter." @@ -27,9 +31,9 @@ (defun 0b4 (uint) "Uint32 to spce-separated binary string formater." (format "%8s %8s %8s %8s" - (0b (logand #xff (lsh uint -24))) - (0b (logand #xff (lsh uint -16))) - (0b (logand #xff (lsh uint -8))) + (0b (logand #xff (ash uint -24))) + (0b (logand #xff (ash uint -16))) + (0b (logand #xff (ash uint -8))) (0b (logand #xff uint)))) =20 ;; This is from RFC 6238 @@ -192,7 +196,7 @@ earlier ones, which would therefore not be returned by = =E2=80=98assoc=E2=80=99)." (while (and ok (< i (length a))) (setq item-a (nth i a) item-b (nth i b) - key-lol (list (mapcar 'car item-a) (mapcar 'car item-b)) + key-lol (list (mapcar #'car item-a) (mapcar #'car item-b)) i (1+ i) j nil) (dolist (key-list key-lol) @@ -221,7 +225,7 @@ earlier ones, which would therefore not be returned by = =E2=80=98assoc=E2=80=99)." (message "%s imported OK" test-file) (message "%s import FAILED" test-file) (setq close-enough nil))) - (mapcar 'car test-totp-import-expected-results)) + (mapcar #'car test-totp-import-expected-results)) close-enough)) =20 ;; (totp-unwrap-otp-blob "otpauth://totp/Test%20QR%20import?secret=3Ddeadb= eefdeadbeefdeadbeef&digits=3D7&algorithm=3DSHA256") @@ -230,7 +234,9 @@ earlier ones, which would therefore not be returned by = =E2=80=98assoc=E2=80=99)." =20 =20 (defun test-totp () - (mapc 'test-totp-check-parameters test-totp-data) + (mapc #'test-totp-check-parameters test-totp-data) (test-totp-import)) =20 +;; FIXME: Loading a file should never have such side effects. +;; Better ask the user to `emacs -l test-totp -f test-totp'. (test-totp) diff --git a/totp-auth-interop.el b/totp-auth-interop.el index bb5a322eb2..afcd836057 100644 --- a/totp-auth-interop.el +++ b/totp-auth-interop.el @@ -9,22 +9,23 @@ ;;; Code: (eval-and-compile (let ((load-path load-path) - (this-file (or load-file-name - byte-compile-current-file - buffer-file-name))) - (when (not (and (locate-library "base32") - (locate-library "hmac"))) + (this-file (if (fboundp 'macroexp-file-name) ;Emacs-28 + (macroexp-file-name) + (or load-file-name + byte-compile-current-file + buffer-file-name)))) + (when (not (locate-library "totp-auth")) (add-to-list 'load-path (file-name-directory this-file))) - (require 'totp-auth) - (require 'epa-hook)) - ;; function declared obsolete in 29.x - ;; do not use #' forms here as that will trigger a different warning + (require 'totp-auth))) +(require 'epa-hook) +(require 'mailcap) + +(defalias 'totp-auth-image-type-from-filename (if (fboundp 'image-supported-file-p) - (defalias 'totp-auth-image-type-from-filename - 'image-supported-file-p) - (defalias 'totp-auth-image-type-from-filename - 'image-type-from-file-name)) - (require 'mailcap)) + #'image-supported-file-p + ;; Function declared obsolete in 29.x + ;; do not use #' forms here as that will trigger a different warning. + 'image-type-from-file-name)) =20 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;; ;; This file implements import/export functionality for common OTP exchange @@ -65,7 +66,7 @@ Returns a cons of (VALUE . BYTES-READ)" ;; only leaves 1 bit. (setq b10 (aref collected 9))) (dotimes (i (length collected)) - (setq u64 (+ u64 (base32-lsh (aref collected i) (* i 7))))) + (setq u64 (+ u64 (ash (aref collected i) (* i 7))))) (if (and b10 (not (eq b10 1))) (cons nil vbyte-count) (cons u64 vbyte-count))) )) @@ -78,7 +79,7 @@ Where TYPE should be :varint :i64 :len or :i32" (let ((decoded (totp-auth-pb-read-varint buf pos)) type field) (setq field (car decoded) type (totp-auth-pb-type (logand #x7 field)) - field (base32-lsh field -3)) + field (ash field -3)) (setcar decoded (cons field type)) decoded)) =20 @@ -274,7 +275,7 @@ The return value will be the raw byte sequence encoding= that secret." (:algo 4 :varint) (:digits 5 :varint 6) (:type 6 :varint 2))) - (mapconcat 'identity (nreverse encoded) ""))) + (mapconcat #'identity (nreverse encoded) ""))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;; (defun totp-auth-unwrap-otpauth-migration-url (u) "Unpack an otpauth-migration url U and extract the parts we care about. diff --git a/totp-auth.el b/totp-auth.el index 4d42a2176f..89219cf490 100644 --- a/totp-auth.el +++ b/totp-auth.el @@ -40,22 +40,24 @@ ;;; Code: (eval-and-compile (let ((load-path load-path) - (this-file (or load-file-name - byte-compile-current-file - buffer-file-name))) + (this-file (if (fboundp 'macroexp-file-name) ;Emacs-28 + (macroexp-file-name) + (or load-file-name + byte-compile-current-file + buffer-file-name)))) (when (not (and (locate-library "base32") - (locate-library "hmac"))) + (locate-library "totp-auth-hmac"))) (add-to-list 'load-path (file-name-directory this-file))) (require 'base32) - (require 'totp-auth-hmac)) - ;; this is to reduce warnings for melpa - it's not actually necessary - (ignore-errors (require 'notifications)) - (require 'auth-source) - (require 'secrets) - (require 'bindat) - (require 'url-parse) - (require 'url-util) - (require 'mailcap)) + (require 'totp-auth-hmac))) +;; this is to reduce warnings for melpa - it's not actually necessary +(require 'notifications nil t) +(require 'auth-source) +(require 'secrets) +(require 'bindat) +(require 'url-parse) +(require 'url-util) +(require 'mailcap) =20 (defgroup totp-auth nil "Time-based One Time Passwords." :prefix "totp" @@ -67,8 +69,7 @@ '("com.github.bilelmoussaoui.Authenticator") "A list of fallback XDG schemas which are associated with TOTP secrets. This is used only to read TOTP secrets stored by other applications." - :type '(repeat string) - :group 'totp-auth) + :type '(repeat string)) =20 (defcustom totp-auth-minimum-ui-grace 3 "The minimum time to expiry a TOTP must have for interactive use. @@ -78,17 +79,15 @@ and wait until it is valid before giving it to the user. Noninteractive TOTP code MUST return TOTP values along with their lifespan (at the time of generation) and their absolute expiry time." :type 'integer - :group 'totp) + :group 'totp) ;; FIXME: Typo? =20 (defcustom totp-auth-max-tokens 1024 "The maximum number of tokens totp will try to fetch and process." - :group 'totp-auth :type 'integer) =20 (defcustom totp-auth-file-import-command '("zbarimg" "-q" "@file@") "The command and parameters used to parse a QR code image. @file@ is a placeholder for the file name." - :group 'totp-auth :type '(repeat string)) =20 (defcustom totp-auth-file-export-command @@ -97,7 +96,6 @@ lifespan (at the time of generation) and their absolute e= xpiry time." @file@ is a placeholder for the target filename. @type@ is a placeholder for a supported output type and will be determined= by =E2=80=98totp-auth-file-export-type-map=E2=80=99." - :group 'totp-auth :type '(repeat string)) =20 (defcustom totp-auth-file-export-type-map '((png "-t" "PNG") @@ -107,7 +105,6 @@ lifespan (at the time of generation) and their absolute= expiry time." Defaults to a map usable by qrencode (see =E2=80=98totp-auth-file-export-c= ommand=E2=80=99). May also be a function, which should take one argument (the image type sym= bol) and return a list of arguments to pass to the QR encoder." - :group 'totp-auth :type '(choice (alist :tag "Fixed type map" :key-type symbol :value-type (repeat string)) @@ -117,7 +114,6 @@ and return a list of arguments to pass to the QR encode= r." "Export byte size limit for otpauth-migration URLs. The total size of any generated otpauth-migration scheme URL will not exceed this size." - :group 'totp-auth :type 'integer) =20 (defcustom totp-auth-secrets-create-item-workaround t @@ -126,7 +122,6 @@ If this option is on (the default) then we attempt delete duplicated secrets when we save a secret via this API.\n If it is off then you are likely to end up with multiple copies of a secret if you ever re-import it." - :group 'totp-auth :type 'boolean) =20 (defcustom totp-auth-auto-copy-password '(PRIMARY CLIPBOARD) @@ -135,7 +130,6 @@ The behaviour is implemented by =E2=80=98totp-auth-upda= te-paste-buffers=E2=80=99 as follows: - When the token is generated, it is placed in the selected copy areas - If the copy area still contains the previous value when the token expires and is regenerated it is replaced with the new value." - :group 'totp-auth :type '(choice (const :tag "Off" nil) (set :tag "Choose Copy Method(s)" @@ -147,7 +141,6 @@ The behaviour is implemented by =E2=80=98totp-auth-upda= te-paste-buffers=E2=80=99 as follows: "Choose the TOTP token display mechanism. A Custom function it must accept a =E2=80=98totp-auth-generate-otp=E2=80= =99 SECRET and optional LABEL as its first two arguments." - :group 'totp-auth :type '(choice (const :tag "Notification if possible, otherwise TOTP buffer" ni= l) (const :tag "Desktop notification" @@ -160,7 +153,6 @@ and optional LABEL as its first two arguments." If unset (the default) this will be initialised to a list consisting of the contents of =E2=80=98auth-sources=E2=80=99 with the free= desktop secrets service login session prepended to it, if it is available." - :group 'totp-auth :type `(repeat :tag "Authentication Sources" (choice (const :tag "TOTP Secrets Collection" "secrets:TOTP") @@ -545,11 +537,13 @@ a structure conforming to =E2=80=98totp-auth-unwrap-o= tp-blob=E2=80=99." =20 (defun totp-auth-hmac-message (counter) "Take COUNTER (an integer) and return its 8-byte big-endian representati= on." - (let ((hi-4 (logand #xffffffff (base32-lsh counter -32))) - (lo-4 (logand #xffffffff counter))) - (bindat-pack '((:hi4 u32) (:lo4 u32)) - `((:hi4 . ,hi-4) - (:lo4 . ,lo-4))))) + (if (eval-when-compile (fboundp 'bindat-type)) ;Emacs-28 + (bindat-pack (bindat-type uint 64) counter) + (let ((hi-4 (logand #xffffffff (ash counter -32))) + (lo-4 (logand #xffffffff counter))) + (bindat-pack '((:hi4 u32) (:lo4 u32)) + `((:hi4 . ,hi-4) + (:lo4 . ,lo-4)))))) =20 (defun totp-auth-truncate-hash (hmac-hash) "Given a 20 byte string or vector HMAC-HASH: @@ -562,9 +556,9 @@ with the highest bit forced to 0 (ie a 31 bit integer)." b1 (logand #xff (aref hmac-hash (+ 1 offset))) b2 (logand #xff (aref hmac-hash (+ 2 offset))) b3 (logand #xff (aref hmac-hash (+ 3 offset)))) - (logior (base32-lsh b0 24) - (base32-lsh b1 16) - (base32-lsh b2 8) b3))) + (logior (ash b0 24) + (ash b1 16) + (ash b2 8) b3))) =20 (defvar totp-auth-override-time nil "This value is used instead of the seconds since epoch if it is set.") @@ -671,21 +665,15 @@ OTP and TOKEN are used internally and need not be pas= sed." =20 (defun totp-auth-display-token-buffer (secret &optional label) "Display buffer with the current token for SECRET with label LABEL." - (let (ui-buffer) - (or label - (setq label (totp-auth-secret-make-label secret))) - (setq ui-buffer (get-buffer-create (format "*TOTP %s*" label))) + (or label + (setq label (totp-auth-secret-make-label secret))) + (let ((ui-buffer (get-buffer-create (format "*TOTP %s*" label)))) (set-buffer ui-buffer) - (mapc 'make-local-variable '(totp-auth-display-ttl - totp-auth-display-label - totp-auth-display-expiry - totp-auth-display-oldpwd - totp-auth-display-secret)) - (setq totp-auth-display-label label - totp-auth-display-secret (cdr (assq :secret secret)) - totp-auth-display-oldpwd nil - totp-auth-display-ttl nil - totp-auth-display-expiry nil) + (setq-local totp-auth-display-label label) + (setq-local totp-auth-display-secret (cdr (assq :secret secret))) + (setq-local totp-auth-display-oldpwd nil) + (setq-local totp-auth-display-ttl nil) + (setq-local totp-auth-display-expiry nil) (pop-to-buffer ui-buffer) (run-with-timer 0 1 #'totp-auth-update-token-display ui-buffer))) =20 @@ -700,6 +688,8 @@ SECRET is a suitable argument for =E2=80=98totp-auth-ge= nerate-otp=E2=80=99. then close the notification. \nIf the current token is about to expire (see =E2=80=98totp-auth-minimum-= ui-grace=E2=80=99) then wait until it is time to renew the token before doing anything." + ;; Presumably, if we're here, `notifications' has been loaded. + (declare-function notifications-close-notification "ext:notifications") (when (equal "copy" key) (let (otp ttl token) (setq otp (totp-auth-generate-otp secret) @@ -718,6 +708,8 @@ ID is the freedesktop notifications id (an unsigned 32 = but integer). LABEL is the descriptive label of the OTP secret. SECRET is a suitable secret usable by =E2=80=98totp-auth-generate-otp=E2= =80=99. Usually called from a timer set by =E2=80=98totp-auth-display-token-notifi= cation=E2=80=99." + ;; Presumably, if we're here, `notifications' has been loaded. + (declare-function notifications-notify "ext:notifications") (let (otp text ttl) (setq otp (totp-auth-generate-otp secret) ttl (nth 1 otp) @@ -770,8 +762,8 @@ LABEL will be initialised by =E2=80=98totp-auth-secret-= make-label=E2=80=99 if unset." (setq label (totp-auth-secret-make-label secret))) (if totp-auth-display-token-method (funcall totp-auth-display-token-method secret label) - (if (ignore-errors (and (require 'notifications) - (notifications-get-server-information))) + (if (and (fboundp 'notifications-get-server-information) + (notifications-get-server-information)) (totp-auth-display-token-notification secret label) (totp-auth-display-token-buffer secret label)))) =20 --=-=-=--
elpa-maintainers@HIDDEN
:bug#69013
; Package elpa
.
Full text available.Received: (at submit) by debbugs.gnu.org; 10 Feb 2024 11:16:02 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 10 06:16:02 2024 Received: from localhost ([127.0.0.1]:33307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rYlKz-0005QV-5H for submit <at> debbugs.gnu.org; Sat, 10 Feb 2024 06:16:01 -0500 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:42382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1rYlKx-0005QA-4u for submit <at> debbugs.gnu.org; Sat, 10 Feb 2024 06:16:00 -0500 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-561587ce966so1355940a12.1 for <submit <at> debbugs.gnu.org>; Sat, 10 Feb 2024 03:15:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707563738; x=1708168538; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:references:from:from:to:cc :subject:date:message-id:reply-to; bh=RmvL61J1MJifNgBYPp06IZdUNrMkkyAnTuzCSwm+7X0=; b=S10/3SS938L1sAwADSQwz11VoSGL3YgCSSuytoEvlLghI19lQ9lwS3khdY3f1dJ7WD AVKSgTGn+0jIvolOIPycupk29w6WT8CVmiWVbgwEUX7IP2Rh24aE6RnCJckRneGbR85Q Mh1MotVvKzsIl+3lz6psO3KvvIq3CaPI7N1koSwIpft4lnJLT3QhSIuWQqRAMhfHqsPJ u608fQWRtkkADpGKUE50uZ4qb6w4pYLqSLpy9bL3a6EUsRfg7PZwYInGBp5LNXaVxpUP tqdSZl7GFXTRdx77rF3gtFG7qXZkr07AvMG8SnuaCUsS6+zUcdifrQdiusZSg11ncBdg 1prA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707563738; x=1708168538; h=to:subject:message-id:date:mime-version:references:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RmvL61J1MJifNgBYPp06IZdUNrMkkyAnTuzCSwm+7X0=; b=AjDP9C9HbspXoiv1nAYvkDqmm+3U7WWyo2BrrVP7LSMg74+/aW5pAVkWkBB127qQUm HffxlExLUijfIf2/AvfeQkMP5MLqPrfrSzXT8BW7JN7gzu2+vi2c1kU06bl6S4KZMhAG XPBZeG6c81Jeuis88LhvdcjgmNRuMmxl4rleFdij+keEOa3giOVSBED/WR6f+Tda86pu 9LcxnaA2qQM4tPzxshGZ6UIerdX+QHGfYP/ZP968byPztpSNfLqTgJ74ivZbCRz2XZzA S4nU5X974Wr+uTKPTPLSJvoVFvInKZcarmTE9fBWYNQQCK6lyLDrynPwjXWSVj46B/tT Ga1g== X-Gm-Message-State: AOJu0YxIQaO+KSvZ5QjRo6u6u7Aq2YSnQFXKm+rBFiUqCTbqpciiQiEL 41BsyWa1ZsA5UeXv591p8sh0Fo8cyYVyU8SZMnHWzBhb312bKD4UrJIud2YhH3G5F8amcV73ofc I1XmjXxEhfpVwQgf+ibMTPOVYdemooyhdriU= X-Google-Smtp-Source: AGHT+IEJd/gNG9Lwg3jCY1fC8yZmrX5gSi9SL2x1Od37dBG91g1oYPhw2J0UclbH4L5LhqQqihfGM+JnDGrqX3TxlV4= X-Received: by 2002:a05:6402:911:b0:55f:e2ee:6bba with SMTP id g17-20020a056402091100b0055fe2ee6bbamr3856483edz.5.1707563737616; Sat, 10 Feb 2024 03:15:37 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 10 Feb 2024 05:15:36 -0600 From: Stefan Kangas <stefankangas@HIDDEN> References: <47974953-df92-4d26-a3d6-271a7d6003b7@HIDDEN> X-Debbugs-CC: Vivek Das Mohapatra <vivek@HIDDEN>, Michael Albinus <michael.albinus@HIDDEN> MIME-Version: 1.0 Date: Sat, 10 Feb 2024 05:15:36 -0600 Message-ID: <CADwFkmnKuhosfZKaXgwvXPiKR+3tS7jSH32PrDxRLSo-M4Eo4Q@HIDDEN> Subject: New package for NonGNU ELPA: totp-auth To: submit <at> debbugs.gnu.org Content-Type: multipart/mixed; boundary="000000000000032a5b0611052a56" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --000000000000032a5b0611052a56 Content-Type: text/plain; charset="UTF-8" Package: elpa See also the corresponding discussion on emacs-devel: https://lists.gnu.org/r/emacs-devel/2024-02/msg00206.html -------------------- Start of forwarded message -------------------- Date: Mon, 5 Feb 2024 15:35:40 +0000 To: emacs-devel@HIDDEN From: Vivek Das Mohapatra <vivek@HIDDEN> Subject: New package for NonGNU ELPA : totp-auth --000000000000032a5b0611052a56 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Disposition: attachment Content-Transfer-Encoding: base64 X-Attachment-Id: 473ade71570b8e89_0.1.0 SGkgLSBJJ3ZlIHJlY2VudGx5IG1hZGUgYSBwYWNrYWdlIHRoYXQgaW1wbGVtZW50cyBSRkM2MjM4 IFRPVFAgYW5kIHdhcyAKd29uZGVyaW5nIGlmIG5vbmdudSBlbHBhIHdvdWxkIGNvbnNpZGVyIGNh cnJ5aW5nIGl0OgoKdG90cC1hdXRoLmVsIC0gVGltZS1iYXNlZCBPbmUgVGltZSBQYXNzd29yZCBz dXBwb3J0IGZvciBlbWFjcwoKVGhpcyBwYWNrYWdlIGdlbmVyYXRlcyBSRkM2MjM4IFRpbWUtYmFz ZWQgT25lIFRpbWUgUGFzc3dvcmRzCihpbiBvdGhlciB3b3Jkcywgd2hhdCBHb29nbGUgQXV0aGVu dGljYXRvciBpbXBsZW1lbnRzKQphbmQgZGlzcGxheXMgdGhlbSAoYXMgd2VsbCBhcyBvcHRpb25h bGx5IGNvcHlpbmcgdGhlbSB0bwp0aGUgY2xpcGJvYXJkL3ByaW1hcnkgc2VsZWN0aW9uKSwgdXBk YXRpbmcgdGhlbSBhcyB0aGV5IGV4cGlyZS4KCkl0IHJldHJpZXZlcyB0aGUgc2hhcmVkIHNlY3Jl dHMgdXNlZCB0byBnZW5lcmF0ZSBUT1RQIHRva2Vucwp3aXRoIOKAmGF1dGgtc291cmNlc+KAmSBh bmQvb3IgdGhlIGZyZWVkZXNrdG9wIHNlY3JldHMgQVBJIChha2EKR25vbWUgS2V5cmluZyBvciBL V2FsbGV0KS4KCllvdSBjYW4gY2FsbCBpdCB3aXRoIHRoZSBjb21tYW5kIOKAmHRvdHAtYXV0aOKA mSwgaWU6CgogICAgTS14IHRvdHAtYXV0aCBSRVQKCllvdSBjYW4gdGFiLWNvbXBsZXRlIGJhc2Vk IG9uIHRoZSBsYWJlbCBvZiB0aGUgc2VjcmV0LgpEZXBlbmRpbmcgb24gdGhlIHNldHRpbmcgb2Yg 4oCYdG90cC1hdXRoLWRpc3BsYXktdG9rZW4tbWV0aG9k4oCZIHRoZQpUT1RQIHRva2VuIHdpbGwg YmUgZGlzcGxheWVkIChhbmQga2VwdCB1cCB0byBkYXRlKSBlaXRoZXIgaW4KYW4gZW1hY3MgYnVm ZmVyIG9yIGEgZnJlZWRlc2t0b3Agbm90aWZpY2F0aW9uLg== --000000000000032a5b0611052a56 Content-Type: text/x-patch; charset="utf-8"; name="0001-Add-the-totp-auth-package-and-its-dependency-base32.patch" Content-Disposition: attachment; filename="0001-Add-the-totp-auth-package-and-its-dependency-base32.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: 473ade71570b8e89_0.1.1 RnJvbSBkZDE1YzA0OTZjZDUzMGZiMWJkMThlN2E3OWE4MjdlNzZiYjI5YTU3IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/Vml2ZWs9MjBEYXM9QzI9QTBNb2hhcGF0cmE/ PSA8dml2ZWtAY29sbGFib3JhLmNvbT4KRGF0ZTogTW9uLCA1IEZlYiAyMDI0IDE1OjE5OjM0ICsw MDAwClN1YmplY3Q6IFtQQVRDSF0gQWRkIHRoZSB0b3RwLWF1dGggcGFja2FnZSBhbmQgaXRzIGRl cGVuZGVuY3kgKGJhc2UzMikKTUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiB0ZXh0L3Bs YWluOyBjaGFyc2V0PVVURi04CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IDhiaXQKClRoaXMg cGFja2FnZSBnZW5lcmF0ZXMgUkZDNjIzOCBUaW1lLWJhc2VkIE9uZSBUaW1lIFBhc3N3b3Jkcwoo aW4gb3RoZXIgd29yZHMsIHdoYXQgR29vZ2xlIEF1dGhlbnRpY2F0b3IgaW1wbGVtZW50cykKYW5k IGRpc3BsYXlzIHRoZW0gKGFzIHdlbGwgYXMgb3B0aW9uYWxseSBjb3B5aW5nIHRoZW0gdG8KdGhl IGNsaXBib2FyZC9wcmltYXJ5IHNlbGVjdGlvbiksIHVwZGF0aW5nIHRoZW0gYXMgdGhleSBleHBp cmUuCgpJdCByZXRyaWV2ZXMgdGhlIHNoYXJlZCBzZWNyZXRzIHVzZWQgdG8gZ2VuZXJhdGUgVE9U UCB0b2tlbnMKd2l0aCDigJhhdXRoLXNvdXJjZXPigJkgYW5kL29yIHRoZSBmcmVlZGVza3RvcCBz ZWNyZXRzIEFQSSAoYWthCkdub21lIEtleXJpbmcgb3IgS1dhbGxldCkuCi0tLQogZWxwYS1wYWNr YWdlcyB8IDggKysrKysrKysKIDEgZmlsZSBjaGFuZ2VkLCA4IGluc2VydGlvbnMoKykKCmRpZmYg LS1naXQgYS9lbHBhLXBhY2thZ2VzIGIvZWxwYS1wYWNrYWdlcwppbmRleCAxZjlhMTYzMTFjLi44 ZWQzOTU1NTQ3IDEwMDY0NAotLS0gYS9lbHBhLXBhY2thZ2VzCisrKyBiL2VscGEtcGFja2FnZXMK QEAgLTQ5LDYgKzQ5LDEwIEBACiAgKGF1dG90aGVtZXIJCTp1cmwgImh0dHBzOi8vZ2l0aHViLmNv bS9qYXNvbm0yMy9hdXRvdGhlbWVyLmdpdCIKICAgOnJlYWRtZSAiUkVBRE1FLm1kIikKIAorIChi YXNlMzIJCTp1cmwgImh0dHBzOi8vZ2l0bGFiLmNvbS9mbGVkZXJtYXVzL3RvdHAuZWwiCisgIDpp Z25vcmVkLWZpbGVzICgidG90cC1hdXRoKi5lbCIgIk1ha2VmaWxlIiAiKi5tZCIgIiouaHRtbCIg InRlc3RzIiAiUkVBRE1FIikKKyAgOnZlcnNpb24tbWFwICAgKCgiMC4yIiAiMS4wIiAidjEuMCIp KSkKKwogIChiYXNoLWNvbXBsZXRpb24JOnVybCAiaHR0cHM6Ly9naXRodWIuY29tL3N6ZXJtYXR0 L2VtYWNzLWJhc2gtY29tcGxldGlvbiIKICAgOnJlYWRtZSAiUkVBRE1FLm1kIikKIApAQCAtNzYw LDYgKzc2NCwxMCBAQAogICh0b2Mtb3JnCQk6dXJsICJodHRwczovL2dpdGh1Yi5jb20vc25vc292 MS90b2Mtb3JnLmdpdCIKICAgOmlnbm9yZWQtZmlsZXMgKCJDT1BZSU5HIiAiLnRyYXZpcy55bWwi ICJ0b2Mtb3JnLXRlc3QuZWwiKSkKIAorICh0b3RwLWF1dGgJCTp1cmwgImh0dHBzOi8vZ2l0bGFi LmNvbS9mbGVkZXJtYXVzL3RvdHAuZWwiCisgIDppZ25vcmVkLWZpbGVzICgiYmFzZTMyLmVsIiAi TWFrZWZpbGUiICIqLm1kIiAiKi5odG1sIiAidGVzdHMiKQorICA6dmVyc2lvbi1tYXAgICAoKCIw LjQiICIxLjAiICJ2MS4wIikpKQorCiAgKHRyZWV2aWV3CQk6dXJsICJodHRwczovL2dpdGh1Yi5j b20vdGlsbWFucmFzc3kvZW1hY3MtdHJlZXZpZXciCiAgIDpyZWFkbWUgIlJFQURNRS5tZCIKICAg Omlnbm9yZWQtZmlsZXMgKCJMSUNFTlNFIikpCi0tIAoyLjMwLjIKCg== --000000000000032a5b0611052a56 Content-Type: text/plain; charset="US-ASCII" Content-Disposition: attachment Content-Transfer-Encoding: base64 X-Attachment-Id: 473ade71570b8e89_0.2 LS0tLS0tLS0tLS0tLS0tLS0tLS0gRW5kIG9mIGZvcndhcmRlZCBtZXNzYWdlIC0tLS0tLS0tLS0t LS0tLS0tLS0tCg== --000000000000032a5b0611052a56--
Stefan Kangas <stefankangas@HIDDEN>
:vivek@HIDDEN, michael.albinus@HIDDEN, elpa-maintainers@HIDDEN
.
Full text available.vivek@HIDDEN, michael.albinus@HIDDEN, elpa-maintainers@HIDDEN
:bug#69013
; Package elpa
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.