MojoAuth is a set of standard approaches to cross-app authentication based on Hash-based Message Authentication Codes (HMAC), inspired by "A REST API For Access To TURN Services".
- rebar
- make
Simply run make
.
% Generate a shared secret
2> Secret = mojoauth:create_secret().
<<"eN1lvHK7cXPYFNwmEwZ3QNMAiCC651E5ikuEOj7+k4EMYTXb3XxXo3iBw4ScxqzJ+aH6aDCCe++LPVGRjgfl3Q==">>
% Create temporary credentials
3> Credentials = mojoauth:create_credentials({id, "foobar"}, {secret, Secret}).
[{username,"1412629132:foobar"},
{password,<<"Q1RegXu0oYtm1UYqxRkegilugeM=">>}]
% Test credentials
4> mojoauth:test_credentials([{username, "1412629132:foobar"}, {password,<<"Q1RegXu0oYtm1UYqxRkegilugeM=">>}], Secret).
{ok,"foobar"}
5> mojoauth:test_credentials([{username, "1412629132:foobar"}, {password,"wrongpassword"}], Secret).
{invalid}
% 1 day later
6> mojoauth:test_credentials([{username, "1412629132:foobar"}, {password,<<"Q1RegXu0oYtm1UYqxRkegilugeM=">>}], Secret).
{expired}
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request