password

package
v0.0.0-...-6cd82ae Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LowercaseLetters = "abcdefghijklmnopqrstuvwxyz"
	UppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	Digits           = "0123456789"
	Symbols          = "~!@#$%^&*()_+`-={}|[]\\:\"<>?,./"
	LettersAndDigits = LowercaseLetters + UppercaseLetters + Digits
)

Variables

This section is empty.

Functions

func FromAlphabet

func FromAlphabet(alphabet string, length uint) (string, error)

FromAlphabet generates a password of a given length, using only characters from the given alphabet (which should be a string with no duplicates)

func Generate

func Generate(config GenerateConfig) (string, error)

Generate generates a password based on the provided configuration. It takes an `azure.AutoGenInput` configuration as input and returns the generated password as a string. If any error occurs during the generation process, it returns an error.

func Shuffle

func Shuffle[T any](s []T) error

Fisher-Yates shuffle

Types

type GenerateConfig

type GenerateConfig struct {
	Length     uint  `json:"length,omitempty"`
	NoLower    *bool `json:"noLower,omitempty"`
	NoUpper    *bool `json:"noUpper,omitempty"`
	NoNumeric  *bool `json:"noNumeric,omitempty"`
	NoSpecial  *bool `json:"noSpecial,omitempty"`
	MinLower   *uint `json:"minLower,omitempty"`
	MinUpper   *uint `json:"minUpper,omitempty"`
	MinNumeric *uint `json:"minNumeric,omitempty"`
	MinSpecial *uint `json:"minSpecial,omitempty"`
}

GenerateConfig are the settings to control the output of calling Generate.

Jump to

Keyboard shortcuts

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