Lti_1p3.DataProvider behaviour (Lti 1p3 v0.3.2)
Link to this section Summary
Callbacks
Creates a new jwk.
Creates a new nonce.
Deletes all expired nonces older than the provided ttl_sec. If no ttl_sec is provided, the default value should be 86_400 seconds (1 day).
Gets the active jwk. If there are more than one, this should return the latest.
Gets a list of all jwks.
Gets a nonce with the given value and optional domain.
Link to this section Callbacks
Link to this callback
create_jwk(%Lti_1p3.Jwk{})
Specs
create_jwk(%Lti_1p3.Jwk{
active: term(),
alg: term(),
id: term(),
kid: term(),
pem: term(),
typ: term()
}) ::
{:ok,
%Lti_1p3.Jwk{
active: term(),
alg: term(),
id: term(),
kid: term(),
pem: term(),
typ: term()
}}
| {:error, Lti_1p3.DataProviderError.t()}
Creates a new jwk.
Examples
iex> create_jwk(%Jwk{})
{:ok, %Jwk{}}
iex> create_jwk(%Jwk{})
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback
create_nonce(%Lti_1p3.Nonce{})
Specs
create_nonce(%Lti_1p3.Nonce{domain: term(), id: term(), value: term()}) ::
{:ok, %Lti_1p3.Nonce{domain: term(), id: term(), value: term()}}
| {:error, Lti_1p3.DataProviderError.t()}
Creates a new nonce.
Examples
iex> create_nonce(%Nonce{})
{:ok, %Nonce{}}
iex> create_nonce(%Nonce{})
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback
delete_expired_nonces(arg1)
Specs
Deletes all expired nonces older than the provided ttl_sec. If no ttl_sec is provided, the default value should be 86_400 seconds (1 day).
Examples
iex> delete_expired_nonces(ttl_sec)
Link to this callback
get_active_jwk()
Specs
get_active_jwk() ::
{:ok,
%Lti_1p3.Jwk{
active: term(),
alg: term(),
id: term(),
kid: term(),
pem: term(),
typ: term()
}}
| {:error, Lti_1p3.DataProviderError.t()}
Gets the active jwk. If there are more than one, this should return the latest.
Examples
iex> get_active_jwk()
{:ok, %Jwk{}}
iex> get_active_jwk()
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback
get_all_jwks()
Specs
get_all_jwks() :: [
%Lti_1p3.Jwk{
active: term(),
alg: term(),
id: term(),
kid: term(),
pem: term(),
typ: term()
}
]
Gets a list of all jwks.
Examples
iex> get_all_jwks()
[%Jwk{}]
Link to this callback
get_nonce(arg1, arg2)
Specs
get_nonce(String.t(), String.t() | nil) :: %Lti_1p3.Nonce{domain: term(), id: term(), value: term()} | nil
Gets a nonce with the given value and optional domain.
Examples
iex> get_nonce(value, domain)
%Nonce{}
iex> get_nonce(value, domain)
nil