Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrDecryption = errgo.New("decryption error") ErrInvalidCookie = errgo.New("invalid cookie") )
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec is used to create an encrypted messages that will be decrypted by the same service. This should be used for cookies and other data that needs to be sent through the client but must be verifiable as originally coming from this service.
func (*Codec) Cookie ¶
Cookie decodes the cookie with the given name from the given request into v. The given verification string is used to ensure the cookie is valid.
func (*Codec) Decode ¶
Decode unmarshals a value from the given buffer that must have been marshaled with a Codec using the same key. If there was an error decrypting buf the returned error will have a cause of ErrDecryption.
func (*Codec) Encode ¶
Encode marshals the given value in such a way that it can only be unmarshaled by a Codec using the same key. The encoded output will be in the base64 url safe alphabet.