securemix 1.0.0
securemix: ^1.0.0 copied to clipboard
A production-grade, cryptographically secure password generator with mutation engine and CLI support for Dart and Flutter.
example/securemix_example.dart
import 'package:securemix/securemix.dart';
void main() {
print('--- SecureMix Dart & Flutter Example ---\n');
// 1. Concise static API
final pwd1 = SecureMix.generate(length: 16);
print('1. SecureMix.generate(16): $pwd1');
// 2. Options and excluding similar characters
final pwd2 = SecureMix.generate(
length: 20,
symbols: true,
numbers: true,
excludeSimilar: true,
);
print('2. Exclude similar chars: $pwd2');
// 3. Batch generation using generateMany
final batch = SecureMix.generateMany(length: 12, batch: 3);
print('3. SecureMix.generateMany(3):');
for (final pwd in batch) {
print(' - $pwd');
}
// 4. Mutation Engine
const weak = 'mydog123';
final hardened = SecureMix.enhance(weak);
print('4. SecureMix.enhance("$weak") -> "$hardened"');
// 5. Pattern generation
final apiKey = SecureMix.fromPattern('sk-9999-AAAA-@a9A');
print('5. SecureMix.fromPattern(...) -> $apiKey');
// 6. Evaluation using SecureMix.evaluate
final evaluation = SecureMix.evaluate(hardened);
print(
'6. SecureMix.evaluate(...) -> score: ${evaluation.score}/4 (${evaluation.strength})');
// 7. Ergonomic String Extension Methods
print('\n--- Ergonomic String Extensions ---');
const userPassword = 'myPassword123!';
print('userPassword.isStrong: ${userPassword.isStrong}');
print('userPassword.isWeak: ${userPassword.isWeak}');
print('userPassword.passwordScore: ${userPassword.passwordScore}');
print('userPassword.enhance(): ${userPassword.enhance()}');
}