cookier

package
v0.0.0-...-4e2ebe7 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

example: key := "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" // 64 hex chars ec := cookier.Encode(key, cookier.Cookie{time.Now().Unix() + 3600, "{\token\":\"123\"}"}) dc, _ := cookier.Decode(key, ec) // ignoring err and expiration err json.Unmarshal(dc.Value, &s) // ignoring err

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(k string, c Cookie) string

Encodes Cookie c with key k

Types

type Cookie struct {
	Expires int64  `json:"expires"`
	Value   string `json:"value"`
}

Cookie is a Value (could be marshalled json) and Expires (unix time)

func Decode

func Decode(k string, s string) (Cookie, error)

Decodes s with key k into Cookie. Returns an error if expired.

Jump to

Keyboard shortcuts

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