HOTP

Index

hotp/check hotp/generate hotp/new

Reference

hotp/checkcfunction
(hotp/check hotp-obj code counter &opt resync-range)

Check if provided `code` is the correct code for `counter`. If omitted, the default value for `resync-range` is 0. If `resync-range` is greater than zero, HOTP also checks up to `resync-range` following `counter` values.
Returns a tuple of (boolean number) where the boolean indicates if the code was valid, and the number indicates the next counter value that should be used. If the `code` did not verify, the next counter value is always identical to the counter that was passed in. If the `code` did verify and `resync-range` was zero, then the next counter will always be counter+1.

hotp/generatecfunction
(hotp/generate hotp-obj counter)

Generate an HOTP code for the provided `counter`.

hotp/newcfunction
(hotp/new key &opt hash digits)

Instantiate a new HOTP instance with the given parameters. If omitted, the default value for `hash` is "SHA-1" and the default value for `digits` is 6. Returns `htop-obj`.