emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/base32 614354718d 007/103: Make totp-generate-otp understa


From: ELPA Syncer
Subject: [nongnu] elpa/base32 614354718d 007/103: Make totp-generate-otp understand secret structs and base32 strings
Date: Sat, 10 Feb 2024 12:59:52 -0500 (EST)

branch: elpa/base32
commit 614354718d1d171c19f6438899c1024d9a83185a
Author: Vivek Das Mohapatra <vivek@collabora.co.uk>
Commit: Vivek Das Mohapatra <vivek@collabora.co.uk>

    Make totp-generate-otp understand secret structs and base32 strings
---
 totp.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/totp.el b/totp.el
index 9015606b6c..b2a39095de 100644
--- a/totp.el
+++ b/totp.el
@@ -339,13 +339,15 @@ with the highest bit forced to 0 (ie a 31 bit integer)."
 
 (defun totp-generate-otp (secret &optional digits offset chunk algo)
   "Given:
-  a string SECRET
+  a string (or `totp-unwrap-otp-blob' struct) SECRET
   a TOTP length DIGITS (default 6)
   an integer time skew OFFSET (default 0)
   a time slice size CHUNK (default 30)
 Return (TOTP TTL EXPIRY) where TOTP is the time-based one time password,
 TTL is the number of seconds the password is good for at the time of generation
 and EXPIRY is the seconds after the epoch when the TOTP expires."
+  (if (listp secret)
+      (setq secret (cdr (assq :secret secret))))
   (let ((digits     (or digits   6))
         (offset     (or offset   0))
         (chunk      (or chunk   30))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]