Refactoring of Users context
This commit is contained in:
15
lib/mobilizon/crypto.ex
Normal file
15
lib/mobilizon/crypto.ex
Normal file
@@ -0,0 +1,15 @@
|
||||
defmodule Mobilizon.Crypto do
|
||||
@moduledoc """
|
||||
Utility module which contains cryptography related functions.
|
||||
"""
|
||||
|
||||
@doc """
|
||||
Returns random byte sequence of the length encoded to Base64.
|
||||
"""
|
||||
@spec random_string(integer) :: String.t()
|
||||
def random_string(length) do
|
||||
length
|
||||
|> :crypto.strong_rand_bytes()
|
||||
|> Base.url_encode64()
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user