Authenticator Assurance Level (AAL) is the measure of the strength of an authentication mechanism.
In Supabase, having an AAL of aal1 refers to having the 1st factor of authentication such as an email and password or OAuth sign-in while aal2 refers to the 2nd factor of authentication such as a time-based, one-time-password (TOTP).
If the user has a verified factor, the next field will return AuthenticatorAssuranceLevel.AAL2, else, it will return AuthenticatorAssuranceLevel.AAL1.
Examples
Get the AAL details of the current session
val (current, next) = supabase.auth.mfa.getAuthenticatorAssuranceLevel()
Check whether the user has at least one verified factor
val enabled = supabase.auth.mfa.isMfaEnabled
//flow variant, automatically emitting new values on session changes
val enabledFlow = supabase.auth.mfa.isMfaEnabledFlow
Check whether the user is logged in using AAL2
val loggedInUsingMfa = supabase.auth.mfa.loggedInUsingMfa
//flow variant, automatically emitting new values on session changes
val loggedInUsingMfaFlow = supabase.auth.mfa.loggedInUsingMfaFlow