Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/golangtoolkits/go-secure-cookies

A secure cookie module for golang
https://github.com/golangtoolkits/go-secure-cookies

cookie cookies go golang securecookie

Last synced: about 1 month ago
JSON representation

A secure cookie module for golang

Awesome Lists containing this project

README

        

# go-secure-cookies
A secure cookie module for golang

```go

// securekey must be at least 16 char long
// The key argument should be the AES key,
// either 16, 24, or 32 bytes to select
// AES-128, AES-192, or AES-256.
var key = "dsdfs6dfs61dssdfsdfdsdsfsdsdllsd"
cookies, err := NewCookies(key)

var ck http.Cookie
ck.Name = "test1"
ck.Value = "this-is-a-test-and-more"

//write----
w http.ResponseWriter
err := cookies.write(w, ck)

var name = "test1"

//read----
r *http.Request
cookieValue, err := cookies.Read(r, name)

```