Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateEncryptionKey ¶
func GenerateEncryptionKey() string
GenerateEncryptionKey returns a new random 256-bit key as a 64-char hex string.
func HandleCallback ¶
func HandleCallback(ctx context.Context, code, state string, storePendingFn func(state, token string, user DiscordUser) error) error
HandleCallback exchanges the OAuth2 code for Discord user info, then calls storePendingFn with the state, a new session token, and the Discord user.
func RequireAuth ¶
func RequireAuth(db *sql.DB, next http.HandlerFunc) http.HandlerFunc
RequireAuth is an HTTP middleware that validates the Bearer token from the DB.
Types ¶
type DiscordUser ¶
DiscordUser holds the fields we capture from the Discord /users/@me endpoint.
Click to show internal directories.
Click to hide internal directories.