Documentation ¶
Overview ¶
Package miller implements tamper resistant message signing and verification.
Index ¶
Constants ¶
View Source
const DefaultTag = "miller"
DefaultTag represents the default key derivation tag.
Variables ¶
View Source
var ( // ErrInvalid represents an unprocessable token error. ErrInvalid = errors.New("miller: invalid token") // ErrSignature represents an invalid signature error. ErrSignature = errors.New("miller: invalid signature") )
Functions ¶
func GenerateKey ¶
func GenerateKey() []byte
GenerateKey returns a 256-bit key suitable for hashing with.
Types ¶
type DefaultSerializer ¶
type DefaultSerializer struct{}
DefaultSerializer is the default token serializer. This serializer leverages encoding/json for fast serialization.
func (DefaultSerializer) Decode ¶
func (s DefaultSerializer) Decode(b []byte, v interface{}) error
Decode implements the Serializer interface.
func (DefaultSerializer) Encode ¶
func (s DefaultSerializer) Encode(v interface{}) ([]byte, error)
Encode implements the Serializer interface.
type Option ¶
type Option func(*Token)
Option represents a functional option for configuration.
func SetSerializer ¶
func SetSerializer(s Serializer) Option
SetSerializer sets the serializer for token signing and verifying.
type Serializer ¶
type Serializer interface { // Encode serializes v into a byte slice. Encode(v interface{}) ([]byte, error) // Decode deserializes b and stores the result in the value pointed to by v. Decode(b []byte, v interface{}) error }
Serializer represents the ability to encode and decode data.
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
Token represents the configuration for signing and verifying token values.
Click to show internal directories.
Click to hide internal directories.