Popularity
0.6
Stable
Activity
0.0
Stable
2
1
0

Description

Flexible password policies for Elixir.

Monthly Downloads: 38
Programming language: Elixir
License: MIT License
Latest version: v1.1.1

Password alternatives and similar packages

Based on the "Security" category

Do you think we are missing an alternative of Password or a related project?

Add another 'Security' Package

README

Password hex.pm hexdocs.pm

Flexible password policies for Elixir.

Comes with a built-in data set with the most widely used passwords (~400K records) from Mark Burnett / xato.net.

Installation

Add to your mix.exs:

def deps do
  [
    {:password, "~> 1.0"}
  ]
end

If you're not using application inference, then add :password to your applications list.

Usage

Create a new file and define a module like so:

defmodule MyApp.Password do
  use Password, [
    # Policies
  ]

end

The empty list is where password policies go. For example:

defmodule MyApp.Password do
  use Password, [
    {Password.Policy.SpecialCharacters}
  ]

end

To run the policies agains an input, use the validate/1 function:

iex> MyApp.Password.validate("password")
{:error, [Password.Policy.SpecialCharacters]}

iex> MyApp.Password.validate("password$")
:ok

To learn more about the included password policies and how to configure them, see below.

Password policies

Password's Policy modules are essentially middleware that you can plug in or extend to create your own. At moment, the current modules are included:

Check documentation on hexdocs.

To create your own password policies, simply create a module that implements the Password.Policy behaviour and provide the validate/2 function. See source of included modules as an example.

About

This project is sponsored by Heresy. We're always looking for great engineers to join our team, so if you love Elixir, open source and enjoy some challenge, drop us a line and say hello!

License

  • Password: See LICENSE file.
  • "Heresy" name and logo: Copyright © 2019 Heresy Software Ltd


*Note that all licence references and agreements mentioned in the Password README section above are relevant to that project's source code only.