security

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 15 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(r *http.Request) (string, error)

ExtractToken provides extracting of token.

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 provides create a new token.

func ParseJwtCallback

func ParseJwtCallback(token *jwt.Token) (interface{}, error)

ParseJwtCallback provides parsing of Jwt Callback.

func ParseToken

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

ExtractToken provides parsing of token.

func VerifyPassword

func VerifyPassword(hashed, password string) error

LoadServerTLSCredentials provides verify of password.

Types

type TokenPayload

type TokenPayload struct {
	UserId    string
	CreatedAt time.Time
	ExpiresAt time.Time
}

TokenPayload provides the token payload instance.

func NewTokenPayload

func NewTokenPayload(tokenString string) (*TokenPayload, error)

NewTokenPayload creates a new TokenPayload instance.

Jump to

Keyboard shortcuts

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