Coverage report: /home/ellis/comp/core/lib/cry/totp.lisp

KindCoveredAll%
expression612 50.0
branch00nil
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
2
 
3
 ;; see https://github.com/bhyde/cl-one-time-passwords/totp.lisp
4
 
5
 ;; RFC 6238
6
 
7
 ;;; Code:
8
 (in-package :cry/totp)
9
 
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)
13
   ;; --> 2208988800
14
 
15
 (defvar *time-zero* 0) ; aka the unix epoch zero
16
 (defvar *time-step-in-seconds* 30)
17
 
18
 (defmacro time-step (unix-time)
19
   `(floor (- ,unix-time *time-zero*) *time-step-in-seconds*))
20
 
21
 (defun totp (key-hexstring &optional (offset 0) (time (- (get-universal-time) .unix-epoch-zero. offset)))
22
   (hotp key-hexstring (time-step time)))