Settings of personal API keys (PhoenixKit.API.Keys.create_personal_key/3): how long
one may live and how many a person may have.
| Setting | Default | Allowed |
|---|---|---|
api_personal_key_max_days | 90 | 1 to 365 |
api_personal_key_max_count | 5 | 1 to 50 |
api_personal_key_max_days is both the ceiling of a personal key's expiry and the
expiry the "My API keys" form proposes and a rotation gives the new key: the end of the
UTC day that many days from today (latest_expiry/0). Lowering it does not shorten
keys already issued. api_personal_key_max_count counts a person's live personal keys,
a key in the grace period of a rotation included.
A stored value that does not parse or is below its minimum reads as the default; one
above its maximum reads as the maximum. A Settings read error reads as the default
(PhoenixKit.API.Config.int/2).
The same table drives the form on Settings -> API: fields/0, current/0,
validate/1 and save/2, all or nothing like PhoenixKit.API.FlowConfig's.
Summary
Functions
The current value of every form field, as the text the field shows.
The two fields of the form, in the order the page shows them.
The latest expiry a personal key may have now: the end of the UTC day max_days/0
days from today, as the form's dates are read.
Live personal keys one person may have (api_personal_key_max_count).
Days a personal key may live at most (api_personal_key_max_days).
Validates and writes a form. Returns the settings that changed. opts are the
history options of Settings.update_setting_with_module/4 (actor_uuid:,
source:).
Checks a submitted form. {:ok, [{setting, integer}]} when every field is a whole
number inside its range; otherwise {:error, fields} naming every bad field
(a missing field is bad, never the default).
Functions
The current value of every form field, as the text the field shows.
@spec fields() :: [map()]
The two fields of the form, in the order the page shows them.
@spec latest_expiry() :: DateTime.t()
The latest expiry a personal key may have now: the end of the UTC day max_days/0
days from today, as the form's dates are read.
@spec max_count() :: pos_integer()
Live personal keys one person may have (api_personal_key_max_count).
@spec max_days() :: pos_integer()
Days a personal key may live at most (api_personal_key_max_days).
Validates and writes a form. Returns the settings that changed. opts are the
history options of Settings.update_setting_with_module/4 (actor_uuid:,
source:).
Checks a submitted form. {:ok, [{setting, integer}]} when every field is a whole
number inside its range; otherwise {:error, fields} naming every bad field
(a missing field is bad, never the default).