mirror of
https://github.com/hanskokx/arcane_framework.git
synced 2026-05-14 10:29:06 +02:00
v1.1.0
Breaking changes: - (ArcaneAuthInterface) Migrated `loginWithEmailAndPassword` to `login` - (ArcaneAuthInterface) Migrated `signup` to `register` Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -14,13 +14,13 @@ abstract class ArcaneAuthInterface {
|
||||
///
|
||||
/// This is used to retrieve the current session's access token for authenticated
|
||||
/// API requests. Returns `null` if the user is not signed in or the token is unavailable.
|
||||
Future<String?> get accessToken;
|
||||
Future<String?>? get accessToken;
|
||||
|
||||
/// Returns the refresh token if available.
|
||||
///
|
||||
/// The refresh token is used to renew access tokens when they expire. Returns `null` if
|
||||
/// the user is not signed in or the token is unavailable.
|
||||
Future<String?> get refreshToken;
|
||||
Future<String?>? get refreshToken;
|
||||
|
||||
/// Initializes the authentication interface.
|
||||
///
|
||||
@@ -34,24 +34,6 @@ abstract class ArcaneAuthInterface {
|
||||
/// Returns a `Result` that either contains a `void` on success or an error message.
|
||||
Future<Result<void, String>> logout();
|
||||
|
||||
/// Logs the user in using an email address and password.
|
||||
///
|
||||
/// This method authenticates the user with their email and password credentials.
|
||||
/// Returns a `Result` that either contains a `void` on success or an error message.
|
||||
///
|
||||
/// Example:
|
||||
/// ```dart
|
||||
/// await authInterface.loginWithEmailAndPassword(
|
||||
/// email: "user@example.com",
|
||||
/// password: "password123",
|
||||
/// );
|
||||
/// ```
|
||||
@Deprecated("Use `login` instead. Deprecated as of version 1.0.5")
|
||||
Future<Result<void, String>> loginWithEmailAndPassword({
|
||||
required String email,
|
||||
required String password,
|
||||
});
|
||||
|
||||
/// Logs the user in using an optional, generic `T` type of input.
|
||||
/// This login method is a generic method that can be used to login with any
|
||||
/// type of input. It is useful for login methods that do not require an email
|
||||
@@ -78,32 +60,29 @@ abstract class ArcaneAuthInterface {
|
||||
/// This method is typically used when the user hasn't received or has lost their initial
|
||||
/// verification code. Returns a `Result` that contains the verification code on success
|
||||
/// or an error message.
|
||||
Future<Result<String, String>> resendVerificationCode(
|
||||
Future<Result<String, String>>? resendVerificationCode(
|
||||
String email,
|
||||
);
|
||||
|
||||
/// Signs a user up with a username, password, and email.
|
||||
/// Registers a new account using user-supplied input.
|
||||
///
|
||||
/// This method registers a new user in the system. Returns a `Result` that contains
|
||||
/// the next [SignUpStep] in the process on success or an error message.
|
||||
///
|
||||
/// Example:
|
||||
/// ```dart
|
||||
/// await authInterface.signup(
|
||||
/// await authInterface.register(
|
||||
/// email: "user@example.com",
|
||||
/// password: "password123",
|
||||
/// );
|
||||
/// ```
|
||||
Future<Result<SignUpStep, String>> signup({
|
||||
required String password,
|
||||
required String email,
|
||||
});
|
||||
Future<Result<SignUpStep, String>>? register<T>({T? input});
|
||||
|
||||
/// Confirms a user's signup using a username and a confirmation code.
|
||||
///
|
||||
/// This method completes the sign-up process by verifying the user's confirmation code.
|
||||
/// Returns a `Result` that contains `true` on success or an error message.
|
||||
Future<Result<bool, String>> confirmSignup({
|
||||
Future<Result<bool, String>>? confirmSignup({
|
||||
required String username,
|
||||
required String confirmationCode,
|
||||
});
|
||||
@@ -113,7 +92,12 @@ abstract class ArcaneAuthInterface {
|
||||
/// This method is used when a user requests to reset their password. The reset code
|
||||
/// they receive via email is used to verify the request. Optionally, a new password can
|
||||
/// be provided. Returns a `Result` that contains `true` on success or an error message.
|
||||
Future<Result<bool, String>> resetPassword({
|
||||
///
|
||||
/// This method may be called twice. In the first instance, the `email` is provided, which
|
||||
/// triggers a password reset confirmation email to be sent, containing a password reset
|
||||
/// code or pin. The second call should include the `email`, the user's new password
|
||||
/// (`newPassword`), and the `code` they received in their email.
|
||||
Future<Result<bool, String>>? resetPassword({
|
||||
required String email,
|
||||
String? newPassword,
|
||||
String? code,
|
||||
|
||||
Reference in New Issue
Block a user