Coverage report: /home/ellis/comp/core/lib/cry/totp.lisp
Kind | Covered | All | % |
expression | 6 | 12 | 50.0 |
branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; crypto/totp.lisp --- Time-Based One-Time Passwords
3
;; see https://github.com/bhyde/cl-one-time-passwords/totp.lisp
10
(defconstant .unix-epoch-zero. 2208988800)
11
;; 00:00:00 UTC on 1 January 1970
12
;; (encode-universal-time 0 0 0 1 1 1970 0)
15
(defvar *time-zero* 0) ; aka the unix epoch zero
16
(defvar *time-step-in-seconds* 30)
18
(defmacro time-step (unix-time)
19
`(floor (- ,unix-time *time-zero*) *time-step-in-seconds*))
21
(defun totp (key-hexstring &optional (offset 0) (time (- (get-universal-time) .unix-epoch-zero. offset)))
22
(hotp key-hexstring (time-step time)))