Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/andreadipersio/securecookie

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/andreadipersio/securecookie

  • v0.0.0-20131119095127-e3c3b33544ec
  • Source
  • Go
  • Socket score

Version published
Created
Source

securecookie

-- import "github.com/andreadipersio/securecookie"

securecookie provide a go implementation of tornado (2.4) secure cookies.

GoDoc

Usage

func CreateSignedValue
func CreateSignedValue(secret, name, value string, createdAt time.Time) string

CreateSignedValue signs and timestamps a string so it cannot be forged.

func DecodeSignedValue
func DecodeSignedValue(secret, name, signedValue string) (string, error)

DecodeSignedValue returns the given signed cookie if it validates, or error.

func GetSecureCookie
func GetSecureCookie(r *http.Response, secret, name string) (*http.Cookie, error)

GetSecureCookie returns the named cookie provided in the response or ErrNoCookie if not found, or error if secure cookie value cannot be decoded. Secret should be a long, random sequence of bytes

func MustDecodeSignedValue
func MustDecodeSignedValue(secret, name, signedValue string) string
func SetSecureCookie
func SetSecureCookie(w http.ResponseWriter, secret string, c *http.Cookie)

SetSecureCookie signs and timestamps a cookie so it cannot be forged. Secret should be a long, random sequence of bytes to be used as the HMAC secret for the signature. Secure cookies may contain arbitrary byte values, not just unicode strings (unlike regular cookies)

func SignCookie
func SignCookie(c *http.Cookie, secret string)

SignCookie replace Value of cookie c with a signed string

FAQs

Package last updated on 19 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc