Packages
electric_client
0.1.2
0.10.3
0.10.2
0.10.1
0.10.1-beta-1
0.10.0
0.9.5-beta-1
0.9.4
0.9.4-beta-1
0.9.3
0.9.2
0.9.1
0.9.0
0.8.3
0.8.3-beta-1
0.8.2
0.8.1
0.8.0
0.8.0-beta-1
0.7.3
0.7.2
0.7.1
0.7.0
0.6.5
0.6.5-beta-5
0.6.5-beta-4
0.6.5-beta-3
0.6.5-beta-2
0.6.5-beta-1
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.0
0.5.0-beta-1
0.4.1
0.4.0
0.3.2
0.3.1
0.3.0
0.3.0-beta.4
0.3.0-beta.3
0.3.0-beta.2
0.2.6-pre-1
retired
0.2.6-beta.1
0.2.6-beta.0
0.2.5
0.2.4
0.2.4-pre-8
0.2.4-pre-7
0.2.4-pre-6
0.2.4-pre-5
0.2.4-pre-4
0.2.4-pre-3
0.2.4-pre-2
0.2.4-pre-1
0.2.3
0.2.3-rc-1
0.2.2
0.2.2-rc-1
0.2.1
0.2.1-rc-3
0.2.1-rc-2
0.2.1-rc-1
0.2.0
0.1.2
0.1.1
0.1.0
0.1.0-dev-9
0.1.0-dev-8
0.1.0-dev-7
0.1.0-dev-6
0.1.0-dev-5
0.1.0-dev-4
0.1.0-dev-3
0.1.0-dev-2
0.1.0-dev-17
0.1.0-dev-16
0.1.0-dev-15
0.1.0-dev-14
0.1.0-dev-13
0.1.0-dev-12
0.1.0-dev-11
0.1.0-dev-10
0.1.0-dev
Elixir client for ElectricSQL
Current section
Files
Jump to
Current section
Files
lib/electric/client/authenticator.ex
defmodule Electric.Client.Authenticator do
@moduledoc """
Behaviour to authenticate a `Electric.Client.Fetch.Request`.
The assumption here is that authentication is per
[`ShapeDefinition`](`Electric.Client.ShapeDefinition`) not per request.
"""
alias Electric.Client.Fetch.Request
alias Electric.Client.ShapeDefinition
@type headers :: Request.headers()
@doc """
Update the given `Request` struct with authentication headers.
Independent of the actual authentication mechanism, implementations of this
Behaviour **MUST** set the `authenticated` field in the `Request` to `true`.
"""
@callback authenticate_request(Request.t(), config :: term()) :: Request.authenticated()
@doc "Get authentication headers for the given ShapeDefinition"
@callback authenticate_shape(ShapeDefinition.t(), config :: term()) :: headers()
end