security

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2021 License: MIT Imports: 14 Imported by: 2

README

security

Huygens security functions

Documentation

Index

Constants

View Source
const (
	// LetterIdxBits num bits to represent a letter index
	LetterIdxBits = 6
	// LetterIdxMask All 1-bits, as many as letterIdxBits
	LetterIdxMask = 1<<LetterIdxBits - 1
	// LetterIdxMax # of letter indices fitting in 63 bits
	LetterIdxMax = 63 / LetterIdxBits
)

Variables

View Source
var (
	// StampLength # lenth stamp
	StampLength int64 = 12
	// LetterBytes random string generate
	LetterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
)

Functions

func AESCbcDecrypter

func AESCbcDecrypter(key, iv, ciphertext string) ([]byte, error)

AESCbcDecrypter decrypt aes cipher strings

func AESCbcEncrypter

func AESCbcEncrypter(key, iv, s string) (string, error)

AESCbcEncrypter encrypt strings to aes cipher strings

func CreateNewClientID

func CreateNewClientID(email string) string

CreateNewClientID generate SHA-256 hash string

func GenerateAccessToken

func GenerateAccessToken(clientID, secreteKeyID string, expire int) (string, error)

GenerateAccessToken generate SHA-256 hash string expire in seconds

func GenerateRandomStringFixedLenght

func GenerateRandomStringFixedLenght(length, timestamp int64) string

GenerateRandomStringFixedLenght doc ...

func GenerateSecretKey

func GenerateSecretKey(email, clientID, password string, expire int) (string, error)

GenerateSecretKey generate SHA-256 hash string expire in seconds

func GenerateSecurePassword

func GenerateSecurePassword(password string) (string, error)

GenerateSecurePassword generate bcrypt password

func ValidateAccessToken

func ValidateAccessToken(token string) (string, bool, error)

ValidateAccessToken validate token Return the client_id. The bool value indicate whether the token is valid.

func ValidateAccessTokenFunc

func ValidateAccessTokenFunc(token string) (json.RawMessage, bool)

ValidateAccessTokenFunc doc ...

func ValidateSecretKey

func ValidateSecretKey(secretKey string) (bool, error)

ValidateSecretKey validate secret key

func ValidateSecurePassword

func ValidateSecurePassword(password, hash string) (bool, error)

ValidateSecurePassword validate user password

Types

This section is empty.

Jump to

Keyboard shortcuts

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