Typo/error resilient, human-readable token generator

Overview

toktok

Build Status Coverage Status Go ReportCard GoDoc

A human-friendly token generator

Creates tokens which avoid characters that can be easily misinterpreted, like '1' and 'I' or '8' and 'B', as well as repeated characters within the token. It also compares newly generated tokens to all previously generated ones and guarantees a safety distance between the tokens, so they become resilient to typos or other human entry errors.

Installation

Make sure you have a working Go environment (Go 1.5 or higher is required). See the install instructions.

To install toktok, simply run:

go get github.com/muesli/toktok

To compile it from source:

cd $GOPATH/src/github.com/muesli/toktok
go get -u -v
go build && go test -v

Example

package main

import (
	"fmt"

	"github.com/muesli/toktok"
)

func main() {
	// Generate a new token bucket. Each generated token will be 8 characters long
	bucket, _ := toktok.NewBucket(8)

	// Generate a bunch of tokens with a safety distance of 4
	// Distance is calculated by insertion cost (1), deletion cost (1) and substitution cost (2)
	for i := 0; i < 9; i++ {
		token, _ := bucket.NewToken(4)
		fmt.Printf("Generated Token %d: %s\n", i, token)
	}

	// One more token that we will tamper with
	token, _ := bucket.NewToken(4)
	fmt.Printf("Generated Token 9: %s\n", token)
	token = "_" + token[1:7] + "_"

	// Find the closest match for the faulty token
	match, distance := bucket.Resolve(token)
	fmt.Printf("Best match for '%s' is token '%s' with distance %d\n", token, match, distance)
}

Result

Generated Token 0: J3KPC9YF
Generated Token 1: PXTWDC9P
Generated Token 2: WNANK4FU
...
Generated Token 9: Y3NCDFWN
Best match for '_3NCDFW_' is token 'Y3NCDFWN' with distance 4
Issues
Releases(v0.1.0)
Owner
Christian Muehlhaeuser
Geek, Gopher, Software Developer, Maker, Opensource Advocate, Tech Enthusiast, Photographer, Board and Card Gamer
Christian Muehlhaeuser
Purpose: dump slack messages, users and files using browser token and cookie.

Slack Dumper Purpose: dump slack messages, users and files using browser token and cookie. Typical usecase scenarios: You want to archive your private

Rustam 96 May 13, 2022
Get the long-term token for the Budget Insight API (sandbox)

token-budget-insight This small tool aims to automate the creation of the long-term token for a Budget Insight application; the process is explain in

Enguerrand Allamel 0 Jan 7, 2022
go-playground-converter is formatter error response inspiration like express-validator in nodejs build on top go-playground-validator.

Go Playground Converter go-playground-converter is formatter error response inspiration like express-validator in nodejs build on top in go-playground

Restu Wahyu Saputra 8 Nov 15, 2021
Example of using advanced gRPC error model

grpcerrors Example of using advanced gRPC error model

Will Andrews 0 Nov 19, 2021
Random fake data and struct generator for Go.

Faker Random fake data and struct generator for Go. More than 100 generator functions Struct generator Unique data generator Builtin types support Eas

Enrico 61 Apr 19, 2022
Random fake data generator written in go

Gofakeit Random data generator written in go Features 160+ Functions!!! Concurrent Global Rand Struct Generator Custom Functions Http Server Command L

Brian Voelker 2.4k May 17, 2022
A distributed unique ID generator of using Sonyflake and encoded by Base58

Indigo About A distributed unique ID generator of using Sonyflake and encoded by Base58. ID max length is 11 characters by unsigned int64 max value. A

Osamu TONOMORI 93 May 4, 2022
:guardsman: A teeny tiny and somewhat opinionated generator for your next golang project

A Yeoman Golang Generator We are very sorry Gophers, but other names for the generator where taken, so we choose go-lang. But we have gocreate as an a

Axel Springer SE 24 Dec 16, 2021
Unit tests generator for Go programming language

GoUnit GoUnit is a commandline tool that generates tests stubs based on source function or method signature. There are plugins for Vim Emacs Atom Subl

Max Chechel 61 Apr 15, 2022
XSD (XML Schema Definition) parser and Go/C/Java/Rust/TypeScript code generator

xgen Introduction xgen is a library written in pure Go providing a set of functions that allow you to parse XSD (XML schema definition) files. This li

null 156 May 11, 2022
GObject-introspection based bindings generator

WARNING! This project is no longer maintained. Probably doesn't even compile. GObject-introspection based bindings generator for Go. Work in progress

null 47 Jan 5, 2022
Fast and secure initramfs generator

Booster - fast and secure initramfs generator Initramfs is a specially crafted small root filesystem that mounted at the early stages of Linux OS boot

Anatol Pomozov 256 May 12, 2022
Jennifer is a code generator for Go

Jennifer Jennifer is a code generator for Go. package main import ( "fmt" . "github.com/dave/jennifer/jen" ) func main() { f := NewFile("m

Dave Brophy 2.4k May 19, 2022
General Golang Code Generator

gg gg is a General Golang Code Generator: A Good Game to play with Golang. package main import ( "fmt" . "github.com/Xuanwo/gg" ) func main() {

Xuanwo 59 Apr 25, 2022
Default godoc generator - make your first steps towards better code documentation

godoc-generate Overview godoc-generate is a simple command line tool that generates default godoc comments on all exported types, functions, consts an

Dimitar Petrov 18 Nov 14, 2021
accessor methods generator for Go programming language

accessory accessory is an accessor generator for Go programming language. What is accessory? Accessory is a tool that generates accessor methods from

masaushi 4 Apr 30, 2022
RinkWorks fantasy name generator in golang

RinkWorks fantasy name generator in golang

Alexei Shevchenko 8 May 10, 2022
Go Param Generator for golang

Go Param Generator Overview Generates struct's for you. No need to write it by hands Adds Getters and Setters Adds Constructor Easy to use Usage gopar

HaxiDenti 0 Dec 13, 2021
Model Generator for Firestore

volcago Automatically generate code used by Cloud Firestore. 日本語ドキュメント Installation Recommend that you drop the binary from the release and use it. Al

null 4 Mar 21, 2022