analytics / lib /plausible /auth /totp /fallback_vault.ex
Leon4gr45's picture
Upload folder using huggingface_hub
3e21b19 verified
Raw
History Blame Contribute Delete
511 Bytes
defmodule Plausible.Auth.TOTP.FallbackVault do
@moduledoc """
Provides a fallback vault that will be used to encrypt/decrypt the TOTP
secrets of users who enable it in case the primary vault fails.
"""
use Cloak.Vault, otp_app: :plausible
@impl GenServer
def init(config) do
{key, config} = Keyword.pop!(config, :key)
config =
Keyword.put(config, :ciphers,
default: {Cloak.Ciphers.AES.GCM, tag: "AES.GCM.V1", iv_length: 12, key: key}
)
{:ok, config}
end
end