dart_wordlists 0.2.2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 46

dart_wordlists #

A library for passphrase word lists. Inspired by Diceware and others

Created from templates made available by Stagehand under a BSD-style license.

Usage #

generate pgp mnemonic from byte array #

import 'package:dart_wordlists/dart_wordlists.dart';

main(List<String> arguments) async {
  PgpMnemonic pgpWords = new PgpMnemonic();
  await pgpWords.init();

  if (arguments.length == 0) {
    print("You must supply a hex string (whitespace separation a-ok!)");
  } else {
    print(pgpWords.toPhraseFromHex(arguments.join(' ')).join(' '));
  }
}

running the example:

$ pub run example/pgp_words.dart a2b4 ff5a 21a9
rebirth politeness Zulu existence blackjack passenger

word list selection w/ collection sampler #

A simple usage example:

    import 'package:dart_wordlists/dart_wordlists.dart';
    import 'package:dart_collection_sampler/dart_collection_sampler.dart';
    
    import 'package:args/args.dart';
    
    
    main(List<String> arguments) async {
      var argParser = new ArgParser()
        ..addOption("num", abbr: "n",
            help: "items to pick from rest of command line",
            defaultsTo: "6");
    
      var results = argParser.parse(arguments);
    
      sample(int.parse(results["num"]));
    }
    
    sample(int sampleSize) async {
      var loader = new WordlistLoader();
    
      var sampler = new CollectionSampler();
    
      var wordlists = [
        Wordlist.bip39_en,
        Wordlist.bip39_zh_CW,
        Wordlist.diceware_beale_en,
        Wordlist.eff_large_en
      ];
      for (var wl in wordlists) {
        var meta = loader.findMetadata(wl);
        print(loader.findMetadata(wl));
    
        var words = await loader.findLoader(wl).load();
        print(words);
    
        print ("sample: ${sampler.pickN(words, sampleSize)}");
        print ("\n");
      }
    }

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Similar projects #

Credits #

Diceware #

diceware is a concept invented by Arnold G. Reinhold, Cambridge, Massachusetts USA.

The English Diceware Wordlists used with this programme are licensed by Arnold G. Reinhold (files wordlists/wordlist_en_orig.asc, wordlists/wordlist_en.txt) under the Creative Commons CC-BY 3.0 license (see http://creativecommons.org/licenses/by/3.0/).

"Diceware" is a trademark of A G Reinhold.

EFF #

The EFF wordlist (file wordlsts/wordlist_en_eff.txt) is licensed by the Electronic Frontier Foundation under the Creative Commons CC-BY 3.0 US license (see https://creativecommons.org/licenses/by/3.0/us/).

See EFF's New Wordlists for Random Passphrases

BIP39 #

See BIP39

Changelog #

0.2.2 #

0.2.0 #

  • upgrade to dart 2

0.1.1 #

  • add unit test for entropy

0.1.0 #

  • change diceware-style parser to return Map<String,String>
  • add method to calculate entropy per word from wordlist

0.0.2 #

  • in CLI example, don't select unique words

0.0.1 #

  • Initial version

Use this package as a library

1. Depend on it

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


dependencies:
  dart_wordlists: ^0.2.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:dart_wordlists/dart_wordlists.dart';
  
Version Uploaded Documentation Archive
0.2.2 Oct 3, 2018 Go to the documentation of dart_wordlists 0.2.2 Download dart_wordlists 0.2.2 archive
0.2.1 Oct 3, 2018 Go to the documentation of dart_wordlists 0.2.1 Download dart_wordlists 0.2.1 archive
0.2.0 Oct 3, 2018 Go to the documentation of dart_wordlists 0.2.0 Download dart_wordlists 0.2.0 archive
0.1.1 Dec 10, 2017 Go to the documentation of dart_wordlists 0.1.1 Download dart_wordlists 0.1.1 archive
0.1.0 Dec 10, 2017 Go to the documentation of dart_wordlists 0.1.0 Download dart_wordlists 0.1.0 archive
0.0.2 Dec 8, 2017 Go to the documentation of dart_wordlists 0.0.2 Download dart_wordlists 0.0.2 archive
0.0.1 Dec 4, 2017 Go to the documentation of dart_wordlists 0.0.1 Download dart_wordlists 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
46
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: Flutter, other

Primary library: package:dart_wordlists/dart_wordlists.dart with components: isolate.

Health suggestions

Format lib/src/dart_wordlists_base.dart.

Run dartfmt to format lib/src/dart_wordlists_base.dart.

Format lib/src/pgp_mnemonic.dart.

Run dartfmt to format lib/src/pgp_mnemonic.dart.

Format lib/src/wordlist_parser.dart.

Run dartfmt to format lib/src/wordlist_parser.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and dart_wordlists.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
convert ^2.0.2 2.1.1
memoize ^2.0.0 2.0.0
quiver >=2.0.0 <3.0.0 2.0.3
resource >=2.1.5 <3.0.0 2.1.5
Transitive dependencies
charcode 1.1.2
matcher 0.12.5
meta 1.1.7
path 1.6.2
stack_trace 1.9.3
typed_data 1.1.6
Dev dependencies
args ^1.5.0
dart_collection_sampler >=0.5.1
mockito ^3.0.0
test ^1.3.4