Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -188,6 +189,7 @@ class KdfAuthService implements IAuthService {
allowRegistrations: true,
plaintextMnemonic: mnemonic?.plaintextMnemonic,
hdEnabled: options.derivationMethod == DerivationMethod.hdWallet,
allowWeakPassword: options.allowWeakPassword,
);

return _lockWriteOperation(() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -184,6 +185,7 @@ extension KdfExtensions on KdfAuthService {
rpcPassword: _hostConfig.rpcPassword,
allowRegistrations: allowRegistrations,
enableHd: hdEnabled,
allowWeakPassword: allowWeakPassword,
);
}
}
8 changes: 6 additions & 2 deletions packages/komodo_defi_types/lib/src/auth/auth_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link

Copilot AI May 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a comment explaining the purpose and usage scenarios of 'allowWeakPassword' for greater clarity and maintainability.

Copilot uses AI. Check for mistakes.
});

factory AuthOptions.fromJson(JsonMap json) {
return AuthOptions(
derivationMethod:
DerivationMethod.parse(json.value<String>('derivation_method')),
allowWeakPassword: json.valueOrNull<bool>('allow_weak_password') ?? false,
);
}

final DerivationMethod derivationMethod;
final bool allowWeakPassword;

JsonMap toJson() {
return {
'derivation_method': derivationMethod.toString(),
'allow_weak_password': allowWeakPassword,
};
}

@override
List<Object?> get props => [derivationMethod];
List<Object?> get props => [derivationMethod, allowWeakPassword];
}
Loading