Lti_1p3 (Lti 1p3 v0.10.0)

Link to this section Summary

Functions

Clears all cached keys in the key provider.

Creates a new jwk.

Gets the currently active Jwk. If there are more that one active Jwk, this will return the first one it finds

Gets a all public keys.

Gets a public key from the key provider cache.

Gets information about the key provider cache.

Preloads keys from the given key set URL into the key provider cache.

Refreshes all cached keys in the key provider.

Link to this section Functions

Link to this function

clear_key_cache()

Clears all cached keys in the key provider.

This is mainly useful for testing.

examples

Examples

iex> clear_key_cache()
:ok
Link to this function

create_jwk(jwk)

Creates a new jwk.

examples

Examples

iex> create_jwk(%Jwk{})
{:ok, %Jwk{}}
iex> create_jwk(%Jwk{})
{:error, %Lti_1p3.DataProviderError{}}
Link to this function

get_active_jwk()

Gets the currently active Jwk. If there are more that one active Jwk, this will return the first one it finds

examples

Examples

iex> get_active_jwk()
{:ok, %Lti_1p3.Jwk{}}
iex> get_active_jwk()
{:error, %Lti_1p3.DataProviderError{}}
Link to this function

get_all_public_keys()

Gets a all public keys.

examples

Examples

iex> get_all_public_keys()
%{keys: []}
Link to this function

get_public_key(key_set_url, kid)

Gets a public key from the key provider cache.

examples

Examples

iex> get_public_key("https://platform.example.edu/.well-known/jwks.json", "key-123")
{:ok, %JOSE.JWK{}}
iex> get_public_key("https://platform.example.edu/.well-known/jwks.json", "not-found")
{:error, %{reason: :key_not_found, msg: "..."}}
Link to this function

key_cache_info()

Gets information about the key provider cache.

examples

Examples

iex> key_cache_info()
%{
  cached_urls: ["https://platform.example.edu/.well-known/jwks.json"],
  cache_entries_count: 1,
  total_cached_keys: 3,
  cache_hits: 42,
  cache_misses: 5,
  refresh_errors: 0,
  hit_rate: 89.36
}
Link to this function

preload_keys(key_set_url)

Preloads keys from the given key set URL into the key provider cache.

This is useful for warming up the cache before LTI launches.

examples

Examples

iex> preload_keys("https://platform.example.edu/.well-known/jwks.json")
:ok
iex> preload_keys("https://invalid-url")
{:error, %{reason: :http_error, msg: "..."}}
Link to this function

refresh_all_keys()

Refreshes all cached keys in the key provider.

examples

Examples

iex> refresh_all_keys()
[{"https://platform.example.edu/.well-known/jwks.json", :ok}]