Liking cljdoc? Tell your friends :D

clj-totp - Google Authenticator

An unopinionated library for generating and validating TOTP with Google Authenticator.


Add the following to your dependencies:

[clj-totp "0.1.0"]

And import the following namespace

(:import [clj-totp.core :as totp])
(totp/generate-key "Tejas Dinkar" "") ; => {:secret-key "J5H6AG3ZANCKLTBK", :qr-code-url "", :scratch-codes [89711635 26333477 46096035 19284027 63627698]}

(comment "somehow persist the secret-key, and scan the qr-code-url with google authenticator")

(totp/valid-code? "J5H6AG3ZANCKLTBK" 850602 1482538483070) ; => true (params: secret-key, password, time (optional))
(totp/valid-code? "J5H6AG3ZANCKLTBK" 000000) ; => false


Copyright © 2016 Tejas Dinkar

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close