Documentation
¶
Index ¶
- Variables
- func VerifyRequest(logger log.Logger, r *http.Request, key PublicKey) bool
- type Config
- type ConfigOpt
- func WithHTTPServer(httpServer *http.Server) ConfigOpt
- func WithLogger(logger log.Logger) ConfigOpt
- func WithPort(port string) ConfigOpt
- func WithPublicKey(publicKey string) ConfigOpt
- func WithServeMux(serveMux *http.ServeMux) ConfigOpt
- func WithTLS(certFile string, keyFile string) ConfigOpt
- func WithURL(url string) ConfigOpt
- type EventHandlerFunc
- type PublicKey
- type Server
- type WebhookInteractionHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Verify = func(publicKey PublicKey, message, sig []byte) bool { return ed25519.Verify(publicKey, message, sig) } SignatureSize = ed25519.SignatureSize )
View Source
var DefaultConfig = Config{
URL: "/interactions/callback",
Port: ":80",
}
Functions ¶
func VerifyRequest ¶ added in v0.7.3
VerifyRequest implements the verification side of the discord interactions api signing algorithm, as documented here: https://discord.com/developers/docs/interactions/slash-commands#security-and-authorization Credit: https://github.com/bsdlp/discord-interactions-go/blob/main/interactions/verify.go
Types ¶
type Config ¶
type ConfigOpt ¶
type ConfigOpt func(config *Config)
func WithHTTPServer ¶
func WithLogger ¶
func WithPublicKey ¶
func WithServeMux ¶
type EventHandlerFunc ¶
type EventHandlerFunc func(responseChannel chan<- discord.InteractionResponse, payload io.Reader)
type Server ¶
type Server interface {
Logger() log.Logger
PublicKey() PublicKey
Config() Config
Start()
Close(ctx context.Context)
}
Server is used for receiving an Interaction over httpserver
func New ¶
func New(eventHandlerFunc EventHandlerFunc, config *Config) Server
type WebhookInteractionHandler ¶
type WebhookInteractionHandler struct {
// contains filtered or unexported fields
}
func (*WebhookInteractionHandler) ServeHTTP ¶
func (h *WebhookInteractionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.