tokenserver

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TimeFormat     = time.RFC3339Nano
	ExpirationTime = time.Hour * 24
	UserId         = "wirepod"
	GlobalGUID     = "tni1TRsTRTaNSapjo0Y+Sw=="
)
View Source
var SecondaryTokenStore [][4]string

array of {"esn", "target", "guid", "guidhash"} for secondary user auth

View Source
var SessionWriteStoreCerts [][]byte
View Source
var SessionWriteStoreNames [][2]string

{"target", "name"}

View Source
var TokenHashStore [][3]string

array of {"target", "guid", "guidhash"} for primary user auth

Functions

func ChangeGUIDInIni

func ChangeGUIDInIni(esn string)

func CompareHashAndToken

func CompareHashAndToken(hashedToken, token string) error

copied from vector-cloud

func CreateJWT

func CreateJWT(ctx context.Context, skipGuid bool, isPrimary bool) *tokenpb.TokenBundle

func CreateTokenAndHashedToken

func CreateTokenAndHashedToken() (GUID string, GUIDHash string, isError error)

func DecodeAndCompare

func DecodeAndCompare(tokenHashes string, token string)

func GenerateUUID

func GenerateUUID() string

func GetEsnFromTarget

func GetEsnFromTarget(target string) (string, error)

func RemoveFromPrimaryStore

func RemoveFromPrimaryStore(index int)

func RemoveFromSecondStore

func RemoveFromSecondStore(index int)

func RemoveFromSessionStore

func RemoveFromSessionStore(index int)

func SetBotGUID

func SetBotGUID(esn string, guid string, guidHash string) error

func WriteTokenHash

func WriteTokenHash(esn string, tokenHash string) error

Types

type ClientToken

type ClientToken struct {
	Hash       string `json:"hash"`
	ClientName string `json:"client_name"`
	AppId      string `json:"app_id"`
	IssuedAt   string `json:"issued_at"`
}

type ClientTokenManager

type ClientTokenManager struct {
	ClientTokens []ClientToken `json:"client_tokens"`
}

type RobotInfoStore

type RobotInfoStore struct {
	GlobalGUID string `json:"global_guid"`
	Robots     []struct {
		Esn       string `json:"esn"`
		IPAddress string `json:"ip_address"`
		// 192.168.1.150:443
		GUID      string `json:"guid"`
		Activated bool   `json:"activated"`
	} `json:"robots"`
}

type TokenServer

type TokenServer struct {
	tokenpb.UnimplementedTokenServer
}

func NewTokenServer

func NewTokenServer() *TokenServer

func (*TokenServer) RefreshToken

Jump to

Keyboard shortcuts

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