   def test_credentials([username: username, password: password], secret, timestamp \\ now |> Date.convert(:secs)) do
     case sign(username, secret) do
       ^password ->
-        [expiry, id] = String.split(username, @username_separator)
-        {status(expiry, timestamp), (if id == "", do: nil, else: id)}
+        [expiry, id] = username_elements(username)
+        {status(String.to_integer(expiry), timestamp), id}
       _ ->
         {:invalid}
     end

    Date.now |> Date.universal
  end

  defp status(expiry, timestamp) do
    case String.to_integer(expiry) > timestamp do
      true -> :ok
      false -> :expired
    end
  end
end


  @doc "Create a new set of credentials for an asserted ID, given a desired TTL and shared secret"
  def create_credentials(id: id, secret: secret) do
    username = new_username(id)
    [username: username, password: sign(username, secret)]
  end
  def create_credentials(secret: secret) do
