utils

package
v0.0.0-...-32d7a98 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// UserCertType mark as user certificate
	UserCertType string = "user"
	// HostCertType mark as host certificate
	HostCertType string = "host"
)
View Source
const EnvPrefix string = "CERTONID"

EnvPrefix for environment variables

Variables

View Source
var EnvStrReplacer = strings.NewReplacer(".", "_")

EnvStrReplacer for environment variables

Functions

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

GenerateRandomString returns a securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GetENV

func GetENV(key string) (string, bool)

GetENV return env key as string

func SymmetricDecrypt

func SymmetricDecrypt(val string) ([]byte, error)

SymmetricDecrypt decrypt value by CERTONID_SYMMETRIC_KEY

func SymmetricEncrypt

func SymmetricEncrypt(data []byte) (string, error)

SymmetricEncrypt encrypt value by CERTONID_SYMMETRIC_KEY

Types

This section is empty.

Jump to

Keyboard shortcuts

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