mpcauth

package
v0.0.0-...-c36ecfd Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomBytes

func RandomBytes(length int) (key []byte, err error)

RandomBytes is useful to generate HMAC key

func RandomString

func RandomString(length int) (key string, err error)

RandomBytes is useful to generate HMAC key

Types

type Auth

type Auth struct {
	Key            []byte
	Storage        *mpcstorage.Storage
	Authorizations []AuthData
}

func (*Auth) Authorize

func (auth *Auth) Authorize(username string, password string) (tokenString string, err error)

Authorize checks username and password and generates a token with the session id

func (*Auth) GenerateTokenString

func (auth *Auth) GenerateTokenString(userID string) (tokenString string, err error)

GenerateTokenString generates New JWT Token String

func (*Auth) NewAuthorization

func (auth *Auth) NewAuthorization(userID string) (sessionID string, err error)

NewAuthorization generates a new sessionID

func (*Auth) ValidateSessionID

func (auth *Auth) ValidateSessionID(sessionID string) string

ValidateSessionID validates the sessionID

func (*Auth) ValidateToken

func (auth *Auth) ValidateToken(tokenString string) (sessionId string, err error)

ValidateToken validates the token and returns the session id

type AuthData

type AuthData struct {
	SessionID string
	UUID      string
}

Jump to

Keyboard shortcuts

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