security

package
v0.0.0-...-9ef7b20 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBase64Decode = errors.New("invalid base64 data")
)
View Source
var (
	ErrInvalidToken = errors.New("invalid token")
)

Functions

func Base64Decode

func Base64Decode(base64Data string) (string, error)

Base64Decode provides base64 decoding.

func Base64Encode

func Base64Encode(data string) string

Base64Encode provides base64 encoding.

func EncryptPassword

func EncryptPassword(password string) (string, error)

LoadServerTLSCredentials provides encrypt of password.

func ExtractToken

func ExtractToken(c *fiber.Ctx) (string, error)

ExtractToken extracts the JWT token from the request header.

func Hash

func Hash(url string) string

Hash provides hashing.

func LoadCATLSCredentials

func LoadCATLSCredentials(cert_path string) (credentials.TransportCredentials, error)

LoadCATLSCredentials provides loading of cat tls credentials.

func LoadServerTLSCredentials

func LoadServerTLSCredentials(cert_path string) (credentials.TransportCredentials, error)

LoadServerTLSCredentials provides loading of server tls credentials.

func NewToken

func NewToken(userId string) (string, error)

NewToken creates a new JWT token.

func ParseToken

func ParseToken(tokenString string) (*jwt.Token, error)

ParseToken parses and verifies the JWT token.

func ValidateToken

func ValidateToken(tokenString string) (string, error)

ValidateToken validates the JWT token and returns the user ID.

func VerifyPassword

func VerifyPassword(hashed, password string) error

LoadServerTLSCredentials provides verify of password.

Types

This section is empty.

Jump to

Keyboard shortcuts

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