Skip to content

To create a random token with the length you want. The random seed is based on the current time with nano seconds.

License

Notifications You must be signed in to change notification settings

gowizzard/goten

Repository files navigation

Random token

GitHub go.mod Go version of a Go module Go CodeQL CompVer Go Report Card Go Reference GitHub issues GitHub forks GitHub stars GitHub license

To create a random token in Golang. Based on letters, numbers and symbols. Created with a non-negative pseudo-random number based on a random seed with is created with unix time number of nanoseconds.

Install

First you have to install the package. You can do this as follows:

go get github.com/gowizzard/goten

How to use

Here is a small example how to create a random password without numbers and symbols. Only letters.

token := goten.Generate(50, nil)
fmt.Println(token)

And here is a small example how to create a random token with numbers and symbols.

options := goten.Options{
    Uppercase:  true,
    Numbers:    true,
    Symbols:    true,
}

token := goten.Generate(50, &options)
fmt.Println(token)

About

To create a random token with the length you want. The random seed is based on the current time with nano seconds.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks