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.
securemix #
Cryptographically Secure Password Generation & Mutation — for Dart & Flutter (iOS, Android, Web, Desktop, & Server)
Built by Innoartive Labs · Zero Dependencies
What is securemix? #
securemix is a developer security utility designed for production use across Dart and Flutter applications (iOS, Android, Web, macOS, Windows, Linux, and Server). It generates cryptographically secure passwords, mutates weak strings into strengthened credentials, evaluates password strength, and supports template-based pattern generation — all with zero runtime dependencies.
In Dart/Flutter environments, it utilizes Random.secure(), which interfaces directly with the operating system's Cryptographically Secure Pseudorandom Number Generator (CSPRNG): Web Crypto API (crypto.getRandomValues) on Web, /dev/urandom or SecRandomCopyBytes on Apple/Linux platforms, and BCryptGenRandom on Windows.
Why SecureMix? #
| Feature | securemix | Typical Generator |
|---|---|---|
| CSPRNG | ✅ | Sometimes |
| Rejection sampling | ✅ | Rare |
| Zero dependencies | ✅ | Varies |
| Password evaluation | ✅ | Often ❌ |
| Pattern generation | ✅ | Rare |
| CLI included | ✅ | Rare |
| String extensions | ✅ | ❌ |
Key Highlights: #
- Rejection Sampling (No Modulo Bias): Discards values outside an exact multiple of the charset size to eliminate statistical character skew.
- Anti-Pattern Intelligence: Detects and rejects sequential runs (
abc,123), keyboard walks (qwerty), repeating character blocks (aaaa), and common weak words (password). - Password Mutation Engine (
SecureMix.enhance): Uses deterministic character transformations, randomized substitutions, capitalization, and entropy injection to strengthen weak inputs. - Zero Runtime Dependencies: Built entirely with standard Dart SDK libraries (
dart:math,dart:convert,dart:io), reducing external dependency risk.
Installation #
Add securemix to your pubspec.yaml:
dependencies:
securemix: ^1.0.0
Or run:
flutter pub add securemix
# Or for Dart CLI / Server
dart pub add securemix
Quick Start #
import 'package:securemix/securemix.dart';
void main() {
// Generate a 16-character password
final password = SecureMix.generate(length: 16);
print(password); // e.g. "K#7{mP2@zX!qR4^v"
}
Pure Dart Usage #
Standard Generation #
import 'package:securemix/securemix.dart';
void main() {
// Single password
final pwd = SecureMix.generate(
length: 20,
symbols: true,
numbers: true,
excludeSimilar: true, // Omits O, 0, l, I, 1
);
// Batch generation
final list = SecureMix.generateMany(length: 12, batch: 5);
// Strengthen weak inputs via Mutation Engine
final hardened = SecureMix.enhance("mydog123");
// Evaluate password strength
final report = SecureMix.evaluate("p@ssword123");
print('Score: ${report.score}/4 (${report.strength})');
// Pattern generation (API keys, format matching)
final apiKey = SecureMix.fromPattern("sk-9999-AAAA-@a9A");
}
String Extensions #
import 'package:securemix/securemix.dart';
void main() {
const pwd = "myPassword123!";
if (pwd.isStrong) {
print('Password passed initial check.');
}
final report = pwd.evaluate();
final hardened = "weakpass".enhance();
}
Flutter Example #
import 'package:flutter/material.dart';
import 'package:securemix/securemix.dart';
class PasswordGeneratorWidget extends StatefulWidget {
const PasswordGeneratorWidget({super.key});
@override
State<PasswordGeneratorWidget> createState() => _PasswordGeneratorWidgetState();
}
class _PasswordGeneratorWidgetState extends State<PasswordGeneratorWidget> {
String _password = '';
void _generate() {
setState(() {
_password = SecureMix.generate(
length: 16,
symbols: true,
numbers: true,
excludeSimilar: true,
);
});
}
@override
Widget build(BuildContext context) {
return Column(
children: [
ElevatedButton(
onPressed: _generate,
child: const Text('Generate Secure Password'),
),
SelectableText(_password),
],
);
}
}
CLI Usage #
securemix includes a CLI executable directly via dart run:
# Generate a password (12 chars default)
dart run securemix generate
# Options: length, symbols, numbers, uppercase, exclude-similar
dart run securemix generate --length 20 --symbols --numbers --exclude-similar
# Generate a batch of 5 passwords
dart run securemix generate --batch 5
# Output JSON
dart run securemix generate --length 16 --json
# Mutate a weak password
dart run securemix enhance "sunshine99"
# Evaluate password strength
dart run securemix evaluate "P@ssw0rd!"
# Show CLI version
dart run securemix --version
Advanced Usage & Performance #
Performance varies by Dart SDK version, platform, compilation build mode (JIT vs AOT), and underlying hardware.
To measure performance in your local environment, run the included benchmark tool:
dart run benchmark/securemix_benchmark.dart
License #
MIT © Innoartive Labs