lib

package
v0.0.0-...-c77e503 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 7 Imported by: 7

Documentation

Overview

Garbler is a package to generate memorable passwords

Index

Constants

This section is empty.

Variables

View Source
var Vowels, GarblableVowels, VowelGarblers, Consonants, GarblableConsonants, ConsonantGarblers, Punctuation []rune

Functions

func NewPassword

func NewPassword(reqs *PasswordStrengthRequirements) (string, error)

Generate one password that meets the given requirements

func NewPasswords

func NewPasswords(reqs *PasswordStrengthRequirements, n int) ([]string, error)

Generate n passwords that meet the given requirements

Types

type Garbler

type Garbler struct{}

Garbler is a generator that creates a generalized environ sequence to the specified requirement. It then garbles the password (i.e. replacing a letter by a similar-looking number)

type PasswordStrengthRequirements

type PasswordStrengthRequirements struct {
	MinimumTotalLength int //Minimum number characters in password
	MaximumTotalLength int //Maximum number of characters (ignored if 0)
	Uppercase          int //Minimum number of uppercase letters
	Digits             int //Mininum number of digits
	Punctuation        int //Minimum number of special characters
}

PasswordStrengthRequirements describes the minimal requirements that the generated password must meet.

var Insecure, Easy, Medium, Strong, Paranoid PasswordStrengthRequirements

Presets for password strength requirements. Medium or Strong are recommended.

func MakeRequirements

func MakeRequirements(password string) PasswordStrengthRequirements

Generate password requirements from an existing password.

func (*PasswordStrengthRequirements) Validate

func (p *PasswordStrengthRequirements) Validate(password string) (bool, string)

Validate a password against the given requirements Returns a boolean indicating whether the password meets the requirements. The second argument is a string explaining why it doesn't meet the requirements, if it doesn't. It is empty if the requirements are met.

Jump to

Keyboard shortcuts

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