Refactoring of Users context

This commit is contained in:
miffy
2019-09-07 19:54:11 +02:00
parent d0c9974558
commit f316f0a940
14 changed files with 421 additions and 543 deletions

15
lib/mobilizon/crypto.ex Normal file
View 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