Astarte.Device.CredentialStorage behaviour (astarte_device v1.0.1)

User defined credential storage.

Astarte.Device.CredentialStorage defines a behaviour that can be given to an Astarte.Device. This allows the user to specify how device credentials are stored.

Link to this section Summary

Types

Supported credential keys. You can pattern match on these if you want to store them each in a different way.

Callbacks

Fetch the specified credential from the credential storage.

Save the specified credential to the credential storage.

Link to this section Types

Link to this type

credential()

Specs

credential() :: :private_key | :csr | :certificate

Supported credential keys. You can pattern match on these if you want to store them each in a different way.

Link to this section Callbacks

Link to this callback

fetch(key, state)

Specs

fetch(key :: credential(), state :: term()) ::
  {:ok, credential :: String.t()} | :error

Fetch the specified credential from the credential storage.

Specs

init(args :: term()) :: {:ok, state :: term()}
Link to this callback

save(key, value, state)

Specs

save(key :: credential(), value :: String.t(), state :: term()) ::
  {:ok, new_state :: term()} | {:error, reason :: term()}

Save the specified credential to the credential storage.