authentication

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAuthCode

func GenerateAuthCode(userId, joinCode string) (authCode string)

Generate auth code

func GenerateKeys

func GenerateKeys(authCode string, pubkey ed25519.PublicKey, privkey ed25519.PrivateKey) (encodedSignature, base64PublicKey string)

Generate Encoded signature and base64 public key

func GenerateToken

func GenerateToken(userId, authCode, encodedSignature, base64PublicKey string) (token string)

Generate accessToken, refreshToken

func Logout

func Logout()

Logout user

func ValidateToken

func ValidateToken(accessToken string) (status bool)

validate access token, if its active

Types

type AuthCodeStruct

type AuthCodeStruct struct {
	AuthCode string `json:"authCode"`
}

type TokenStruct

type TokenStruct struct {
	AccessToken         string `json:"accessToken"`
	RefreshToken        string `json:"refreshToken"`
	AccessTokenExpires  int    `json:"accessTokenExpires"`
	RefreshTokenExpires int    `json:"refreshTokenExpires"`
}

func RefreshToken

func RefreshToken(refreshToken string) (tokenStruct TokenStruct, status bool)

Get new accesstoken and refreshToken from provided `refreshToken`

Jump to

Keyboard shortcuts

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