xcvbnm 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 83

xcvbnm #

This is a dart port of the great dropbox/zxcvbn library, a realistic password strength estimator.

This library is strong mode compliant.

Please note, that library did not port all functionality but is already used in production.

Usage #

library xcvbnm.example.bin;

import 'package:xcvbnm/xcvbnm.dart';

main() {
  String password = "my_pwd_1";
  // Use the direct helper API
  Result result = new Xcvbnm().estimate(password);
  print(result.toMap());
}

Demo #

Browser #

Online demo dart code compiled with dart2js

Command line #

$  dart bin/xcvbnm_demo.dart --help
  -h, --help     Usage help
  -m, --match    Max number max of match to display
                 (defaults to "4")
$ dart bin/xcvbnm_demo.dart
$ dart bin/xcvbnm_demo.dart 9IOksjdopwd
$ dart bin/xcvbnm_demo.dart "my password"
$ dart bin/xcvbnm_demo.dart pwd1 pwd2 -m 1

Development #

Guidelines and format #

Before each commit format at the root of the project

$ dartfmt -l 120 -w .

Test #

Run all tests in multiple platforms

$ ./test/bin/run_tests.sh

1.0.0 #

  • Slight cleanup and 1.0.0 release

0.5.7 #

  • Remove all implicit cast issues

0.5.6 #

  • Fixed all dart 2.0 errors and warnings

0.5.5 #

  • Started Changelog
  • Made xcvbnm strong-mode compliant

example/example.dart

import 'package:xcvbnm/xcvbnm.dart';

final xcvbnm = new Xcvbnm();

void main() {
  final password = 'my_pwd_1';
  final Result result = xcvbnm.estimate(password);

  if (result.score < 3) {
    print('Password not strong enough. It can be cracked in '
        '${result.crackTimeDisplay}. ${result.feedback}');
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  xcvbnm: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:xcvbnm/xcvbnm.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
78
Health:
Code health derived from static analysis. [more]
96
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
79
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

We analyzed this package on Oct 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:xcvbnm/xcvbnm.dart.

Health suggestions

Fix lib/src/feedback.dart. (-1.99 points)

Analysis of lib/src/feedback.dart reported 4 hints:

line 49 col 9: Use isEmpty instead of length

line 96 col 11: DO use curly braces for all flow control structures.

line 98 col 11: DO use curly braces for all flow control structures.

line 100 col 11: DO use curly braces for all flow control structures.

Fix lib/src/matching.dart. (-1.49 points)

Analysis of lib/src/matching.dart reported 3 hints:

line 423 col 15: Use contains instead of indexOf

line 489 col 33: Use contains instead of indexOf

line 746 col 13: Use isNotEmpty instead of length

Fix lib/src/scoring.dart. (-1 points)

Analysis of lib/src/scoring.dart reported 2 hints:

line 115 col 7: Use isNotEmpty instead of length

line 463 col 34: Use isNotEmpty instead of length

Maintenance suggestions

Package is getting outdated. (-21.37 points)

The package was last published 63 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.9.0 <3.0.0
Dev dependencies
args any
browser any
test ^0.12.20