diff --git a/packages/komodo_defi_local_auth/lib/src/auth/auth_service.dart b/packages/komodo_defi_local_auth/lib/src/auth/auth_service.dart index 58bf23b3..e2adda2f 100644 --- a/packages/komodo_defi_local_auth/lib/src/auth/auth_service.dart +++ b/packages/komodo_defi_local_auth/lib/src/auth/auth_service.dart @@ -143,6 +143,7 @@ class KdfAuthService implements IAuthService { walletPassword: password, allowRegistrations: false, hdEnabled: options.derivationMethod == DerivationMethod.hdWallet, + allowWeakPassword: options.allowWeakPassword, ); final user = await _authenticateUser(config); @@ -188,6 +189,7 @@ class KdfAuthService implements IAuthService { allowRegistrations: true, plaintextMnemonic: mnemonic?.plaintextMnemonic, hdEnabled: options.derivationMethod == DerivationMethod.hdWallet, + allowWeakPassword: options.allowWeakPassword, ); return _lockWriteOperation(() async { diff --git a/packages/komodo_defi_local_auth/lib/src/auth/auth_service_kdf_extension.dart b/packages/komodo_defi_local_auth/lib/src/auth/auth_service_kdf_extension.dart index c5df7796..64e3e92c 100644 --- a/packages/komodo_defi_local_auth/lib/src/auth/auth_service_kdf_extension.dart +++ b/packages/komodo_defi_local_auth/lib/src/auth/auth_service_kdf_extension.dart @@ -169,6 +169,7 @@ extension KdfExtensions on KdfAuthService { required bool hdEnabled, String? plaintextMnemonic, String? encryptedMnemonic, + bool allowWeakPassword = false, }) async { if (plaintextMnemonic != null && encryptedMnemonic != null) { throw AuthException( @@ -184,6 +185,7 @@ extension KdfExtensions on KdfAuthService { rpcPassword: _hostConfig.rpcPassword, allowRegistrations: allowRegistrations, enableHd: hdEnabled, + allowWeakPassword: allowWeakPassword, ); } } diff --git a/packages/komodo_defi_types/lib/src/auth/auth_options.dart b/packages/komodo_defi_types/lib/src/auth/auth_options.dart index 51089354..69d03cd4 100644 --- a/packages/komodo_defi_types/lib/src/auth/auth_options.dart +++ b/packages/komodo_defi_types/lib/src/auth/auth_options.dart @@ -5,23 +5,27 @@ import 'package:komodo_defi_types/komodo_defi_types.dart'; class AuthOptions extends Equatable { const AuthOptions({ required this.derivationMethod, + this.allowWeakPassword = false, }); factory AuthOptions.fromJson(JsonMap json) { return AuthOptions( derivationMethod: DerivationMethod.parse(json.value('derivation_method')), + allowWeakPassword: json.valueOrNull('allow_weak_password') ?? false, ); } final DerivationMethod derivationMethod; + final bool allowWeakPassword; JsonMap toJson() { return { 'derivation_method': derivationMethod.toString(), + 'allow_weak_password': allowWeakPassword, }; } - + @override - List get props => [derivationMethod]; + List get props => [derivationMethod, allowWeakPassword]; }