[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/base32 4595bb3b7c 008/103: Make the returned TOTP token a
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/base32 4595bb3b7c 008/103: Make the returned TOTP token a string so we don't lose leading 0s |
Date: |
Sat, 10 Feb 2024 12:59:52 -0500 (EST) |
branch: elpa/base32
commit 4595bb3b7cdec81f2e4895beedccd1c2813d043c
Author: Vivek Das Mohapatra <vivek@collabora.co.uk>
Commit: Vivek Das Mohapatra <vivek@collabora.co.uk>
Make the returned TOTP token a string so we don't lose leading 0s
---
tests/test-totp.el | 2 +-
totp.el | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/test-totp.el b/tests/test-totp.el
index 979084a71b..64a484dd89 100644
--- a/tests/test-totp.el
+++ b/tests/test-totp.el
@@ -109,7 +109,7 @@
(stamp (format-time-string "%Y-%m-%d %H:%M:%S" totp-override-time t))
have)
(dolist (otp generated-otp)
- (setq have (car otp))
+ (setq have (string-to-number (car otp)))
(or (equal want have)
(error "%s TOTP #%d @%d (%s), %S %d digits did not match: %S vs %S"
label i totp-override-time stamp algorithm digits want have))
diff --git a/totp.el b/totp.el
index b2a39095de..3bd3091f42 100644
--- a/totp.el
+++ b/totp.el
@@ -362,6 +362,8 @@ and EXPIRY is the seconds after the epoch when the TOTP
expires."
msg (totp-hmac-message counter)
hash (hmac secret msg algo)
totp (% (totp-truncate-hash hash) (expt 10 digits)))
+ (let ((fmt (format "%%0%dd" digits)))
+ (setq totp (format fmt totp)))
(list totp ttl expiry)))
(defun totp-display-token (token &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 <=
- [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, 2024/02/10
- [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