From 9f00ed205b0f44fa190e3f8ba8c434af29b6a22c Mon Sep 17 00:00:00 2001 From: Hans Kokx Date: Fri, 11 Oct 2024 14:04:53 +0200 Subject: [PATCH] v1.1.1 Breaking changes: - Updated ArcaneAuthInterface to make the `resendVerificationCode`, `confirmSignup`, and `resetPassword` methods more versatile Signed-off-by: Hans Kokx --- CHANGELOG.md | 12 ++++++++++++ example/lib/interfaces/debug_auth_interface.dart | 12 +++++++----- .../authentication/authentication_interface.dart | 10 ++++------ .../authentication/authentication_service.dart | 2 +- pubspec.yaml | 2 +- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83f441d..7f591d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## 1.1.1 + +- [BREAKING] Updated ArcaneAuthInterface to make the `resendVerificationCode`, `confirmSignup`, and `resetPassword` methods more versatile + +### Migration + +| Class | Migration path | +| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| ArcaneAuthInterface | `resendVerificationCode(String email)` -> `resendVerificationCode({T? input})` | +| ArcaneAuthInterface | `confirmSignup({String email, String password})` -> `confirmSignup({String? email, String? password})` | +| ArcaneAuthInterface | `resetPassword({String email, String? newPassword, String? code})` -> `resetPassword({String? email, String? newPassword, String? code})` | + ## 1.1.0 - [BREAKING] Updated the authentication service and interface to be more versatile diff --git a/example/lib/interfaces/debug_auth_interface.dart b/example/lib/interfaces/debug_auth_interface.dart index 363af27..abebe61 100644 --- a/example/lib/interfaces/debug_auth_interface.dart +++ b/example/lib/interfaces/debug_auth_interface.dart @@ -53,8 +53,10 @@ class DebugAuthInterface implements ArcaneAuthInterface { } @override - Future> resendVerificationCode(String email) async { - Arcane.log("Re-sending verification code to $email"); + Future> resendVerificationCode({ + T? input, + }) async { + Arcane.log("Re-sending verification code to $input"); return Result.ok("Code sent"); } @@ -76,8 +78,8 @@ class DebugAuthInterface implements ArcaneAuthInterface { @override Future> confirmSignup({ - required String username, - required String confirmationCode, + String? username, + String? confirmationCode, }) async { Arcane.log( "Confirming registration for $username with code $confirmationCode", @@ -87,7 +89,7 @@ class DebugAuthInterface implements ArcaneAuthInterface { @override Future> resetPassword({ - required String email, + String? email, String? newPassword, String? code, }) async { diff --git a/lib/src/services/authentication/authentication_interface.dart b/lib/src/services/authentication/authentication_interface.dart index 62d6973..d84d658 100644 --- a/lib/src/services/authentication/authentication_interface.dart +++ b/lib/src/services/authentication/authentication_interface.dart @@ -60,9 +60,7 @@ 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>? resendVerificationCode( - String email, - ); + Future>? resendVerificationCode({T? input}); /// Registers a new account using user-supplied input. /// @@ -83,8 +81,8 @@ abstract class ArcaneAuthInterface { /// 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>? confirmSignup({ - required String username, - required String confirmationCode, + String? username, + String? confirmationCode, }); /// Resets a user's password using an email address and a code. @@ -98,7 +96,7 @@ abstract class ArcaneAuthInterface { /// 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>? resetPassword({ - required String email, + String? email, String? newPassword, String? code, }); diff --git a/lib/src/services/authentication/authentication_service.dart b/lib/src/services/authentication/authentication_service.dart index 4d383bd..73f626c 100644 --- a/lib/src/services/authentication/authentication_service.dart +++ b/lib/src/services/authentication/authentication_service.dart @@ -252,7 +252,7 @@ class ArcaneAuthenticationService extends ArcaneService { } final Future>? result = - authInterface.resendVerificationCode(email); + authInterface.resendVerificationCode(input: email); if (result == null) { return Result.error( diff --git a/pubspec.yaml b/pubspec.yaml index 71c35b5..2693942 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: arcane_framework description: "Agnostic Reusable Component Architecture for New Ecosystems: a modern framework for bootstrapping new applications" -version: 1.1.0 +version: 1.1.1 repository: https://github.com/hanskokx/arcane_framework issue_tracker: https://github.com/hanskokx/arcane_framework/issues