timaan

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2020 License: MIT Imports: 3 Imported by: 1

README

timaan The timaan package is a token generator for your user's authentication process in your app whether it's a WEB, CLI, or Mobile applications.

Installation

go get -u github.com/itrepablik/timaan

Usage

This is the sample usage for the timaan package.


Documentation

Index

Constants

This section is empty.

Variables

View Source
var UT = UserTokens{}

UT is a user's token methods

Functions

func EncodePayload

func EncodePayload(payLoad TK) ([]byte, error)

EncodePayload encodes the token payload using gob

func ExtractPayload

func ExtractPayload(enc []byte, payLoad *TK) error

ExtractPayload decodes the token payload

func GenerateToken

func GenerateToken(userName, secretKey string, payLoad TK) (string, error)

GenerateToken generate a new timaan token

Types

type TK

type TK struct {
	UserName string
	Payload  TP
	ExpireOn int64
}

TK is a token collections storage

type TP

type TP map[string]interface{}

TP type stands for 'Token Payload' that uses the map[string]interface{} as the custom token payload structure

type UserTokens

type UserTokens struct {
	Token map[interface{}][]byte
}

UserTokens is a users token requests stored in memory storage

func (*UserTokens) Add

func (t *UserTokens) Add(userName string, encBytes []byte)

Add insert the new token request to the 'UserTokens' map

func (*UserTokens) Remove

func (t *UserTokens) Remove(userName string, encBytes []byte)

Remove any single stored token from the 'UserTokens' map

Jump to

Keyboard shortcuts

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