Lti_1p3.DataProvider behaviour (Lti 1p3 v0.6.0)
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{})
@callback 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
Examples
iex> create_jwk(%Jwk{})
{:ok, %Jwk{}}
iex> create_jwk(%Jwk{})
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback
create_nonce(%Lti_1p3.Nonce{})
@callback 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
Examples
iex> create_nonce(%Nonce{})
{:ok, %Nonce{}}
iex> create_nonce(%Nonce{})
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback
delete_expired_nonces(arg1)
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
Examples
iex> delete_expired_nonces(ttl_sec)
Link to this callback
get_active_jwk()
@callback 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
Examples
iex> get_active_jwk()
{:ok, %Jwk{}}
iex> get_active_jwk()
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback
get_all_jwks()
@callback 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
Examples
iex> get_all_jwks()
[%Jwk{}]
Link to this callback
get_nonce(t, arg2)
@callback 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
Examples
iex> get_nonce(value, domain)
%Nonce{}
iex> get_nonce(value, domain)
nil