DeviceCheck.TokenCache (device_check v0.3.0)

Copy Markdown View Source

Caches the DeviceCheck token so we don't sign a new JWT on every call.

The cache is keyed by application env config. Pass per-call opts to bypass it. Tokens are refreshed automatically when they're within @refresh_buffer_seconds of expiry.

Summary

Functions

Returns a specification to start this module under a supervisor.

Clear the cached token, forcing a new token on next fetch.

Fetch a cached token, generating a new one if expired or not present.

Start the token cache GenServer.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear(server \\ __MODULE__)

Clear the cached token, forcing a new token on next fetch.

fetch(server \\ __MODULE__)

Fetch a cached token, generating a new one if expired or not present.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Start the token cache GenServer.