crypto

package
v0.0.0-...-aeca20e Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const CookieKeyByteLen = 16

Variables

View Source
var ErrKeyWrongLength = errors.New("key not 16 bytes")

Functions

func B64Decrypt

func B64Decrypt(ucookie string) ([]byte, error)

func EncryptBytesToB64

func EncryptBytesToB64(rpad []byte) (string, error)

func GenerateCookieKey

func GenerateCookieKey() []byte

Generate a new random key and set it and return it

func GetNonceTime

func GetNonceTime(nonce string) (then time.Time, err error)

func MakeLoginCookie

func MakeLoginCookie(uid int64) (string, error)

func Nonce

func Nonce() (nonce string, err error)

func ParseLogin

func ParseLogin(ucookie string) (int64, error)

func SetCookieKey

func SetCookieKey(key []byte) error

Types

type LoginCookieStruct

type LoginCookieStruct struct {
	Time int64 `cbor:"t"`
	Guid int64 `cbor:"u"`
}

Jump to

Keyboard shortcuts

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