token

package
v0.0.0-...-eac43e7 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: MPL-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HKDF_INFO_SIGNING = "services.mozilla.com/tokenlib/v1/signing"
	HKDF_INFO_DERIVE  = "services.mozilla.com/tokenlib/v1/derive/"
)

Variables

View Source
var TokenPayloadDecodingErr = errors.New("TokenPayloadDecodingErr")
View Source
var TokenSignatureMismatchErr = errors.New("TokenSignatureMismatchErr")

Functions

This section is empty.

Types

type Token

type Token struct {
	Payload       TokenPayload
	Token         string
	DerivedSecret string
}

func NewToken

func NewToken(secret []byte, payload TokenPayload) (Token, error)

func ParseToken

func ParseToken(secret []byte, tokenSecret string) (Token, error)

func (*Token) Expired

func (t *Token) Expired() bool

type TokenPayload

type TokenPayload struct {
	Salt    string  `json:"salt"`
	Uid     uint64  `json:"uid"`
	Node    string  `json:"node"`
	Expires float64 `json:"expires"`

	// fields added in https://github.com/mozilla-services/tokenserver/pull/93
	FxaUID   string `json:"fxa_uid"`
	DeviceId string `json:"device_id"`
}

func (*TokenPayload) UidString

func (t *TokenPayload) UidString() string

Jump to

Keyboard shortcuts

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