Documentation ¶
Overview ¶
Guth implements a secure stateless authentication in golang.
Creation:
payload := Payload{ Content: "6ba7b810-9dad-11d2-80b4-00c04fd430c8", // Eg. user id Created: time.Now(), // Date of creation (of the token) }
Encrypt:
key := []byte("0123456789abcdef") // AES key token, err := payload.Encrypt(key) if err != nil { log.Fatal("Encrypt error", err) }
Decrypt:
err = payload.Decrypt(token, key) if err != nil { log.Fatal("Decrypt error", err) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Payload ¶
What the token will carry
func (Payload) MarshalBinary ¶
Marshal payload to []byte
func (*Payload) UnmarshalBinary ¶
Unmarshal payload from []byte
Click to show internal directories.
Click to hide internal directories.