Skip to content

Latest commit

 

History

History
34 lines (31 loc) · 1.3 KB

README.md

File metadata and controls

34 lines (31 loc) · 1.3 KB

Build Status

Google Authenticator URI constructor

Example:

1> rr(google_authenticator_uri).
[google_authenticator_uri_params]
2>
2> ParamsTOTP = #google_authenticator_uri_params
2>     { type         = totp
2>     , account_name = <<"[email protected]">>
2>     , secret       = <<"allDudesGoBowling">>
2>     , issuer       = {some, <<"TheBigLebowski">>}
2>     },
2> UriTOTP = google_authenticator_uri:cons(ParamsTOTP),
2> io:format("~p~n", [UriTOTP]).
<<"otpauth://totp/TheBigLebowski:[email protected]?secret=MFWGYRDVMRSXGR3PIJXXO3DJNZTQ%3D%3D%3D%3D&issuer=TheBigLebowski&algorithm=SHA1&digits=6&period=30">>
ok
3>
3> ParamsHOTP = #google_authenticator_uri_params
3>     { type         = {hotp, {counter, 0}}
3>     , account_name = <<"[email protected]">>
3>     , secret       = <<"allDudesGoBowling">>
3>     , issuer       = {some, <<"TheBigLebowski">>}
3>     },
3> UriHOTP = google_authenticator_uri:cons(ParamsHOTP),
3> io:format("~p~n", [UriHOTP]).
<<"otpauth://hotp/TheBigLebowski:[email protected]?secret=MFWGYRDVMRSXGR3PIJXXO3DJNZTQ%3D%3D%3D%3D&issuer=TheBigLebowski&algorithm=SHA1&digits=6&counter=0">>
ok
4>