passphrase 1.0.2 copy "passphrase: ^1.0.2" to clipboard
passphrase: ^1.0.2 copied to clipboard

Generate a cryptographically random passphrase from a given in-memory word list.

passphrase #

A Dart package for generating cryptographically secure passphrases from an in-memory word list. Designed for various security applications.

Features #

  • Generate passphrases with a specified number of words
  • Generate passphrases with a target entropy level
  • Use custom word lists for passphrase generation
  • Secure random number generation for word selection

Getting started #

Use pub get passphrase or add the following to your pubspec.yaml:

dependencies:
  passphrase: ^1.0.0

Then run:

flutter pub get

Usage #

Here's a basic example of how to use the package:

import 'package:passphrase/passphrase.dart';

void main() async {
  // Create a passphrase generator with your word list
  // The file is not bundled with the package but you can download it from the EFF website
  // or from the package repository.
  final jsonString = await File('./eff-wordlist.json').readAsString();
  final wordList = (json.decode(jsonString) as List).cast<String>();
  final passphrase = Passphrase(wordList);

  // Generate a passphrase with 3 words
  final words = await passphrase.generate(3);
  print(words.join(' ')); // e.g., "banana date apple"

  // Generate a passphrase with minimum entropy
  final entropyWords = await passphrase.generateWithEntropy(10.0);
  print(entropyWords.join(' '));

  // Access the word list
  final allWords = passphrase.words;
  print('Available words: ${allWords.length}');
}

Acknowledgements #

This package is heavily inspired by the JavaScript eff-diceware-passphrase package.

Additional information #

For more information about passphrase security and best practices, refer to:

Contributing #

Contributions are welcome! Please feel free to open an issue or submit a Pull Request.

License #

This project is licensed under the Apache License 2.0.

1
likes
160
points
152
downloads

Publisher

verified publishertetr.app

Weekly Downloads

Generate a cryptographically random passphrase from a given in-memory word list.

Repository (GitHub)

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

collection

More

Packages that depend on passphrase