Documentation ¶
Index ¶
- func ExtractMessage(token *pb.Token, result proto.Message) error
- func GenerateBytes(object proto.Message, key PrivateKey) ([]byte, error)
- func GenerateString(object proto.Message, key PrivateKey) (string, error)
- func GenerateToken(object proto.Message, key PrivateKey) (*pb.Token, error)
- func UnpackBytes(data []byte) (*pb.Token, error)
- func UnpackString(data string) (*pb.Token, error)
- func ValidateBytes(data []byte, key PublicKey, result proto.Message) (*pb.Token, error)
- func ValidateString(data string, key PublicKey, result proto.Message) (*pb.Token, error)
- func ValidateToken(token *pb.Token, key PublicKey, result proto.Message) error
- type PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractMessage ¶
ExtractMessage extracts a tokens value without validation
func GenerateBytes ¶
func GenerateBytes(object proto.Message, key PrivateKey) ([]byte, error)
GenerateBytes generates token bytes
func GenerateString ¶
func GenerateString(object proto.Message, key PrivateKey) (string, error)
GenerateString generates token string
func GenerateToken ¶
GenerateToken generates a token object
func UnpackBytes ¶
UnpackBytes unpacks token bytes without validation
func UnpackString ¶
UnpackString unpacks a token string without validation
func ValidateBytes ¶
ValidateBytes validates token bytes
func ValidateString ¶
ValidateString validates token string
Types ¶
type PrivateKey ¶
PrivateKey is used to sign tokens
func NewHMACPrivateKey ¶
func NewHMACPrivateKey(secret []byte) PrivateKey
NewHMACPrivateKey creates a new private key
func NewRSAPrivateKey ¶
func NewRSAPrivateKey(key *rsa.PrivateKey) PrivateKey
NewRSAPrivateKey creates a private key from an RSA private key
type PublicKey ¶
PublicKey is used to validate tokens
func NewHMACPublicKey ¶
NewHMACPublicKey creates a new public key
func NewRSAPublicKey ¶
NewRSAPublicKey creates a public key from an RSA public key
Click to show internal directories.
Click to hide internal directories.