Documentation
¶
Overview ¶
Package signedvalue provides signed and timestamped strings compatible with Tornado's create_signed_value and decode_signed_value.
Only v2 format is supported.
Index ¶
- Variables
- func Create(key string, name string, value string) string
- func CreateWithKeyVersioning(keys map[int]string, keyVersion int, name string, value string) (string, error)
- func Decode(key string, name string, signed string, ttl int) (string, error)
- func DecodeWithKeyVersioning(keys map[int]string, name string, signed string, ttl int) (decoded string, error error)
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidKey = errors.New("invalid secret key")
ErrInvalidKey means that a key with requested version had not been found.
var ErrInvalidName = errors.New("invalid name")
ErrInvalidName means that the name inside the signed value didn't match with a name passed to the decode function.
var ErrInvalidSignature = errors.New("invalid signature")
ErrInvalidSignature means that the signature could not be verified.
var ErrMalformedField = errors.New("malformed field")
ErrMalformedField means that a field is broken and cannot be decoded properly.
var ErrSignatureExpired = errors.New("signature expired")
ErrSignatureExpired means that the signature expired, thus the signed value should not be trusted any more.
var ErrSignatureInFuture = errors.New("signature in future")
ErrSignatureInFuture means that the timestamp is in future and cannot be checked properly, thus should not be trusted.
var ErrValueDecodeFailed = errors.New("value decode failed")
ErrValueDecodeFailed literally means that value could not be decoded.
Functions ¶
func Create ¶
Create creates signed and timestamped string so the string cannot be forged. This method doesn't support secret key versioning.
func CreateWithKeyVersioning ¶
func CreateWithKeyVersioning(keys map[int]string, keyVersion int, name string, value string) (string, error)
CreateWithKeyVersioning creates signed and timestamped string using the given secret key version.
Types ¶
This section is empty.