View Source Appwrite.Consts.AuthenticationType (appwrite v0.1.9)
Provides constants and validation functions for different types of authenticators.
This module defines allowed authenticator types and provides helper functions to validate them. It is useful for ensuring that only recognized authenticator types are used within the application.
Summary
Functions
Returns true
if the given type
is a valid authenticator type, otherwise false
.
Guard clause to check if a given type is a valid authenticator type.
Validates the given type
and returns {:ok, type}
if it is valid,
or {:error, "Invalid authenticator type"}
otherwise.
Validates the given type
and returns it if it is valid. Raises an
ArgumentError
if the type
is invalid.
Functions
Returns true
if the given type
is a valid authenticator type, otherwise false
.
Examples
iex> AuthenticatorType.is_valid_type?("totp")
true
iex> AuthenticatorType.is_valid_type?("unknown")
false
Guard clause to check if a given type is a valid authenticator type.
Examples
iex> AuthenticatorType.valid_type("totp")
true
iex> AuthenticatorType.valid_type("unknown")
false
Validates the given type
and returns {:ok, type}
if it is valid,
or {:error, "Invalid authenticator type"}
otherwise.
Examples
iex> AuthenticatorType.validate_type("totp")
{:ok, "totp"}
iex> AuthenticatorType.validate_type("unknown")
{:error, "Invalid authenticator type"}
Validates the given type
and returns it if it is valid. Raises an
ArgumentError
if the type
is invalid.
Examples
iex> AuthenticatorType.validate_type!("totp")
"totp"
iex> AuthenticatorType.validate_type!("unknown")
** (ArgumentError) Invalid authenticator type: "unknown"