password

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package password provides types and functions for password generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator can generate passwords with a given configuration passed via functional Options in its constructor.

func NewGenerator

func NewGenerator(options ...Option) Generator

NewGenerator will create a Generator which can generate passwords. A number of Options can be passed to configure the resulting Generator.

func (Generator) Password

func (g Generator) Password() string

Password generates a password with the generators' configuration

type Option

type Option func(*Generator)

Option is the functional option type to allow variadic and generic configration of generators.

func MinLength

func MinLength(length int) Option

MinLength configures a minimum length for generated passwords.

func Numbers

func Numbers(amount int) Option

Numbers configures the exact amount of numbers in generated passwords.

func SpecialChars

func SpecialChars(amount int) Option

SpecialChars configures the exact amount of special characters in generated passwords.

func Swap added in v1.2.1

func Swap(shouldSwap bool) Option

Swap configures if vowels should be swapped with numbers

Jump to

Keyboard shortcuts

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