   end
 
   @doc false
+  @spec keys :: {String.t(), String.t()}
   defp keys() do
     secret_key_base = Drab.Config.app_config(:secret_key_base)
     secret = KeyGenerator.generate(secret_key_base, "Drab.Live.Crypto salt")

    {secret, sign_secret}
  end

  defp now_ms(), do: System.system_time(:millisecond)

  @doc false
  def hash(term) do
    term
    |> :erlang.phash2(4_294_967_296)

  end

  @doc false
  @spec encrypt(term) :: String.t()
  def encrypt(term) do
    {secret, sign_secret} = keys()
    MessageEncryptor.encrypt(:erlang.term_to_binary(term), secret, sign_secret)
  end

  @doc false
  @spec decrypt(String.t()) :: term
  def decrypt(crypted) do
    {secret, sign_secret} = keys()
    {:ok, decrypted} = MessageEncryptor.decrypt(crypted, secret, sign_secret)
