Skip to content

A small, simple, and flexible token generator for tokens, urls, and passwords.

License

Notifications You must be signed in to change notification settings

iZettle/tokengen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tokengen

Build Status Coverage Status GoDoc Go Report Card

tokengen is small, simple and flexible token generator. tokengen allows you to specify your character set and token length, and as such is ideally suited for generating secure tokens in any language, random urls, passwords, and access tokens.

tokengen relies on the crypto/rand package, mapping values evenly to the character set given, disregarding any values out of range.

func GenerateOneTimePassword() (string, error){
    tokengen, err := tokengen.New(tokengen.DefaultCharset, 40)
    if err != nil {
        return tokengen, err
    }
    return tokengen.GenerateToken()
}

Please make sure that the character set and length of token you choose are large enough to ensure a reasonable amount of entropy.