View Source How To Upgrade From 0.8.x to 0.9.x

Cloak 0.9.0 encrypts and decrypts data up to 200% faster than 0.8.0. This result is achieved by caching configuration data in an ETS table.

  • Breaking Change: You must now add your Cloak.Vault to your supervision tree.

Update Your Dependency

Update your cloak dependency to 0.9.0 or higher:

{:cloak, "~> 0.9.2"}

Supervise Your Vault

Add your vault to your supervision tree:

children = [
  MyApp.Vault
]

Update init/1 callback implementation

If you are fetching the keys from system vars, you should change the implementation of the init/1 callback to GenServer.init/1

defmodule MyApp.Vault do
  use Cloak.Vault, otp_app: :my_app

  @impl GenServer
  def init(config) do
    (...)
  end
end