Coverage report: /home/ellis/comp/core/lib/cry/tests.lisp
Kind | Covered | All | % |
expression | 0 | 14 | 0.0 |
branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
(cl:defpackage :cry/tests
3
:cry :cry/hotp :cry/totp :cry/crc64
4
:cry/jwt :cry/b3 :cry/keyring :cry/authinfo
5
:cry/password :cry/drm :cry/ssl)
6
(:shadowing-import-from :rt :random-bytes))
8
(in-package :cry/tests)
13
(keyutils:load-keyutils)
16
(is (integerp (hotp "1234" 100))))
19
(is (integerp (totp "1234"))))
23
(is (integerp (crc64-sequence "aaaaaaaaaaaaaaaaaaaaaaa"))))
28
(b3hash-string "1234")
29
(b3hash-string "1234")))
32
;; https://jwt.io/#debugger-io
33
(multiple-value-bind (claims header)
34
(cry/jwt:jwt-decode "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" :secret "your-256-bit-secret")
35
(istype 'dat/json:json-object claims)
36
(istype 'dat/json:json-object header)))
39
(let ((kr (make-keyring :user)))
41
(iszero (clear-keys kr))))
43
(defvar *test-authinfo* "machine foo login bar port abc password hackme")
46
(when-let ((f (probe-file "~/.authinfo")))
47
(istype 'authinfo (deserialize f :authinfo)))
48
(deserialize *test-authinfo* :authinfo))
51
(let ((secret "hackme")
52
(salt (sb-ext:string-to-octets "pepper")))
53
(istype 'string (make-password-hash secret salt))
54
(let ((pw (make-instance 'password :password secret)))
56
(is (auth pw secret)))))