Created
June 23, 2015 00:43
-
-
Save chrismccord/b662bd26f68fa10b6651 to your computer and use it in GitHub Desktop.
erlpass wrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.Password do | |
@moduledoc """ | |
Handles password authentication, encryption, and decryption | |
""" | |
@doc """ | |
Encrypte the password String | |
""" | |
def encrypt(raw_password) do | |
:erlpass.hash(raw_password) | |
end | |
@doc """ | |
Checks if the provided password matches the user's encrypted password | |
""" | |
def matches?(encrypted_password, provided_password) do | |
:erlpass.match(provided_password, encrypted_password) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment