passphrase

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package passphrase generates easy-to-remember passwords from random words.

Index

Constants

This section is empty.

Variables

View Source
var Wordlists = map[string][]string{}

Wordlists contains all wordlists grouped by language. Each new language file add a wordlist to this map with the corresponding two-letter language code as key.

Functions

func ReadFile

func ReadFile(filename string) (wordlist []string, err error)

ReadFile reads and returns wordlist from filename.

Types

type Generator

type Generator struct {
	// Wordlist must be a list of words from which the passphrases are
	// generated. It can be set directly, i.e. to the output of ReadFile().
	// Or it can be set indirectly via the Language field (see below).
	Wordlist []string

	// Language allows to set Wordlist to a build-in wordlist, which must
	// be present in Wordlists.
	// The Language setting gets ignored when Wordlist has already been set
	// to a non-empty value.
	Language string

	// Words determines the number of words per passphrase.
	Words int

	// Separator is the string between the words that joins all words
	// together. It is usually a single character or an empty string.
	Separator string

	// Capitalize converts the first letter of each word to an uppercase
	// letter when set to true.
	Capitalize bool

	// Digits determines the number of digits per passphrase.
	Digits int
}

Generator generates random passphrases by the given settings.

func (*Generator) Phrase

func (g *Generator) Phrase() (string, error)

Phrase returns a random passphrase.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL