crypto

package
v0.0.0-...-dffdc56 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package crypto contents type and methods for encryption/decryption

Index

Constants

View Source
const (
	SymmKeyLength = 24 // length of user symmetric key
)

Variables

This section is empty.

Functions

func CheckToken

func CheckToken(tkn string, key []byte) (string, error)

CheckToken checks jwt token is provided by cli

func DecryptKey

func DecryptKey(symm []byte, data string) ([]byte, error)

DecryptKey decrypt data with symmKey

func EncryptKey

func EncryptKey(symmKey []byte, data []byte) (string, error)

EncryptKey encrypt data with symmKey

func GenServerKey

func GenServerKey(n int) (string, error)

GenServerKey generates master server key when it isn't provided

func GenSymmKey

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

GenKey return symmetric key for user when signup and for server

func GenX509KeyPair

func GenX509KeyPair() (tls.Certificate, error)

GenX509KeyPair generates the TLS keypair for the server https://gist.github.com/shivakar/cd52b5594d4912fbeb46

func GetToken

func GetToken(_ context.Context, login string, passwd string, userData types.StorageModel, key []byte) (string, error)

GetToken generate jwt session token for user

func HashPasswd

func HashPasswd(_ context.Context, passwd []byte) (string, error)

HashPasswd return hash of password

Types

This section is empty.

Jump to

Keyboard shortcuts

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