pwgen

package module
v0.0.0-...-8ef26fd Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 3 Imported by: 0

README

go-pwgen

Documentation

Index

Constants

View Source
const (
	DefaultLength           = 20
	DefaultSpecialsAlphabet = `!?~@#$%^&*()-+={}[]\/{}|<>`
)

Variables

View Source
var (
	Default = NewDefaultGenerator(nil)
)
View Source
var ErrLengthOverflow = errors.New("length overflow")

Functions

func Generate

func Generate(opts ...GenerationOption) (string, error)

func MustGenerate

func MustGenerate(opts ...GenerationOption) string

Types

type DefaultGenerator

type DefaultGenerator struct {
	PRNG Int32n
}

func NewDefaultGenerator

func NewDefaultGenerator(prng Int32n) DefaultGenerator

func (DefaultGenerator) Generate

func (d DefaultGenerator) Generate(opts ...GenerationOption) (string, error)

type GenerationOption

type GenerationOption interface {
	ApplyToOptions(options *options)
}

func WithDigits

func WithDigits(digits uint) GenerationOption

func WithLength

func WithLength(length uint) GenerationOption

func WithLetters

func WithLetters(letters uint) GenerationOption

func WithLowercase

func WithLowercase(lowercase uint) GenerationOption

func WithSpecials

func WithSpecials(specials uint) GenerationOption

func WithSpecialsAlphabet

func WithSpecialsAlphabet(specialsAlphabet string) GenerationOption

func WithUppercase

func WithUppercase(uppercase uint) GenerationOption

type Generator

type Generator interface {
	Generate(opts ...GenerationOption) (string, error)
}

type Int32n

type Int32n interface {
	Int31n(n int32) int32
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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