AuthAPI defines an extensible API for interacting with authentication. It provides the most common authentication commands that applications need, and leaves room for implementations to extend the set of commands to cater for variations in the behaviour of authentication services.
In particular the Status type defines a Challenged state which has a chal
type variable, but there are no commands for answering challenges. Some
implementations that do not have challenges will use the Never type for this,
and other implementations with support for things such as 2-factor authentication
will supply an appropriate challenge type and commands to answer challenges.
Username and password credentials.
The visible status of the authentication model.
The extensible authentication API.
This is presented as functions in an extensible record. The reason for this slightly unusual presentation is that it allows a type to be defined for the whole API, with all the parts that are variable amongst implementations presented as type variables.
This allows multiple implementations of this API to be written that all conform to a common pattern. This standardizes how authentcation is handled in applications.