Skip to content

Commit a534d26

Browse files
committed
Put period in token
1 parent 3a041ad commit a534d26

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/qrcode_demo.erl

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@
4444
-compile(export_all).
4545

4646
-define(TTY(Term), io:format(user, "[~p] ~p~n", [?MODULE, Term])).
47+
-define(PERIOD, 30).
4748

4849
run() ->
4950
Passcode = crypto:sha(<<"password">>),
50-
run(<<"demo@mydomain.com">>, Passcode, 60).
51+
run(<<"demo@mydomain.com">>, Passcode, ?PERIOD).
5152

5253
run(Domain, Passcode, Seconds) ->
5354
PasscodeBase32 = base32:encode(Passcode),
@@ -100,7 +101,7 @@ get_pixels0(<<>>, Acc) ->
100101
%%
101102
totp() ->
102103
Key = crypto:sha(<<"password">>),
103-
totp(Key, 30).
104+
totp(Key, ?PERIOD).
104105
totp(Key, Period) ->
105106
T = unow() div Period,
106107
{hotp(Key, T - 1), hotp(Key, T), hotp(Key, T + 1)}.

0 commit comments

Comments
 (0)