libpass

module
v4.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT

README

libpass

A Go library specifically designed for generating secure and memorable passwords. It serves as the backbone for mempass

Install

go get github.com/eljamo/libpass/v4

Basic Usage

package main

import (
	"fmt"

	"github.com/eljamo/libpass/v4/config"
	"github.com/eljamo/libpass/v4/service"
)

func main() {
	specialCharacters := []string{
		"!", "@", "$", "%", "^", "&", "*", "-", "+", "=", ":", "|", "~", "?", "/", ".", ";",
	}
	config := &config.Config{
		WordList:                "EN",
		NumPasswords:            3,
		NumWords:                3,
		WordLengthMin:           4,
		WordLengthMax:           8,
		CaseTransform:           "RANDOM",
		SeparatorCharacter:      "RANDOM",
		SeparatorAlphabet:       specialCharacters,
		PaddingDigitsBefore:     2,
		PaddingDigitsAfter:      2,
		PaddingType:             "FIXED",
		PaddingCharacter:        "RANDOM",
		SymbolAlphabet:          specialCharacters,
		PaddingCharactersBefore: 2,
		PaddingCharactersAfter:  2,
	}

	svc, err := service.NewPasswordGeneratorService(config)
	if err != nil {
		fmt.Println(err)
	}

	pws, err := svc.Generate()
	if err != nil {
		fmt.Println(err)
	}

	fmt.Println(pws)
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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