[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/base32 34d9df6232 006/103: Split out the standard label ge
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/base32 34d9df6232 006/103: Split out the standard label generation code |
Date: |
Sat, 10 Feb 2024 12:59:50 -0500 (EST) |
branch: elpa/base32
commit 34d9df6232e3f048fbcaf3ffa8a6c72a434f3bef
Author: Vivek Das Mohapatra <vivek@collabora.co.uk>
Commit: Vivek Das Mohapatra <vivek@collabora.co.uk>
Split out the standard label generation code
Allow the standard label generator to be used separately
from the otpauth wrapper generator.
---
totp.el | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/totp.el b/totp.el
index 5831797b6a..9015606b6c 100644
--- a/totp.el
+++ b/totp.el
@@ -231,18 +231,21 @@ same, ie probably intended for the same target."
(setq target vault)))
(or target default)))
+(defun totp-secret-make-label (secret)
+ "Take a `totp-unwrap-otp-blob' structure SECRET and generate a label
+from it (based on its user and service fields)."
+ (let (user srv-host)
+ (setq user (cdr (assq :user secret))
+ srv-host (cdr (or (assq :service secret)
+ (assq :host secret))))
+ (if (and user srv-host)
+ (concat user "@" srv-host)
+ (or user srv-host "nobody@unknown"))))
+
(defun totp-secret-make-label-and-wrapper (secret &optional label)
- (let (wrapped)
+ (let ((wrapped (totp-wrap-otpauth-url secret)))
(if (not label)
- (let (user srv-host)
- (setq user (cdr (assq :user secret))
- srv-host (cdr (or (assq :service secret)
- (assq :host secret))))
- (setq label
- (if (and user srv-host)
- (concat user "@" srv-host)
- (or user srv-host "nobody@unknown"))) ))
- (setq wrapped (totp-wrap-otpauth-url secret))
+ (setq label (totp-secret-make-label secret)))
(cons label wrapped)))
(defun totp-save-secret-to-secrets-source (source secret &optional label)
- [nongnu] branch elpa/base32 created (now 5fa6529ace), ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 8d27869a96 002/103: Initial check in of TOTP token generation, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 4595bb3b7c 008/103: Make the returned TOTP token a string so we don't lose leading 0s, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 93aa724afe 011/103: Improve the UI to display a constantly updated TOTP token, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 8b74f66db2 014/103: Update README, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 614354718d 007/103: Make totp-generate-otp understand secret structs and base32 strings, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 8f865c378e 001/103: Initial commit, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 545cf69323 004/103: Simplify the totp-secrets-create-item-workaround custom entry, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 2ded2a7cef 003/103: Replace generic gitlab README with something more useful, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 34d9df6232 006/103: Split out the standard label generation code,
ELPA Syncer <=
- [nongnu] elpa/base32 0146fe6b91 010/103: Minor formatting trivia in the test file, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 b7e1daca76 009/103: Comment out some spurious calls in the test file, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 4432d44bce 012/103: Trivia: clean up some docstrings, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 a683df1a74 013/103: Add a separate instance of an `auth-sources' list just for TOTP, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 5c902928f7 017/103: Fix bug in otpauth-migration URL decoder, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 f27043d432 019/103: Fix some byte compilation warnings, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 417a3d03f6 020/103: Dedup secrets manually instead of relying on freedesktop secrets API, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 800de931a0 023/103: Autoload totp-import-file and update its docstring, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 3e5a779479 022/103: Reduce totp-minimum-ui-grace default value to 3 from 5, ELPA Syncer, 2024/02/10
- [nongnu] elpa/base32 0feadbc485 025/103: Make the cancel-this-timer function more generic, ELPA Syncer, 2024/02/10