Implementation of Iron HMAC cookies in Go
Перейти к файлу
Bear Cherian d910490371 docs: update travis and godoc URLs to use 'mixer' instead of 'WatchBeam' (#4) 2018-10-11 10:40:21 -07:00
cmd/iron Add simple CLI 2017-04-11 09:58:14 -07:00
.gitignore Add simple CLI 2017-04-11 09:58:14 -07:00
.travis.yml Add travis, readme, prep for release 2016-06-01 20:36:46 -07:00
LICENSE Add travis, readme, prep for release 2016-06-01 20:36:46 -07:00
ciphers.go Add travis, readme, prep for release 2016-06-01 20:36:46 -07:00
iron.go Add forgetten error check 2016-06-02 12:11:21 -07:00
iron_test.go Add sealing support 2016-06-02 12:02:44 -07:00
readme.md docs: update travis and godoc URLs to use 'mixer' instead of 'WatchBeam' (#4) 2018-10-11 10:40:21 -07:00
support.go Add sealing support 2016-06-02 12:02:44 -07:00

readme.md

iron-go Build Status godoc reference

iron-go is an implementation of Iron cookies for Go. It's fully inter-operable with the Node version. Currently it supports sealing and unsealing using a single secret key, but it should be fairly trivial to implement rotation in the future. [Citation Needed]

v := iron.New(Options{Secret: password})

// encrypt your cookie:

cookie, err := v.Seal(yourData)

// Later....

payload, err := v.Unseal(cookie)

// Use your data!

CLI

iron-go includes a simple CLI to seal and unseal cookies. Install via:

go install github.com/WatchBeam/iron-go/cmd/iron

Usage example:

➜  iron-go git:(master) iron --help
usage: iron --secret=SECRET [<flags>] <command> [<args> ...]

Flags:
      --help           Show context-sensitive help (also try --help-long and --help-man).
  -s, --secret=SECRET  Cookie encryption password
  -v, --value=VALUE    Cookie contents. If not provided, reads from stdin.

Commands:
  help [<command>...]
    Show help.

  seal
    Encrypts the cookie

  unseal
    Decrypts the cookie


➜  iron-go git:(master) pbpaste | iron unseal --secret=somethingatleast32characterslong
{"hello":"world!"}