 
   @spec decode(String.t, payload) :: { status, map | String.t }
   def decode(jwt, claims \\ %{}) do
-    secret_key =  Application.get_env(:joken, :secret_key)
     json_module = Application.get_env(:joken, :json_module)
     algorithm =   Application.get_env(:joken, :algorithm, :HS256)
 
     Token.decode(secret_key, json_module, jwt, algorithm, claims)
   end
-  
-end+
+  defp secret_key do
+    secret_key = Application.get_env(:joken, :secret_key)
+
+    if Application.get_env(:joken, :decode_secret_key?, false) do
+      Utils.base64url_decode(secret_key)
+    else
+      secret_key
+    end
+  end
+end

defmodule Joken do
  alias Joken.Token

  @type algorithm :: :HS256 | :HS384 | :HS512
  @type status :: :ok | :error


  @spec encode(payload, payload) :: { status, String.t }
  def encode(payload, claims \\ %{}) do
    json_module = Application.get_env(:joken, :json_module)
    algorithm =   Application.get_env(:joken, :algorithm, :HS256)

