utils

package
v0.0.0-...-3e6933e Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Copyright 2018 Keydap. All rights reserved. Licensed under the Apache License, Version 2.0, see LICENSE.

Index

Constants

View Source
const DIR_PERM os.FileMode = 0744 //rwxr--r--
View Source
const FILE_PERM os.FileMode = 0644 //rw-r--r--

Variables

This section is empty.

Functions

func B64Decode

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

func B64Encode

func B64Encode(data []byte) string

func B64UrlDecode

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

func B64UrlEncode

func B64UrlEncode(data []byte) string

func BtoUint16

func BtoUint16(data []byte) uint16

func Btof

func Btof(data []byte) float64

func Btoi

func Btoi(data []byte) int64

func CheckAndCreate

func CheckAndCreate(dirName string)

func ComparePassword

func ComparePassword(plaintext string, hashVal string) bool

func CreateCert

func CreateCert(dirName string, suffix string) error

Generates a self-signed certificate and stores the PEM encoded certificate and private key with the names {suffix}.cer and {suffix}.key under the given directory.

func DateTime

func DateTime() string

func DateTimeMillis

func DateTimeMillis() int64

func DecodeUint32

func DecodeUint32(data []byte) uint32

func EncodeUint32

func EncodeUint32(v uint32) []byte

func FindHashMech

func FindHashMech(password string) *hashMech

func FormatUUID

func FormatUUID(b []byte) string

func Ftob

func Ftob(f float64) []byte

func GenUUID

func GenUUID() string

generates a UUID of version type 4

func GetRemoteAddr

func GetRemoteAddr(r *http.Request) string

func GetTimeMillis

func GetTimeMillis(rfc3339Date string) int64

func HashPassword

func HashPassword(plaintext string, algo string) string

func IsHashAlgoSupported

func IsHashAlgoSupported(algoName string) bool

func IsPasswordHashed

func IsPasswordHashed(password string) bool

func Itob

func Itob(i int64) []byte

func NewRandShaStr

func NewRandShaStr() string

func Rand32

func Rand32() []byte

func RandBytes

func RandBytes(n int) []byte

func SignWithWebHookToken

func SignWithWebHookToken(data []byte, key []byte) (string, error)

func Uint16tob

func Uint16tob(i uint16) []byte

Types

type CookieKeyCache

type CookieKeyCache struct {
	// contains filtered or unexported fields
}

func NewCookieKeyCache

func NewCookieKeyCache() *CookieKeyCache

func (*CookieKeyCache) Decrypt

func (ckc *CookieKeyCache) Decrypt(b64value string) (data []byte, err error)

func (*CookieKeyCache) DecryptBytes

func (ckc *CookieKeyCache) DecryptBytes(data []byte) ([]byte, error)

func (*CookieKeyCache) Encrypt

func (ckc *CookieKeyCache) Encrypt(value []byte) []byte

Jump to

Keyboard shortcuts

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