api

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenContextKey = "token"
)

Variables

This section is empty.

Functions

func AbortRequest

func AbortRequest(c *gin.Context, code int, reason string, err error, log *zap.SugaredLogger)

func CreateJWTToken

func CreateJWTToken(userID umid.UMID) (string, error)

CreateJWTToken saves a jwt token with the given userID as subject and signed with the given secret

func GenerateChallenge

func GenerateChallenge(wallet string) (string, error)

func GenerateGuestName

func GenerateGuestName(c *gin.Context, db database.DB) (string, error)

func GetJWTSecret

func GetJWTSecret() ([]byte, error)

func GetTokenFromContext

func GetTokenFromContext(c *gin.Context) (jwt.Token, error)

func GetTokenFromRequest

func GetTokenFromRequest(c *gin.Context) string

func GetUserIDFromContext

func GetUserIDFromContext(c *gin.Context) (umid.UMID, error)

func GetUserIDFromToken

func GetUserIDFromToken(token jwt.Token) (umid.UMID, error)

func ValidateJWTWithSecret

func ValidateJWTWithSecret(signedString string, secret []byte) (*jwt.Token, error)

func VerifyEthereumSignature

func VerifyEthereumSignature(address string, challenge string, signature string) (bool, error)

func VerifyPolkadotSignature

func VerifyPolkadotSignature(wallet, challenge, signature string) (bool, error)

Types

type HTTPError

type HTTPError struct {
	Error HTTPErrorPayload `json:"error"`
}

type HTTPErrorPayload

type HTTPErrorPayload struct {
	Reason  string `json:"reason"`
	Message string `json:"message"`
}

Directories

Path Synopsis
TODO: deal with this mess
TODO: deal with this mess

Jump to

Keyboard shortcuts

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