ecookie

package module
v0.0.0-...-a380b44 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

README

ecookie

sign, encrypt and authenticate cookies with golang...
this package uses rabbit cipher to encrypt and blake2 hash function in order to authenticate cookies.

why ecookies are special?

  • client cannot read content of the cookie
  • client cannot change or modify content of the cookie.
usage and example

checkout example folder... simple http server that uses ecookie package

this package lives on snix public git servers, this one is just a mirror..
execute go get snix.ir/ecookie or go get github.com/sina-ghaderi/ecookie to use this packge.

ecookie process flow

ecookie package process flow, this is how ecookie encrypt data and calculate MAC

Encrypt
ecookie decrypting data and cookie auth

Decrypt

go test ecookie

execute go test -v on project root directory to test this package.

feel free to email me sina@snix.ir if you want to contribute to this project

Copyright 2022 SNIX LLC sina@snix.ir Apache License

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAUTHCOK = errors.New("ecookie: cookie is corrupted")
	ErrENDDATA = errors.New("ecookie: cookie length is too short")

	ErrBadKlen = errors.New("ecookie: key must be 16 byte len")
)

Functions

This section is empty.

Types

type Decryptor

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

func NewDecryptor

func NewDecryptor(key []byte) (*Decryptor, error)

func (*Decryptor) Decrypt

func (h *Decryptor) Decrypt(raw []byte) ([]byte, error)

type Encryptor

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

func NewEncryptor

func NewEncryptor(key []byte) (*Encryptor, error)

func (*Encryptor) Encrypt

func (h *Encryptor) Encrypt(src []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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