Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gowizzard/goten

To create a random token with the length you want. The random seed is based on the current time with nano seconds.
https://github.com/gowizzard/goten

generator go golang password random token

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

# Random token

[![GitHub go.mod Go version of a Go module](https://img.shields.io/github/go-mod/go-version/gowizzard/goten.svg)](https://golang.org/) [![Go](https://github.com/gowizzard/goten/actions/workflows/go.yml/badge.svg)](https://github.com/gowizzard/goten/actions/workflows/go.yml) [![CodeQL](https://github.com/gowizzard/goten/actions/workflows/codeql.yml/badge.svg)](https://github.com/gowizzard/goten/actions/workflows/codeql.yml) [![CompVer](https://github.com/gowizzard/goten/actions/workflows/compver.yml/badge.svg)](https://github.com/gowizzard/goten/actions/workflows/compver.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/gowizzard/goten)](https://goreportcard.com/report/github.com/gowizzard/goten) [![Go Reference](https://pkg.go.dev/badge/github.com/gowizzard/goten.svg)](https://pkg.go.dev/github.com/gowizzard/goten) [![GitHub issues](https://img.shields.io/github/issues/gowizzard/goten)](https://github.com/gowizzard/goten/issues) [![GitHub forks](https://img.shields.io/github/forks/gowizzard/goten)](https://github.com/gowizzard/goten/network) [![GitHub stars](https://img.shields.io/github/stars/gowizzard/goten)](https://github.com/gowizzard/goten/stargazers) [![GitHub license](https://img.shields.io/github/license/gowizzard/goten)](https://github.com/gowizzard/goten/blob/master/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:

```console
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.

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

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

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

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