Documentation ¶
Index ¶
- Variables
- func VerifyRequest(logger log.Logger, r *http.Request, key PublicKey) bool
- type Config
- type ConfigOpt
- func WithAddress(address string) ConfigOpt
- func WithHTTPServer(httpServer *http.Server) ConfigOpt
- func WithLogger(logger log.Logger) 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 RespondFunc
- 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 )
Functions ¶
func VerifyRequest ¶
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 Config struct { Logger log.Logger HTTPServer *http.Server ServeMux *http.ServeMux URL string Address string PublicKey string CertFile string KeyFile string }
func DefaultConfig ¶
func DefaultConfig() *Config
type ConfigOpt ¶
type ConfigOpt func(config *Config)
func WithAddress ¶
func WithHTTPServer ¶
func WithLogger ¶
func WithPublicKey ¶
func WithServeMux ¶
type EventHandlerFunc ¶
type EventHandlerFunc func(responseFunc RespondFunc, payload io.Reader)
type RespondFunc ¶ added in v0.8.9
type RespondFunc func(response discord.InteractionResponse) error
type Server ¶
type Server interface { Logger() log.Logger PublicKey() PublicKey Start() Close(ctx context.Context) Handle(respondFunc RespondFunc, payload io.Reader) }
Server is used for receiving an Interaction over httpserver
func New ¶
func New(eventHandlerFunc EventHandlerFunc, opts ...ConfigOpt) 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.