jwt

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

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

Go to latest
Published: May 22, 2012 License: MIT Imports: 8 Imported by: 0

README

=====
GoJWT
=====

:Author: Michael "Z" Goddard
:Contact: mzgoddard@gmail.com
:Date: Friday, September 9th, 2011
:License: MIT

`JSON Web Tokens`_ for Go_.

Interface inspired by pyjwt_.
 
Install
=======

``goinstall github.com/mzgoddard/gojwt``

Example
=======

::

  func queryJwt(w http.ResponseWriter, r *http.Request) {
    fmt.Fprint(w, string(jwt.Encode(
      map[string]interface{}{
        "iss": 12345,
        "request": map[string]interface{}{
          "name": "pie",
          "description": "triangular shaped piece of baked good",
          "delicious": true,
        },
      },
      []byte("super top secret"),
      "HS256",
    )))
  }
  

.. References
.. _JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html
.. _Go: http://golang.org
.. _pyjwt: https://github.com/progrium/pyjwt

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SecretError = errors.New("Signature verification failed")
)

Functions

func Decode

func Decode(encoded []byte, claims interface{}, key []byte) error

func Encode

func Encode(jwt interface{}, key []byte, algorithm string) ([]byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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